diff options
Diffstat (limited to 'include/linux/device-mapper.h')
-rw-r--r-- | include/linux/device-mapper.h | 49 |
1 files changed, 32 insertions, 17 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); |