Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Heinz Mauelshagen | eb69aca | 2008-04-24 21:43:19 +0100 | [diff] [blame] | 2 | * Copyright (C) 2001 - 2003 Sistina Software |
| 3 | * Copyright (C) 2004 - 2008 Red Hat, Inc. All rights reserved. |
| 4 | * |
| 5 | * kcopyd provides a simple interface for copying an area of one |
| 6 | * block-device to one or more other block-devices, either synchronous |
| 7 | * or with an asynchronous completion notification. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * |
| 9 | * This file is released under the GPL. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Heinz Mauelshagen | eb69aca | 2008-04-24 21:43:19 +0100 | [diff] [blame] | 12 | #ifndef _LINUX_DM_KCOPYD_H |
| 13 | #define _LINUX_DM_KCOPYD_H |
| 14 | |
| 15 | #ifdef __KERNEL__ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Alasdair G Kergon | a765e20 | 2008-04-24 22:02:01 +0100 | [diff] [blame] | 17 | #include <linux/dm-io.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | |
| 19 | /* FIXME: make this configurable */ |
Heinz Mauelshagen | eb69aca | 2008-04-24 21:43:19 +0100 | [diff] [blame] | 20 | #define DM_KCOPYD_MAX_REGIONS 8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
Heinz Mauelshagen | eb69aca | 2008-04-24 21:43:19 +0100 | [diff] [blame] | 22 | #define DM_KCOPYD_IGNORE_ERROR 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
| 24 | /* |
Heinz Mauelshagen | eb69aca | 2008-04-24 21:43:19 +0100 | [diff] [blame] | 25 | * To use kcopyd you must first create a dm_kcopyd_client object. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | */ |
Heinz Mauelshagen | eb69aca | 2008-04-24 21:43:19 +0100 | [diff] [blame] | 27 | struct dm_kcopyd_client; |
Mikulas Patocka | fa34ce7 | 2011-05-29 13:03:13 +0100 | [diff] [blame] | 28 | struct dm_kcopyd_client *dm_kcopyd_client_create(void); |
Heinz Mauelshagen | eb69aca | 2008-04-24 21:43:19 +0100 | [diff] [blame] | 29 | void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | |
| 31 | /* |
| 32 | * Submit a copy job to kcopyd. This is built on top of the |
| 33 | * previous three fns. |
| 34 | * |
| 35 | * read_err is a boolean, |
| 36 | * write_err is a bitset, with 1 bit for each destination region |
| 37 | */ |
Heinz Mauelshagen | eb69aca | 2008-04-24 21:43:19 +0100 | [diff] [blame] | 38 | typedef void (*dm_kcopyd_notify_fn)(int read_err, unsigned long write_err, |
| 39 | void *context); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
Heinz Mauelshagen | eb69aca | 2008-04-24 21:43:19 +0100 | [diff] [blame] | 41 | int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from, |
| 42 | unsigned num_dests, struct dm_io_region *dests, |
| 43 | unsigned flags, dm_kcopyd_notify_fn fn, void *context); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
Heinz Mauelshagen | eb69aca | 2008-04-24 21:43:19 +0100 | [diff] [blame] | 45 | #endif /* __KERNEL__ */ |
| 46 | #endif /* _LINUX_DM_KCOPYD_H */ |