diff options
Diffstat (limited to 'include/linux/device-mapper.h')
-rw-r--r-- | include/linux/device-mapper.h | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index ded2d7c42668..655e7721580a 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/bio.h> | 11 | #include <linux/bio.h> |
12 | #include <linux/blkdev.h> | 12 | #include <linux/blkdev.h> |
13 | 13 | ||
14 | struct dm_dev; | ||
14 | struct dm_target; | 15 | struct dm_target; |
15 | struct dm_table; | 16 | struct dm_table; |
16 | struct mapped_device; | 17 | struct mapped_device; |
@@ -21,6 +22,7 @@ typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t; | |||
21 | union map_info { | 22 | union map_info { |
22 | void *ptr; | 23 | void *ptr; |
23 | unsigned long long ll; | 24 | unsigned long long ll; |
25 | unsigned flush_request; | ||
24 | }; | 26 | }; |
25 | 27 | ||
26 | /* | 28 | /* |
@@ -80,6 +82,15 @@ typedef int (*dm_ioctl_fn) (struct dm_target *ti, unsigned int cmd, | |||
80 | typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, | 82 | typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, |
81 | struct bio_vec *biovec, int max_size); | 83 | struct bio_vec *biovec, int max_size); |
82 | 84 | ||
85 | typedef int (*iterate_devices_callout_fn) (struct dm_target *ti, | ||
86 | struct dm_dev *dev, | ||
87 | sector_t start, sector_t len, | ||
88 | void *data); | ||
89 | |||
90 | typedef int (*dm_iterate_devices_fn) (struct dm_target *ti, | ||
91 | iterate_devices_callout_fn fn, | ||
92 | void *data); | ||
93 | |||
83 | /* | 94 | /* |
84 | * Returns: | 95 | * Returns: |
85 | * 0: The target can handle the next I/O immediately. | 96 | * 0: The target can handle the next I/O immediately. |
@@ -92,7 +103,8 @@ void dm_error(const char *message); | |||
92 | /* | 103 | /* |
93 | * Combine device limits. | 104 | * Combine device limits. |
94 | */ | 105 | */ |
95 | void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev); | 106 | int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, |
107 | sector_t start, sector_t len, void *data); | ||
96 | 108 | ||
97 | struct dm_dev { | 109 | struct dm_dev { |
98 | struct block_device *bdev; | 110 | struct block_device *bdev; |
@@ -138,23 +150,12 @@ struct target_type { | |||
138 | dm_ioctl_fn ioctl; | 150 | dm_ioctl_fn ioctl; |
139 | dm_merge_fn merge; | 151 | dm_merge_fn merge; |
140 | dm_busy_fn busy; | 152 | dm_busy_fn busy; |
153 | dm_iterate_devices_fn iterate_devices; | ||
141 | 154 | ||
142 | /* For internal device-mapper use. */ | 155 | /* For internal device-mapper use. */ |
143 | struct list_head list; | 156 | struct list_head list; |
144 | }; | 157 | }; |
145 | 158 | ||
146 | struct io_restrictions { | ||
147 | unsigned long bounce_pfn; | ||
148 | unsigned long seg_boundary_mask; | ||
149 | unsigned max_hw_sectors; | ||
150 | unsigned max_sectors; | ||
151 | unsigned max_segment_size; | ||
152 | unsigned short hardsect_size; | ||
153 | unsigned short max_hw_segments; | ||
154 | unsigned short max_phys_segments; | ||
155 | unsigned char no_cluster; /* inverted so that 0 is default */ | ||
156 | }; | ||
157 | |||
158 | struct dm_target { | 159 | struct dm_target { |
159 | struct dm_table *table; | 160 | struct dm_table *table; |
160 | struct target_type *type; | 161 | struct target_type *type; |
@@ -163,15 +164,18 @@ struct dm_target { | |||
163 | sector_t begin; | 164 | sector_t begin; |
164 | sector_t len; | 165 | sector_t len; |
165 | 166 | ||
166 | /* FIXME: turn this into a mask, and merge with io_restrictions */ | ||
167 | /* Always a power of 2 */ | 167 | /* Always a power of 2 */ |
168 | sector_t split_io; | 168 | sector_t split_io; |
169 | 169 | ||
170 | /* | 170 | /* |
171 | * These are automatically filled in by | 171 | * A number of zero-length barrier requests that will be submitted |
172 | * dm_table_get_device. | 172 | * to the target for the purpose of flushing cache. |
173 | * | ||
174 | * The request number will be placed in union map_info->flush_request. | ||
175 | * It is a responsibility of the target driver to remap these requests | ||
176 | * to the real underlying devices. | ||
173 | */ | 177 | */ |
174 | struct io_restrictions limits; | 178 | unsigned num_flush_requests; |
175 | 179 | ||
176 | /* target specific data */ | 180 | /* target specific data */ |
177 | void *private; | 181 | void *private; |
@@ -230,6 +234,7 @@ struct gendisk *dm_disk(struct mapped_device *md); | |||
230 | int dm_suspended(struct mapped_device *md); | 234 | int dm_suspended(struct mapped_device *md); |
231 | int dm_noflush_suspending(struct dm_target *ti); | 235 | int dm_noflush_suspending(struct dm_target *ti); |
232 | union map_info *dm_get_mapinfo(struct bio *bio); | 236 | union map_info *dm_get_mapinfo(struct bio *bio); |
237 | union map_info *dm_get_rq_mapinfo(struct request *rq); | ||
233 | 238 | ||
234 | /* | 239 | /* |
235 | * Geometry functions. | 240 | * Geometry functions. |
@@ -392,4 +397,12 @@ static inline unsigned long to_bytes(sector_t n) | |||
392 | return (n << SECTOR_SHIFT); | 397 | return (n << SECTOR_SHIFT); |
393 | } | 398 | } |
394 | 399 | ||
400 | /*----------------------------------------------------------------- | ||
401 | * Helper for block layer and dm core operations | ||
402 | *---------------------------------------------------------------*/ | ||
403 | void dm_dispatch_request(struct request *rq); | ||
404 | void dm_requeue_unmapped_request(struct request *rq); | ||
405 | void dm_kill_unmapped_request(struct request *rq, int error); | ||
406 | int dm_underlying_device_busy(struct request_queue *q); | ||
407 | |||
395 | #endif /* _LINUX_DEVICE_MAPPER_H */ | 408 | #endif /* _LINUX_DEVICE_MAPPER_H */ |