aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device-mapper.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/device-mapper.h')
-rw-r--r--include/linux/device-mapper.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 6f0e73b4a80d..eb96ef6fd8b7 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -23,7 +23,6 @@ typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t;
23union map_info { 23union map_info {
24 void *ptr; 24 void *ptr;
25 unsigned long long ll; 25 unsigned long long ll;
26 unsigned target_request_nr;
27}; 26};
28 27
29/* 28/*
@@ -193,20 +192,21 @@ struct dm_target {
193 * A number of zero-length barrier requests that will be submitted 192 * A number of zero-length barrier requests that will be submitted
194 * to the target for the purpose of flushing cache. 193 * to the target for the purpose of flushing cache.
195 * 194 *
196 * The request number will be placed in union map_info->target_request_nr. 195 * The request number can be accessed with dm_bio_get_target_request_nr.
197 * It is a responsibility of the target driver to remap these requests 196 * It is a responsibility of the target driver to remap these requests
198 * to the real underlying devices. 197 * to the real underlying devices.
199 */ 198 */
200 unsigned num_flush_requests; 199 unsigned num_flush_requests;
201 200
202 /* 201 /*
203 * The number of discard requests that will be submitted to the 202 * The number of discard requests that will be submitted to the target.
204 * target. map_info->request_nr is used just like num_flush_requests. 203 * The request number can be accessed with dm_bio_get_target_request_nr.
205 */ 204 */
206 unsigned num_discard_requests; 205 unsigned num_discard_requests;
207 206
208 /* 207 /*
209 * The number of WRITE SAME requests that will be submitted to the target. 208 * The number of WRITE SAME requests that will be submitted to the target.
209 * The request number can be accessed with dm_bio_get_target_request_nr.
210 */ 210 */
211 unsigned num_write_same_requests; 211 unsigned num_write_same_requests;
212 212
@@ -263,6 +263,7 @@ struct dm_target_io {
263 struct dm_io *io; 263 struct dm_io *io;
264 struct dm_target *ti; 264 struct dm_target *ti;
265 union map_info info; 265 union map_info info;
266 unsigned target_request_nr;
266 struct bio clone; 267 struct bio clone;
267}; 268};
268 269
@@ -276,6 +277,11 @@ static inline struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size)
276 return (struct bio *)((char *)data + data_size + offsetof(struct dm_target_io, clone)); 277 return (struct bio *)((char *)data + data_size + offsetof(struct dm_target_io, clone));
277} 278}
278 279
280static inline unsigned dm_bio_get_target_request_nr(const struct bio *bio)
281{
282 return container_of(bio, struct dm_target_io, clone)->target_request_nr;
283}
284
279int dm_register_target(struct target_type *t); 285int dm_register_target(struct target_type *t);
280void dm_unregister_target(struct target_type *t); 286void dm_unregister_target(struct target_type *t);
281 287