diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-12 19:36:31 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-12 19:36:31 -0500 |
| commit | 802ea9d8645d33d24b7b4cd4537c14f3e698bde0 (patch) | |
| tree | 9a51a21025fa9a38263aa44883ea2b6af823ea05 | |
| parent | 8494bcf5b7c4b2416687e233dd34d4c6b6fe5653 (diff) | |
| parent | a4afe76b2b922e6197944d7be0be7a18b53175ae (diff) | |
Merge tag 'dm-3.20-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper changes from Mike Snitzer:
- The most significant change this cycle is request-based DM now
supports stacking ontop of blk-mq devices. This blk-mq support
changes the model request-based DM uses for cloning a request to
relying on calling blk_get_request() directly from the underlying
blk-mq device.
An early consumer of this code is Intel's emerging NVMe hardware;
thanks to Keith Busch for working on, and pushing for, these changes.
- A few other small fixes and cleanups across other DM targets.
* tag 'dm-3.20-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm: inherit QUEUE_FLAG_SG_GAPS flags from underlying queues
dm snapshot: remove unnecessary NULL checks before vfree() calls
dm mpath: simplify failure path of dm_multipath_init()
dm thin metadata: remove unused dm_pool_get_data_block_size()
dm ioctl: fix stale comment above dm_get_inactive_table()
dm crypt: update url in CONFIG_DM_CRYPT help text
dm bufio: fix time comparison to use time_after_eq()
dm: use time_in_range() and time_after()
dm raid: fix a couple integer overflows
dm table: train hybrid target type detection to select blk-mq if appropriate
dm: allocate requests in target when stacking on blk-mq devices
dm: prepare for allocating blk-mq clone requests in target
dm: submit stacked requests in irq enabled context
dm: split request structure out from dm_rq_target_io structure
dm: remove exports for request-based interfaces without external callers
| -rw-r--r-- | drivers/md/Kconfig | 5 | ||||
| -rw-r--r-- | drivers/md/dm-bufio.c | 3 | ||||
| -rw-r--r-- | drivers/md/dm-cache-target.c | 5 | ||||
| -rw-r--r-- | drivers/md/dm-ioctl.c | 4 | ||||
| -rw-r--r-- | drivers/md/dm-log-userspace-base.c | 5 | ||||
| -rw-r--r-- | drivers/md/dm-mpath.c | 87 | ||||
| -rw-r--r-- | drivers/md/dm-raid.c | 16 | ||||
| -rw-r--r-- | drivers/md/dm-snap-persistent.c | 14 | ||||
| -rw-r--r-- | drivers/md/dm-table.c | 72 | ||||
| -rw-r--r-- | drivers/md/dm-target.c | 15 | ||||
| -rw-r--r-- | drivers/md/dm-thin-metadata.c | 9 | ||||
| -rw-r--r-- | drivers/md/dm-thin-metadata.h | 2 | ||||
| -rw-r--r-- | drivers/md/dm-thin.c | 5 | ||||
| -rw-r--r-- | drivers/md/dm.c | 347 | ||||
| -rw-r--r-- | drivers/md/dm.h | 11 | ||||
| -rw-r--r-- | include/linux/device-mapper.h | 10 | ||||
| -rw-r--r-- | include/uapi/linux/dm-ioctl.h | 4 |
17 files changed, 416 insertions, 198 deletions
diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig index c355a226a024..c39644478aa4 100644 --- a/drivers/md/Kconfig +++ b/drivers/md/Kconfig | |||
| @@ -231,9 +231,8 @@ config DM_CRYPT | |||
| 231 | transparently encrypts the data on it. You'll need to activate | 231 | transparently encrypts the data on it. You'll need to activate |
| 232 | the ciphers you're going to use in the cryptoapi configuration. | 232 | the ciphers you're going to use in the cryptoapi configuration. |
| 233 | 233 | ||
| 234 | Information on how to use dm-crypt can be found on | 234 | For further information on dm-crypt and userspace tools see: |
| 235 | 235 | <http://code.google.com/p/cryptsetup/wiki/DMCrypt> | |
| 236 | <http://www.saout.de/misc/dm-crypt/> | ||
| 237 | 236 | ||
| 238 | To compile this code as a module, choose M here: the module will | 237 | To compile this code as a module, choose M here: the module will |
| 239 | be called dm-crypt. | 238 | be called dm-crypt. |
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index c33b49792b87..86dbbc737402 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <linux/device-mapper.h> | 11 | #include <linux/device-mapper.h> |
| 12 | #include <linux/dm-io.h> | 12 | #include <linux/dm-io.h> |
| 13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
| 14 | #include <linux/jiffies.h> | ||
| 14 | #include <linux/vmalloc.h> | 15 | #include <linux/vmalloc.h> |
| 15 | #include <linux/shrinker.h> | 16 | #include <linux/shrinker.h> |
| 16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| @@ -1739,7 +1740,7 @@ static unsigned get_max_age_hz(void) | |||
| 1739 | 1740 | ||
| 1740 | static bool older_than(struct dm_buffer *b, unsigned long age_hz) | 1741 | static bool older_than(struct dm_buffer *b, unsigned long age_hz) |
| 1741 | { | 1742 | { |
| 1742 | return (jiffies - b->last_accessed) >= age_hz; | 1743 | return time_after_eq(jiffies, b->last_accessed + age_hz); |
| 1743 | } | 1744 | } |
| 1744 | 1745 | ||
| 1745 | static void __evict_old_buffers(struct dm_bufio_client *c, unsigned long age_hz) | 1746 | static void __evict_old_buffers(struct dm_bufio_client *c, unsigned long age_hz) |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index e1650539cc2f..7755af351867 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | #include <linux/dm-io.h> | 12 | #include <linux/dm-io.h> |
| 13 | #include <linux/dm-kcopyd.h> | 13 | #include <linux/dm-kcopyd.h> |
| 14 | #include <linux/jiffies.h> | ||
| 14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
| 15 | #include <linux/mempool.h> | 16 | #include <linux/mempool.h> |
| 16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| @@ -1562,8 +1563,8 @@ static void process_bio(struct cache *cache, struct prealloc *structs, | |||
| 1562 | 1563 | ||
| 1563 | static int need_commit_due_to_time(struct cache *cache) | 1564 | static int need_commit_due_to_time(struct cache *cache) |
| 1564 | { | 1565 | { |
| 1565 | return jiffies < cache->last_commit_jiffies || | 1566 | return !time_in_range(jiffies, cache->last_commit_jiffies, |
| 1566 | jiffies > cache->last_commit_jiffies + COMMIT_PERIOD; | 1567 | cache->last_commit_jiffies + COMMIT_PERIOD); |
| 1567 | } | 1568 | } |
| 1568 | 1569 | ||
| 1569 | static int commit_if_needed(struct cache *cache) | 1570 | static int commit_if_needed(struct cache *cache) |
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 73f791bb9ea4..c8a18e4ee9dc 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c | |||
| @@ -639,8 +639,8 @@ static int check_name(const char *name) | |||
| 639 | 639 | ||
| 640 | /* | 640 | /* |
| 641 | * On successful return, the caller must not attempt to acquire | 641 | * On successful return, the caller must not attempt to acquire |
| 642 | * _hash_lock without first calling dm_table_put, because dm_table_destroy | 642 | * _hash_lock without first calling dm_put_live_table, because dm_table_destroy |
| 643 | * waits for this dm_table_put and could be called under this lock. | 643 | * waits for this dm_put_live_table and could be called under this lock. |
| 644 | */ | 644 | */ |
| 645 | static struct dm_table *dm_get_inactive_table(struct mapped_device *md, int *srcu_idx) | 645 | static struct dm_table *dm_get_inactive_table(struct mapped_device *md, int *srcu_idx) |
| 646 | { | 646 | { |
diff --git a/drivers/md/dm-log-userspace-base.c b/drivers/md/dm-log-userspace-base.c index b953db6cc229..03177ca0b009 100644 --- a/drivers/md/dm-log-userspace-base.c +++ b/drivers/md/dm-log-userspace-base.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <linux/bio.h> | 7 | #include <linux/bio.h> |
| 8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
| 9 | #include <linux/jiffies.h> | ||
| 9 | #include <linux/dm-dirty-log.h> | 10 | #include <linux/dm-dirty-log.h> |
| 10 | #include <linux/device-mapper.h> | 11 | #include <linux/device-mapper.h> |
| 11 | #include <linux/dm-log-userspace.h> | 12 | #include <linux/dm-log-userspace.h> |
| @@ -829,7 +830,7 @@ static int userspace_is_remote_recovering(struct dm_dirty_log *log, | |||
| 829 | int r; | 830 | int r; |
| 830 | uint64_t region64 = region; | 831 | uint64_t region64 = region; |
| 831 | struct log_c *lc = log->context; | 832 | struct log_c *lc = log->context; |
| 832 | static unsigned long long limit; | 833 | static unsigned long limit; |
| 833 | struct { | 834 | struct { |
| 834 | int64_t is_recovering; | 835 | int64_t is_recovering; |
| 835 | uint64_t in_sync_hint; | 836 | uint64_t in_sync_hint; |
| @@ -845,7 +846,7 @@ static int userspace_is_remote_recovering(struct dm_dirty_log *log, | |||
| 845 | */ | 846 | */ |
| 846 | if (region < lc->in_sync_hint) | 847 | if (region < lc->in_sync_hint) |
| 847 | return 0; | 848 | return 0; |
| 848 | else if (jiffies < limit) | 849 | else if (time_after(limit, jiffies)) |
| 849 | return 1; | 850 | return 1; |
| 850 | 851 | ||
| 851 | limit = jiffies + (HZ / 4); | 852 | limit = jiffies + (HZ / 4); |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 7b6b0f0f831a..d376dc87716e 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include "dm-path-selector.h" | 11 | #include "dm-path-selector.h" |
| 12 | #include "dm-uevent.h" | 12 | #include "dm-uevent.h" |
| 13 | 13 | ||
| 14 | #include <linux/blkdev.h> | ||
| 14 | #include <linux/ctype.h> | 15 | #include <linux/ctype.h> |
| 15 | #include <linux/init.h> | 16 | #include <linux/init.h> |
| 16 | #include <linux/mempool.h> | 17 | #include <linux/mempool.h> |
| @@ -378,18 +379,18 @@ static int __must_push_back(struct multipath *m) | |||
| 378 | /* | 379 | /* |
| 379 | * Map cloned requests | 380 | * Map cloned requests |
| 380 | */ | 381 | */ |
| 381 | static int multipath_map(struct dm_target *ti, struct request *clone, | 382 | static int __multipath_map(struct dm_target *ti, struct request *clone, |
| 382 | union map_info *map_context) | 383 | union map_info *map_context, |
| 384 | struct request *rq, struct request **__clone) | ||
| 383 | { | 385 | { |
| 384 | struct multipath *m = (struct multipath *) ti->private; | 386 | struct multipath *m = (struct multipath *) ti->private; |
| 385 | int r = DM_MAPIO_REQUEUE; | 387 | int r = DM_MAPIO_REQUEUE; |
| 386 | size_t nr_bytes = blk_rq_bytes(clone); | 388 | size_t nr_bytes = clone ? blk_rq_bytes(clone) : blk_rq_bytes(rq); |
| 387 | unsigned long flags; | ||
| 388 | struct pgpath *pgpath; | 389 | struct pgpath *pgpath; |
| 389 | struct block_device *bdev; | 390 | struct block_device *bdev; |
| 390 | struct dm_mpath_io *mpio; | 391 | struct dm_mpath_io *mpio; |
| 391 | 392 | ||
| 392 | spin_lock_irqsave(&m->lock, flags); | 393 | spin_lock_irq(&m->lock); |
| 393 | 394 | ||
| 394 | /* Do we need to select a new pgpath? */ | 395 | /* Do we need to select a new pgpath? */ |
| 395 | if (!m->current_pgpath || | 396 | if (!m->current_pgpath || |
| @@ -411,25 +412,61 @@ static int multipath_map(struct dm_target *ti, struct request *clone, | |||
| 411 | /* ENOMEM, requeue */ | 412 | /* ENOMEM, requeue */ |
| 412 | goto out_unlock; | 413 | goto out_unlock; |
| 413 | 414 | ||
