diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/device-mapper.h | 49 | ||||
-rw-r--r-- | include/linux/dm-kcopyd.h | 25 | ||||
-rw-r--r-- | include/uapi/linux/dm-ioctl.h | 11 |
3 files changed, 64 insertions, 21 deletions
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index bf6afa2fc432..1e483fa7afb4 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -68,8 +68,8 @@ typedef void (*dm_postsuspend_fn) (struct dm_target *ti); | |||
68 | typedef int (*dm_preresume_fn) (struct dm_target *ti); | 68 | typedef int (*dm_preresume_fn) (struct dm_target *ti); |
69 | typedef void (*dm_resume_fn) (struct dm_target *ti); | 69 | typedef void (*dm_resume_fn) (struct dm_target *ti); |
70 | 70 | ||
71 | typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, | 71 | typedef void (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, |
72 | unsigned status_flags, char *result, unsigned maxlen); | 72 | unsigned status_flags, char *result, unsigned maxlen); |
73 | 73 | ||
74 | typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); | 74 | typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); |
75 | 75 | ||
@@ -175,6 +175,14 @@ struct target_type { | |||
175 | #define DM_TARGET_IMMUTABLE 0x00000004 | 175 | #define DM_TARGET_IMMUTABLE 0x00000004 |
176 | #define dm_target_is_immutable(type) ((type)->features & DM_TARGET_IMMUTABLE) | 176 | #define dm_target_is_immutable(type) ((type)->features & DM_TARGET_IMMUTABLE) |
177 | 177 | ||
178 | /* | ||
179 | * Some targets need to be sent the same WRITE bio severals times so | ||
180 | * that they can send copies of it to different devices. This function | ||
181 | * examines any supplied bio and returns the number of copies of it the | ||
182 | * target requires. | ||
183 | */ | ||
184 | typedef unsigned (*dm_num_write_bios_fn) (struct dm_target *ti, struct bio *bio); | ||
185 | |||
178 | struct dm_target { | 186 | struct dm_target { |
179 | struct dm_table *table; | 187 | struct dm_table *table; |
180 | struct target_type *type; | 188 | struct target_type *type; |
@@ -187,26 +195,26 @@ struct dm_target { | |||
187 | uint32_t max_io_len; | 195 | uint32_t max_io_len; |
188 | 196 | ||
189 | /* | 197 | /* |
190 | * A number of zero-length barrier requests that will be submitted | 198 | * A number of zero-length barrier bios that will be submitted |
191 | * to the target for the purpose of flushing cache. | 199 | * to the target for the purpose of flushing cache. |
192 | * | 200 | * |
193 | * The request number can be accessed with dm_bio_get_target_request_nr. | 201 | * The bio number can be accessed with dm_bio_get_target_bio_nr. |
194 | * It is a responsibility of the target driver to remap these requests | 202 | * It is a responsibility of the target driver to remap these bios |
195 | * to the real underlying devices. | 203 | * to the real underlying devices. |
196 | */ | 204 | */ |
197 | unsigned num_flush_requests; | 205 | unsigned num_flush_bios; |
198 | 206 | ||
199 | /* | 207 | /* |
200 | * The number of discard requests that will be submitted to the target. | 208 | * The number of discard bios that will be submitted to the target. |
201 | * The request number can be accessed with dm_bio_get_target_request_nr. | 209 | * The bio number can be accessed with dm_bio_get_target_bio_nr. |
202 | */ | 210 | */ |
203 | unsigned num_discard_requests; | 211 | unsigned num_discard_bios; |
204 | 212 | ||
205 | /* | 213 | /* |
206 | * The number of WRITE SAME requests that will be submitted to the target. | 214 | * The number of WRITE SAME bios that will be submitted to the target. |
207 | * The request number can be accessed with dm_bio_get_target_request_nr. | 215 | * The bio number can be accessed with dm_bio_get_target_bio_nr. |
208 | */ | 216 | */ |
209 | unsigned num_write_same_requests; | 217 | unsigned num_write_same_bios; |
210 | 218 | ||
211 | /* | 219 | /* |
212 | * The minimum number of extra bytes allocated in each bio for the | 220 | * The minimum number of extra bytes allocated in each bio for the |
@@ -214,6 +222,13 @@ struct dm_target { | |||
214 | */ | 222 | */ |
215 | unsigned per_bio_data_size; | 223 | unsigned per_bio_data_size; |
216 | 224 | ||
225 | /* | ||
226 | * If defined, this function is called to find out how many | ||
227 | * duplicate bios should be sent to the target when writing | ||
228 | * data. | ||
229 | */ | ||
230 | dm_num_write_bios_fn num_write_bios; | ||
231 | |||
217 | /* target specific data */ | 232 | /* target specific data */ |
218 | void *private; | 233 | void *private; |
219 | 234 | ||
@@ -233,10 +248,10 @@ struct dm_target { | |||
233 | bool discards_supported:1; | 248 | bool discards_supported:1; |
234 | 249 | ||
235 | /* | 250 | /* |
236 | * Set if the target required discard request to be split | 251 | * Set if the target required discard bios to be split |
237 | * on max_io_len boundary. | 252 | * on max_io_len boundary. |
238 | */ | 253 | */ |
239 | bool split_discard_requests:1; | 254 | bool split_discard_bios:1; |
240 | 255 | ||
241 | /* | 256 | /* |
242 | * Set if this target does not return zeroes on discarded blocks. | 257 | * Set if this target does not return zeroes on discarded blocks. |
@@ -261,7 +276,7 @@ struct dm_target_io { | |||
261 | struct dm_io *io; | 276 | struct dm_io *io; |
262 | struct dm_target *ti; | 277 | struct dm_target *ti; |
263 | union map_info info; | 278 | union map_info info; |
264 | unsigned target_request_nr; | 279 | unsigned target_bio_nr; |
265 | struct bio clone; | 280 | struct bio clone; |
266 | }; | 281 | }; |
267 | 282 | ||
@@ -275,9 +290,9 @@ static inline struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size) | |||
275 | return (struct bio *)((char *)data + data_size + offsetof(struct dm_target_io, clone)); | 290 | return (struct bio *)((char *)data + data_size + offsetof(struct dm_target_io, clone)); |
276 | } | 291 | } |
277 | 292 | ||
278 | static inline unsigned dm_bio_get_target_request_nr(const struct bio *bio) | 293 | static inline unsigned dm_bio_get_target_bio_nr(const struct bio *bio) |
279 | { | 294 | { |
280 | return container_of(bio, struct dm_target_io, clone)->target_request_nr; | 295 | return container_of(bio, struct dm_target_io, clone)->target_bio_nr; |
281 | } | 296 | } |
282 | 297 | ||
283 | int dm_register_target(struct target_type *t); | 298 | int dm_register_target(struct target_type *t); |
diff --git a/include/linux/dm-kcopyd.h b/include/linux/dm-kcopyd.h index 47d9d376e4e7..f486d636b82e 100644 --- a/include/linux/dm-kcopyd.h +++ b/include/linux/dm-kcopyd.h | |||
@@ -21,11 +21,34 @@ | |||
21 | 21 | ||
22 | #define DM_KCOPYD_IGNORE_ERROR 1 | 22 | #define DM_KCOPYD_IGNORE_ERROR 1 |
23 | 23 | ||
24 | struct dm_kcopyd_throttle { | ||
25 | unsigned throttle; | ||
26 | unsigned num_io_jobs; | ||
27 | unsigned io_period; | ||
28 | unsigned total_period; | ||
29 | unsigned last_jiffies; | ||
30 | }; | ||
31 | |||
32 | /* | ||
33 | * kcopyd clients that want to support throttling must pass an initialised | ||
34 | * dm_kcopyd_throttle struct into dm_kcopyd_client_create(). | ||
35 | * Two or more clients may share the same instance of this struct between | ||
36 | * them if they wish to be throttled as a group. | ||
37 | * | ||
38 | * This macro also creates a corresponding module parameter to configure | ||
39 | * the amount of throttling. | ||
40 | */ | ||
41 | #define DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(name, description) \ | ||
42 | static struct dm_kcopyd_throttle dm_kcopyd_throttle = { 100, 0, 0, 0, 0 }; \ | ||
43 | module_param_named(name, dm_kcopyd_throttle.throttle, uint, 0644); \ | ||
44 | MODULE_PARM_DESC(name, description) | ||
45 | |||
24 | /* | 46 | /* |
25 | * To use kcopyd you must first create a dm_kcopyd_client object. | 47 | * To use kcopyd you must first create a dm_kcopyd_client object. |
48 | * throttle can be NULL if you don't want any throttling. | ||
26 | */ | 49 | */ |
27 | struct dm_kcopyd_client; | 50 | struct dm_kcopyd_client; |
28 | struct dm_kcopyd_client *dm_kcopyd_client_create(void); | 51 | struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *throttle); |
29 | void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc); | 52 | void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc); |
30 | 53 | ||
31 | /* | 54 | /* |
diff --git a/include/uapi/linux/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h index 539b179b349c..7e75b6fd8d45 100644 --- a/include/uapi/linux/dm-ioctl.h +++ b/include/uapi/linux/dm-ioctl.h | |||
@@ -267,9 +267,9 @@ enum { | |||
267 | #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) | 267 | #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) |
268 | 268 | ||
269 | #define DM_VERSION_MAJOR 4 | 269 | #define DM_VERSION_MAJOR 4 |
270 | #define DM_VERSION_MINOR 23 | 270 | #define DM_VERSION_MINOR 24 |
271 | #define DM_VERSION_PATCHLEVEL 1 | 271 | #define DM_VERSION_PATCHLEVEL 0 |
272 | #define DM_VERSION_EXTRA "-ioctl (2012-12-18)" | 272 | #define DM_VERSION_EXTRA "-ioctl (2013-01-15)" |
273 | 273 | ||
274 | /* Status bits */ | 274 | /* Status bits */ |
275 | #define DM_READONLY_FLAG (1 << 0) /* In/Out */ | 275 | #define DM_READONLY_FLAG (1 << 0) /* In/Out */ |
@@ -336,4 +336,9 @@ enum { | |||
336 | */ | 336 | */ |
337 | #define DM_SECURE_DATA_FLAG (1 << 15) /* In */ | 337 | #define DM_SECURE_DATA_FLAG (1 << 15) /* In */ |
338 | 338 | ||
339 | /* | ||
340 | * If set, a message generated output data. | ||
341 | */ | ||
342 | #define DM_DATA_OUT_FLAG (1 << 16) /* Out */ | ||
343 | |||
339 | #endif /* _LINUX_DM_IOCTL_H */ | 344 | #endif /* _LINUX_DM_IOCTL_H */ |