History

Merge tag 'dm-3.8-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm

Pull dm update from Alasdair G Kergon: "Miscellaneous device-mapper fixes, cleanups and performance improvements. Of particular note: - Disable broken WRITE SAME support in all targets except linear and striped. Use it when kcopyd is zeroing blocks. - Remove several mempools from targets by moving the data into the bio's new front_pad area(which dm calls 'per_bio_data'). - Fix a race in thin provisioning if discards are misused. - Prevent userspace from interfering with the ioctl parameters and use kmalloc for the data buffer if it's small instead of vmalloc. - Throttle some annoying error messages when I/O fails." * tag 'dm-3.8-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm: (36 commits) dm stripe: add WRITE SAME support dm: remove map_info dm snapshot: do not use map_context dm thin: dont use map_context dm raid1: dont use map_context dm flakey: dont use map_context dm raid1: rename read_record to bio_record dm: move target request nr to dm_target_io dm snapshot: use per_bio_data dm verity: use per_bio_data dm raid1: use per_bio_data dm: introduce per_bio_data dm kcopyd: add WRITE SAME support to dm_kcopyd_zero dm linear: add WRITE SAME support dm: add WRITE SAME support dm: prepare to support WRITE SAME dm ioctl: use kmalloc if possible dm ioctl: remove PF_MEMALLOC dm persistent data: improve improve space map block alloc failure message dm thin: use DMERR_LIMIT for errors ...

Linus Torvalds committed 13 years ago

Commit b49249d2 parents 10532b5 45e621d30 files · +522 −443Browse files

Showing the changes to include (2 of 30 files). Show all

Unified · Split

2 files
  1. include/linux/device-mapper.h +47 −8
  2. include/uapi/linux/dm-ioctl.h +2 −2
include/linux/device-mapper.h+47−8
@@ -23,7 +23,6 @@ typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t; · 22 unmodified lines
2323 union map_info {
2424 void *ptr;
2525 unsigned long long ll;
26− unsigned target_request_nr;
2726 };
2827
2928 /*
@@ -46,8 +45,7 @@ typedef void (*dm_dtr_fn) (struct dm_target *ti); · 16 unmodified lines
4645 * = 1: simple remap complete
4746 * = 2: The target wants to push back the io
4847 */
49−typedef int (*dm_map_fn) (struct dm_target *ti, struct bio *bio,
50− union map_info *map_context);
48+typedef int (*dm_map_fn) (struct dm_target *ti, struct bio *bio);
5149 typedef int (*dm_map_request_fn) (struct dm_target *ti, struct request *clone,
5250 union map_info *map_context);
5351
@@ -60,8 +58,7 @@ typedef int (*dm_map_request_fn) (struct dm_target *ti, struct request *clone, · 6 unmodified lines
6058 * 2 : The target wants to push back the io
6159 */
6260 typedef int (*dm_endio_fn) (struct dm_target *ti,
63− struct bio *bio, int error,
64− union map_info *map_context);
61+ struct bio *bio, int error);
6562 typedef int (*dm_request_endio_fn) (struct dm_target *ti,
6663 struct request *clone, int error,
6764 union map_info *map_context);
@@ -193,18 +190,30 @@ struct dm_target { · 125 unmodified lines
193190 * A number of zero-length barrier requests that will be submitted
194191 * to the target for the purpose of flushing cache.
195192 *
196− * The request number will be placed in union map_info->target_request_nr.
193+ * The request number can be accessed with dm_bio_get_target_request_nr.
197194 * It is a responsibility of the target driver to remap these requests
198195 * to the real underlying devices.
199196 */
200197 unsigned num_flush_requests;
201198
202199 /*
203− * The number of discard requests that will be submitted to the
204− * target. map_info->request_nr is used just like num_flush_requests.
200+ * The number of discard requests that will be submitted to the target.
201+ * The request number can be accessed with dm_bio_get_target_request_nr.
205202 */
206203 unsigned num_discard_requests;
207204
205+ /*
206+ * The number of WRITE SAME requests that will be submitted to the target.
207+ * The request number can be accessed with dm_bio_get_target_request_nr.
208+ */
209+ unsigned num_write_same_requests;
210+
211+ /*
212+ * The minimum number of extra bytes allocated in each bio for the
213+ * target to use. dm_per_bio_data returns the data location.
214+ */
215+ unsigned per_bio_data_size;
216+
208217 /* target specific data */
209218 void *private;
210219
@@ -241,6 +250,36 @@ struct dm_target_callbacks { · 30 unmodified lines
241250 int (*congested_fn) (struct dm_target_callbacks *, int);
242251 };
243252
253+/*
254+ * For bio-based dm.
255+ * One of these is allocated for each bio.
256+ * This structure shouldn't be touched directly by target drivers.
257+ * It is here so that we can inline dm_per_bio_data and
258+ * dm_bio_from_per_bio_data
259+ */
260+struct dm_target_io {
261+ struct dm_io *io;
262+ struct dm_target *ti;
263+ union map_info info;
264+ unsigned target_request_nr;
265+ struct bio clone;
266+};
267+
268+static inline void *dm_per_bio_data(struct bio *bio, size_t data_size)
269+{
270+ return (char *)bio - offsetof(struct dm_target_io, clone) - data_size;
271+}
272+
273+static inline struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size)
274+{
275+ return (struct bio *)((char *)data + data_size + offsetof(struct dm_target_io, clone));
276+}
277+
278+static inline unsigned dm_bio_get_target_request_nr(const struct bio *bio)
279+{
280+ return container_of(bio, struct dm_target_io, clone)->target_request_nr;
281+}
282+
244283 int dm_register_target(struct target_type *t);
245284 void dm_unregister_target(struct target_type *t);
246285
include/uapi/linux/dm-ioctl.h+2−2
@@ -268,8 +268,8 @@ enum { · 267 unmodified lines
268268
269269 #define DM_VERSION_MAJOR 4
270270 #define DM_VERSION_MINOR 23
271−#define DM_VERSION_PATCHLEVEL 0
272−#define DM_VERSION_EXTRA "-ioctl (2012-07-25)"
271+#define DM_VERSION_PATCHLEVEL 1
272+#define DM_VERSION_EXTRA "-ioctl (2012-12-18)"
273273
274274 /* Status bits */
275275 #define DM_READONLY_FLAG (1 << 0) /* In/Out */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t