diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-14 11:17:56 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-14 11:17:56 -0400 |
| commit | ba368991f63f020afe4ee9d5b647c5397cf3c7f2 (patch) | |
| tree | 8d391c8921acab5bd70cd04edaeb3de4c38ed426 | |
| parent | a8e4def604a9affa04fdd4efa0692da1385ffa3f (diff) | |
| parent | 200612ec33e555a356eebc717630b866ae2b694f (diff) | |
Merge tag 'dm-3.17-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper changes from Mike Snitzer:
- Allow the thin target to paired with any size external origin; also
allow thin snapshots to be larger than the external origin.
- Add support for quickly loading a repetitive pattern into the
dm-switch target.
- Use per-bio data in the dm-crypt target instead of always using a
mempool for each allocation. Required switching to kmalloc alignment
for the bio slab.
- Fix DM core to properly stack the QUEUE_FLAG_NO_SG_MERGE flag
- Fix the dm-cache and dm-thin targets' export of the minimum_io_size
to match the data block size -- this fixes an issue where mkfs.xfs
would improperly infer raid striping was in place on the underlying
storage.
- Small cleanups in dm-io, dm-mpath and dm-cache
* tag 'dm-3.17-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
dm table: propagate QUEUE_FLAG_NO_SG_MERGE
dm switch: efficiently support repetitive patterns
dm switch: factor out switch_region_table_read
dm cache: set minimum_io_size to cache's data block size
dm thin: set minimum_io_size to pool's data block size
dm crypt: use per-bio data
block: use kmalloc alignment for bio slab
dm table: make dm_table_supports_discards static
dm cache metadata: use dm-space-map-metadata.h defined size limits
dm cache: fail migrations in the do_worker error path
dm cache: simplify deferred set reference count increments
dm thin: relax external origin size constraints
dm thin: switch to an atomic_t for tracking pending new block preparations
dm mpath: eliminate pg_ready() wrapper
dm io: simplify dec_count and sync_io
| -rw-r--r-- | Documentation/device-mapper/switch.txt | 12 | ||||
| -rw-r--r-- | block/bio.c | 3 | ||||
| -rw-r--r-- | drivers/md/dm-cache-metadata.c | 4 | ||||
| -rw-r--r-- | drivers/md/dm-cache-metadata.h | 8 | ||||
| -rw-r--r-- | drivers/md/dm-cache-target.c | 128 | ||||
| -rw-r--r-- | drivers/md/dm-crypt.c | 41 | ||||
| -rw-r--r-- | drivers/md/dm-io.c | 77 | ||||
| -rw-r--r-- | drivers/md/dm-mpath.c | 6 | ||||
| -rw-r--r-- | drivers/md/dm-switch.c | 67 | ||||
| -rw-r--r-- | drivers/md/dm-table.c | 86 | ||||
| -rw-r--r-- | drivers/md/dm-thin.c | 181 | ||||
| -rw-r--r-- | drivers/md/dm.h | 1 |
12 files changed, 408 insertions, 206 deletions
diff --git a/Documentation/device-mapper/switch.txt b/Documentation/device-mapper/switch.txt index 2fa749387be8..8897d0494838 100644 --- a/Documentation/device-mapper/switch.txt +++ b/Documentation/device-mapper/switch.txt | |||
| @@ -106,6 +106,11 @@ which paths. | |||
| 106 | The path number in the range 0 ... (<num_paths> - 1). | 106 | The path number in the range 0 ... (<num_paths> - 1). |
| 107 | Expressed in hexadecimal (WITHOUT any prefix like 0x). | 107 | Expressed in hexadecimal (WITHOUT any prefix like 0x). |
| 108 | 108 | ||
| 109 | R<n>,<m> | ||
| 110 | This parameter allows repetitive patterns to be loaded quickly. <n> and <m> | ||
| 111 | are hexadecimal numbers. The last <n> mappings are repeated in the next <m> | ||
| 112 | slots. | ||
| 113 | |||
| 109 | Status | 114 | Status |
| 110 | ====== | 115 | ====== |
| 111 | 116 | ||
| @@ -124,3 +129,10 @@ Create a switch device with 64kB region size: | |||
| 124 | Set mappings for the first 7 entries to point to devices switch0, switch1, | 129 | Set mappings for the first 7 entries to point to devices switch0, switch1, |
| 125 | switch2, switch0, switch1, switch2, switch1: | 130 | switch2, switch0, switch1, switch2, switch1: |
| 126 | dmsetup message switch 0 set_region_mappings 0:0 :1 :2 :0 :1 :2 :1 | 131 | dmsetup message switch 0 set_region_mappings 0:0 :1 :2 :0 :1 :2 :1 |
| 132 | |||
| 133 | Set repetitive mapping. This command: | ||
| 134 | dmsetup message switch 0 set_region_mappings 1000:1 :2 R2,10 | ||
| 135 | is equivalent to: | ||
| 136 | dmsetup message switch 0 set_region_mappings 1000:1 :2 :1 :2 :1 :2 :1 :2 \ | ||
| 137 | :1 :2 :1 :2 :1 :2 :1 :2 :1 :2 | ||
| 138 | |||
diff --git a/block/bio.c b/block/bio.c index 0ec61c9e536c..3e6331d25d90 100644 --- a/block/bio.c +++ b/block/bio.c | |||
| @@ -112,7 +112,8 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) | |||
| 112 | bslab = &bio_slabs[entry]; | 112 | bslab = &bio_slabs[entry]; |
| 113 | 113 | ||
| 114 | snprintf(bslab->name, sizeof(bslab->name), "bio-%d", entry); | 114 | snprintf(bslab->name, sizeof(bslab->name), "bio-%d", entry); |
| 115 | slab = kmem_cache_create(bslab->name, sz, 0, SLAB_HWCACHE_ALIGN, NULL); | 115 | slab = kmem_cache_create(bslab->name, sz, ARCH_KMALLOC_MINALIGN, |
| 116 | SLAB_HWCACHE_ALIGN, NULL); | ||
| 116 | if (!slab) | 117 | if (!slab) |
| 117 | goto out_unlock; | 118 | goto out_unlock; |
| 118 | 119 | ||
diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c index d2899e7eb3aa..06709257adde 100644 --- a/drivers/md/dm-cache-metadata.c +++ b/drivers/md/dm-cache-metadata.c | |||
| @@ -330,7 +330,7 @@ static int __write_initial_superblock(struct dm_cache_metadata *cmd) | |||
| 330 | disk_super->discard_root = cpu_to_le64(cmd->discard_root); | 330 | disk_super->discard_root = cpu_to_le64(cmd->discard_root); |
| 331 | disk_super->discard_block_size = cpu_to_le64(cmd->discard_block_size); | 331 | disk_super->discard_block_size = cpu_to_le64(cmd->discard_block_size); |
| 332 | disk_super->discard_nr_blocks = cpu_to_le64(from_oblock(cmd->discard_nr_blocks)); | 332 | disk_super->discard_nr_blocks = cpu_to_le64(from_oblock(cmd->discard_nr_blocks)); |
| 333 | disk_super->metadata_block_size = cpu_to_le32(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); | 333 | disk_super->metadata_block_size = cpu_to_le32(DM_CACHE_METADATA_BLOCK_SIZE); |
| 334 | disk_super->data_block_size = cpu_to_le32(cmd->data_block_size); | 334 | disk_super->data_block_size = cpu_to_le32(cmd->data_block_size); |
| 335 | disk_super->cache_blocks = cpu_to_le32(0); | 335 | disk_super->cache_blocks = cpu_to_le32(0); |
| 336 | 336 | ||
| @@ -478,7 +478,7 @@ static int __create_persistent_data_objects(struct dm_cache_metadata *cmd, | |||
| 478 | bool may_format_device) | 478 | bool may_format_device) |
| 479 | { | 479 | { |
| 480 | int r; | 480 | int r; |
| 481 | cmd->bm = dm_block_manager_create(cmd->bdev, DM_CACHE_METADATA_BLOCK_SIZE, | 481 | cmd->bm = dm_block_manager_create(cmd->bdev, DM_CACHE_METADATA_BLOCK_SIZE << SECTOR_SHIFT, |
| 482 | CACHE_METADATA_CACHE_SIZE, | 482 | CACHE_METADATA_CACHE_SIZE, |
| 483 | CACHE_MAX_CONCURRENT_LOCKS); | 483 | CACHE_MAX_CONCURRENT_LOCKS); |
| 484 | if (IS_ERR(cmd->bm)) { | 484 | if (IS_ERR(cmd->bm)) { |
diff --git a/drivers/md/dm-cache-metadata.h b/drivers/md/dm-cache-metadata.h index cd70a78623a3..7383c90ccdb8 100644 --- a/drivers/md/dm-cache-metadata.h +++ b/drivers/md/dm-cache-metadata.h | |||
| @@ -9,19 +9,17 @@ | |||
| 9 | 9 | ||
| 10 | #include "dm-cache-block-types.h" | 10 | #include "dm-cache-block-types.h" |
| 11 | #include "dm-cache-policy-internal.h" | 11 | #include "dm-cache-policy-internal.h" |
| 12 | #include "persistent-data/dm-space-map-metadata.h" | ||
| 12 | 13 | ||
| 13 | /*----------------------------------------------------------------*/ | 14 | /*----------------------------------------------------------------*/ |
| 14 | 15 | ||
| 15 | #define DM_CACHE_METADATA_BLOCK_SIZE 4096 | 16 | #define DM_CACHE_METADATA_BLOCK_SIZE DM_SM_METADATA_BLOCK_SIZE |
| 16 | 17 | ||
| 17 | /* FIXME: remove this restriction */ | 18 | /* FIXME: remove this restriction */ |
| 18 | /* | 19 | /* |
| 19 | * The metadata device is currently limited in size. | 20 | * The metadata device is currently limited in size. |
| 20 | * | ||
| 21 | * We have one block of index, which can hold 255 index entries. Each | ||
| 22 | * index entry contains allocation info about 16k metadata blocks. | ||
| 23 | */ | 21 | */ |
| 24 | #define DM_CACHE_METADATA_MAX_SECTORS (255 * (1 << 14) * (DM_CACHE_METADATA_BLOCK_SIZE / (1 << SECTOR_SHIFT))) | 22 | #define DM_CACHE_METADATA_MAX_SECTORS DM_SM_METADATA_MAX_SECTORS |
| 25 | 23 | ||
| 26 | /* | 24 | /* |
| 27 | * A metadata device larger than 16GB triggers a warning. | 25 | * A metadata device larger than 16GB triggers a warning. |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 2c63326638b6..1af40ee209e2 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
| @@ -718,6 +718,22 @@ static int bio_triggers_commit(struct cache *cache, struct bio *bio) | |||
| 718 | return bio->bi_rw & (REQ_FLUSH | REQ_FUA); | 718 | return bio->bi_rw & (REQ_FLUSH | REQ_FUA); |
| 719 | } | 719 | } |
| 720 | 720 | ||
| 721 | /* | ||
| 722 | * You must increment the deferred set whilst the prison cell is held. To | ||
| 723 | * encourage this, we ask for 'cell' to be passed in. | ||
| 724 | */ | ||
| 725 | static void inc_ds(struct cache *cache, struct bio *bio, | ||
| 726 | struct dm_bio_prison_cell *cell) | ||
| 727 | { | ||
| 728 | size_t pb_data_size = get_per_bio_data_size(cache); | ||
| 729 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | ||
| 730 | |||
| 731 | BUG_ON(!cell); | ||
| 732 | BUG_ON(pb->all_io_entry); | ||
| 733 | |||
| 734 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); | ||
| 735 | } | ||
| 736 | |||
| 721 | static void issue(struct cache *cache, struct bio *bio) | 737 | static void issue(struct cache *cache, struct bio *bio) |
| 722 | { | 738 | { |
| 723 | unsigned long flags; | 739 | unsigned long flags; |
| @@ -737,6 +753,12 @@ static void issue(struct cache *cache, struct bio *bio) | |||
| 737 | spin_unlock_irqrestore(&cache->lock, flags); | 753 | spin_unlock_irqrestore(&cache->lock, flags); |
| 738 | } | 754 | } |
| 739 | 755 | ||
| 756 | static void inc_and_issue(struct cache *cache, struct bio *bio, struct dm_bio_prison_cell *cell) | ||
| 757 | { | ||
| 758 | inc_ds(cache, bio, cell); | ||
| 759 | issue(cache, bio); | ||
| 760 | } | ||
| 761 | |||
| 740 | static void defer_writethrough_bio(struct cache *cache, struct bio *bio) | 762 | static void defer_writethrough_bio(struct cache *cache, struct bio *bio) |
| 741 | { | 763 | { |
| 742 | unsigned long flags; | 764 | unsigned long flags; |
| @@ -1015,6 +1037,11 @@ static void issue_overwrite(struct dm_cache_migration *mg, struct bio *bio) | |||
| 1015 | 1037 | ||
| 1016 | dm_hook_bio(&pb->hook_info, bio, overwrite_endio, mg); | 1038 | dm_hook_bio(&pb->hook_info, bio, overwrite_endio, mg); |
| 1017 | remap_to_cache_dirty(mg->cache, bio, mg->new_oblock, mg->cblock); | 1039 | remap_to_cache_dirty(mg->cache, bio, mg->new_oblock, mg->cblock); |
| 1040 | |||
| 1041 | /* | ||
| 1042 | * No need to inc_ds() here, since the cell will be held for the | ||
| 1043 | * duration of the io. | ||
| 1044 | */ | ||
| 1018 | generic_make_request(bio); | 1045 | generic_make_request(bio); |
| 1019 | } | 1046 | } |
| 1020 | 1047 | ||
| @@ -1115,8 +1142,7 @@ static void check_for_quiesced_migrations(struct cache *cache, | |||
| 1115 | return; | 1142 | return; |
| 1116 | 1143 | ||
| 1117 | INIT_LIST_HEAD(&work); | 1144 | INIT_LIST_HEAD(&work); |
| 1118 | if (pb->all_io_entry) | 1145 | dm_deferred_entry_dec(pb->all_io_entry, &work); |
| 1119 | dm_deferred_entry_dec(pb->all_io_entry, &work); | ||
| 1120 | 1146 | ||
| 1121 | if (!list_empty(&work)) | 1147 | if (!list_empty(&work)) |
| 1122 | queue_quiesced_migrations(cache, &work); | 1148 | queue_quiesced_migrations(cache, &work); |
| @@ -1252,6 +1278,11 @@ static void process_flush_bio(struct cache *cache, struct bio *bio) | |||
| 1252 | else | 1278 | else |
| 1253 | remap_to_cache(cache, bio, 0); | 1279 | remap_to_cache(cache, bio, 0); |
| 1254 | 1280 | ||
| 1281 | /* | ||
| 1282 | * REQ_FLUSH is not directed at any particular block so we don't | ||
| 1283 | * need to inc_ds(). REQ_FUA's are split into a write + REQ_FLUSH | ||
| 1284 | * by dm-core. | ||
| 1285 | */ | ||
| 1255 | issue(cache, bio); | ||
