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; |
| 28 | int dm_kcopyd_client_create(unsigned num_pages, |
| 29 | struct dm_kcopyd_client **result); |
| 30 | void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
| 32 | /* |
| 33 | * Submit a copy job to kcopyd. This is built on top of the |
| 34 | * previous three fns. |
| 35 | * |
| 36 | * read_err is a boolean, |
| 37 | * write_err is a bitset, with 1 bit for each destination region |
| 38 | */ |
Heinz Mauelshagen | eb69aca | 2008-04-24 21:43:19 +0100 | [diff] [blame] | 39 | typedef void (*dm_kcopyd_notify_fn)(int read_err, unsigned long write_err, |
| 40 | void *context); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | |
Heinz Mauelshagen | eb69aca | 2008-04-24 21:43:19 +0100 | [diff] [blame] | 42 | int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from, |
| 43 | unsigned num_dests, struct dm_io_region *dests, |
| 44 | unsigned flags, dm_kcopyd_notify_fn fn, void *context); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | |
Heinz Mauelshagen | eb69aca | 2008-04-24 21:43:19 +0100 | [diff] [blame] | 46 | #endif /* __KERNEL__ */ |
| 47 | #endif /* _LINUX_DM_KCOPYD_H */ |