diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-30 14:19:05 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-30 14:19:05 -0500 |
commit | f568849edac8611d603e00bd6cbbcfea09395ae6 (patch) | |
tree | b9472d640fe5d87426d38c9d81d946cf197ad3fb /drivers/md/dm-cache-target.c | |
parent | d9894c228b11273e720bb63ba120d1d326fe9d94 (diff) | |
parent | 675675ada486dde5bf9aa51665e90706bff11a35 (diff) |
Merge branch 'for-3.14/core' of git://git.kernel.dk/linux-block
Pull core block IO changes from Jens Axboe:
"The major piece in here is the immutable bio_ve series from Kent, the
rest is fairly minor. It was supposed to go in last round, but
various issues pushed it to this release instead. The pull request
contains:
- Various smaller blk-mq fixes from different folks. Nothing major
here, just minor fixes and cleanups.
- Fix for a memory leak in the error path in the block ioctl code
from Christian Engelmayer.
- Header export fix from CaiZhiyong.
- Finally the immutable biovec changes from Kent Overstreet. This
enables some nice future work on making arbitrarily sized bios
possible, and splitting more efficient. Related fixes to immutable
bio_vecs:
- dm-cache immutable fixup from Mike Snitzer.
- btrfs immutable fixup from Muthu Kumar.
- bio-integrity fix from Nic Bellinger, which is also going to stable"
* 'for-3.14/core' of git://git.kernel.dk/linux-block: (44 commits)
xtensa: fixup simdisk driver to work with immutable bio_vecs
block/blk-mq-cpu.c: use hotcpu_notifier()
blk-mq: for_each_* macro correctness
block: Fix memory leak in rw_copy_check_uvector() handling
bio-integrity: Fix bio_integrity_verify segment start bug
block: remove unrelated header files and export symbol
blk-mq: uses page->list incorrectly
blk-mq: use __smp_call_function_single directly
btrfs: fix missing increment of bi_remaining
Revert "block: Warn and free bio if bi_end_io is not set"
block: Warn and free bio if bi_end_io is not set
blk-mq: fix initializing request's start time
block: blk-mq: don't export blk_mq_free_queue()
block: blk-mq: make blk_sync_queue support mq
block: blk-mq: support draining mq queue
dm cache: increment bi_remaining when bi_end_io is restored
block: fixup for generic bio chaining
block: Really silence spurious compiler warnings
block: Silence spurious compiler warnings
block: Kill bio_pair_split()
...
Diffstat (limited to 'drivers/md/dm-cache-target.c')
-rw-r--r-- | drivers/md/dm-cache-target.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 09334c275c79..ffd472e015ca 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -85,6 +85,12 @@ static void dm_unhook_bio(struct dm_hook_info *h, struct bio *bio) | |||
85 | { | 85 | { |
86 | bio->bi_end_io = h->bi_end_io; | 86 | bio->bi_end_io = h->bi_end_io; |
87 | bio->bi_private = h->bi_private; | 87 | bio->bi_private = h->bi_private; |
88 | |||
89 | /* | ||
90 | * Must bump bi_remaining to allow bio to complete with | ||
91 | * restored bi_end_io. | ||
92 | */ | ||
93 | atomic_inc(&bio->bi_remaining); | ||
88 | } | 94 | } |
89 | 95 | ||
90 | /*----------------------------------------------------------------*/ | 96 | /*----------------------------------------------------------------*/ |
@@ -664,15 +670,17 @@ static void remap_to_origin(struct cache *cache, struct bio *bio) | |||
664 | static void remap_to_cache(struct cache *cache, struct bio *bio, | 670 | static void remap_to_cache(struct cache *cache, struct bio *bio, |
665 | dm_cblock_t cblock) | 671 | dm_cblock_t cblock) |
666 | { | 672 | { |
667 | sector_t bi_sector = bio->bi_sector; | 673 | sector_t bi_sector = bio->bi_iter.bi_sector; |
668 | 674 | ||
669 | bio->bi_bdev = cache->cache_dev->bdev; | 675 | bio->bi_bdev = cache->cache_dev->bdev; |
670 | if (!block_size_is_power_of_two(cache)) | 676 | if (!block_size_is_power_of_two(cache)) |
671 | bio->bi_sector = (from_cblock(cblock) * cache->sectors_per_block) + | 677 | bio->bi_iter.bi_sector = |
672 | sector_div(bi_sector, cache->sectors_per_block); | 678 | (from_cblock(cblock) * cache->sectors_per_block) + |
679 | sector_div(bi_sector, cache->sectors_per_block); | ||
673 | else | 680 | else |
674 | bio->bi_sector = (from_cblock(cblock) << cache->sectors_per_block_shift) | | 681 | bio->bi_iter.bi_sector = |
675 | (bi_sector & (cache->sectors_per_block - 1)); | 682 | (from_cblock(cblock) << cache->sectors_per_block_shift) | |
683 | (bi_sector & (cache->sectors_per_block - 1)); | ||
676 | } | 684 | } |
677 | 685 | ||
678 | static void check_if_tick_bio_needed(struct cache *cache, struct bio *bio) | 686 | static void check_if_tick_bio_needed(struct cache *cache, struct bio *bio) |
@@ -712,7 +720,7 @@ static void remap_to_cache_dirty(struct cache *cache, struct bio *bio, | |||
712 | 720 | ||
713 | static dm_oblock_t get_bio_block(struct cache *cache, struct bio *bio) | 721 | static dm_oblock_t get_bio_block(struct cache *cache, struct bio *bio) |
714 | { | 722 | { |
715 | sector_t block_nr = bio->bi_sector; | 723 | sector_t block_nr = bio->bi_iter.bi_sector; |
716 | 724 | ||
717 | if (!block_size_is_power_of_two(cache)) | 725 | if (!block_size_is_power_of_two(cache)) |
718 | (void) sector_div(block_nr, cache->sectors_per_block); | 726 | (void) sector_div(block_nr, cache->sectors_per_block); |
@@ -1027,7 +1035,7 @@ static void issue_overwrite(struct dm_cache_migration *mg, struct bio *bio) | |||
1027 | static bool bio_writes_complete_block(struct cache *cache, struct bio *bio) | 1035 | static bool bio_writes_complete_block(struct cache *cache, struct bio *bio) |
1028 | { | 1036 | { |
1029 | return (bio_data_dir(bio) == WRITE) && | 1037 | return (bio_data_dir(bio) == WRITE) && |
1030 | (bio->bi_size == (cache->sectors_per_block << SECTOR_SHIFT)); | 1038 | (bio->bi_iter.bi_size == (cache->sectors_per_block << SECTOR_SHIFT)); |
1031 | } | 1039 | } |
1032 | 1040 | ||
1033 | static void avoid_copy(struct dm_cache_migration *mg) | 1041 | static void avoid_copy(struct dm_cache_migration *mg) |
@@ -1252,7 +1260,7 @@ static void process_flush_bio(struct cache *cache, struct bio *bio) | |||
1252 | size_t pb_data_size = get_per_bio_data_size(cache); | 1260 | size_t pb_data_size = get_per_bio_data_size(cache); |
1253 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | 1261 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); |
1254 | 1262 | ||
1255 | BUG_ON(bio->bi_size); | 1263 | BUG_ON(bio->bi_iter.bi_size); |
1256 | if (!pb->req_nr) | 1264 | if (!pb->req_nr) |
1257 | remap_to_origin(cache, bio); | 1265 | remap_to_origin(cache, bio); |
1258 | else | 1266 | else |
@@ -1275,9 +1283,9 @@ static void process_flush_bio(struct cache *cache, struct bio *bio) | |||
1275 | */ | 1283 | */ |
1276 | static void process_discard_bio(struct cache *cache, struct bio *bio) | 1284 | static void process_discard_bio(struct cache *cache, struct bio *bio) |
1277 | { | 1285 | { |
1278 | dm_block_t start_block = dm_sector_div_up(bio->bi_sector, | 1286 | dm_block_t start_block = dm_sector_div_up(bio->bi_iter.bi_sector, |
1279 | cache->discard_block_size); | 1287 | cache->discard_block_size); |
1280 | dm_block_t end_block = bio->bi_sector + bio_sectors(bio); | 1288 | dm_block_t end_block = bio_end_sector(bio); |
1281 | dm_block_t b; | 1289 | dm_block_t b; |
1282 | 1290 | ||
1283 | end_block = block_div(end_block, cache->discard_block_size); | 1291 | end_block = block_div(end_block, cache->discard_block_size); |