0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef _LINUX_DM_KCOPYD_H
0013 #define _LINUX_DM_KCOPYD_H
0014
0015 #ifdef __KERNEL__
0016
0017 #include <linux/dm-io.h>
0018
0019
0020 #define DM_KCOPYD_MAX_REGIONS 8
0021
0022 #define DM_KCOPYD_IGNORE_ERROR 1
0023 #define DM_KCOPYD_WRITE_SEQ 2
0024
0025 struct dm_kcopyd_throttle {
0026 unsigned throttle;
0027 unsigned num_io_jobs;
0028 unsigned io_period;
0029 unsigned total_period;
0030 unsigned last_jiffies;
0031 };
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 #define DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(name, description) \
0043 static struct dm_kcopyd_throttle dm_kcopyd_throttle = { 100, 0, 0, 0, 0 }; \
0044 module_param_named(name, dm_kcopyd_throttle.throttle, uint, 0644); \
0045 MODULE_PARM_DESC(name, description)
0046
0047
0048
0049
0050
0051 struct dm_kcopyd_client;
0052 struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *throttle);
0053 void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);
0054 void dm_kcopyd_client_flush(struct dm_kcopyd_client *kc);
0055
0056
0057
0058
0059
0060
0061
0062
0063 typedef void (*dm_kcopyd_notify_fn)(int read_err, unsigned long write_err,
0064 void *context);
0065
0066 void dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
0067 unsigned num_dests, struct dm_io_region *dests,
0068 unsigned flags, dm_kcopyd_notify_fn fn, void *context);
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081 void *dm_kcopyd_prepare_callback(struct dm_kcopyd_client *kc,
0082 dm_kcopyd_notify_fn fn, void *context);
0083 void dm_kcopyd_do_callback(void *job, int read_err, unsigned long write_err);
0084
0085 void dm_kcopyd_zero(struct dm_kcopyd_client *kc,
0086 unsigned num_dests, struct dm_io_region *dests,
0087 unsigned flags, dm_kcopyd_notify_fn fn, void *context);
0088
0089 #endif
0090 #endif