aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-cache-target.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-cache-target.c')
-rw-r--r--drivers/md/dm-cache-target.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 354bbc1b9a3c..074b9c8e4cf0 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -2465,20 +2465,18 @@ static int cache_map(struct dm_target *ti, struct bio *bio)
2465 bool discarded_block; 2465 bool discarded_block;
2466 struct dm_bio_prison_cell *cell; 2466 struct dm_bio_prison_cell *cell;
2467 struct policy_result lookup_result; 2467 struct policy_result lookup_result;
2468 struct per_bio_data *pb; 2468 struct per_bio_data *pb = init_per_bio_data(bio, pb_data_size);
2469 2469
2470 if (from_oblock(block) > from_oblock(cache->origin_blocks)) { 2470 if (unlikely(from_oblock(block) >= from_oblock(cache->origin_blocks))) {
2471 /* 2471 /*
2472 * This can only occur if the io goes to a partial block at 2472 * This can only occur if the io goes to a partial block at
2473 * the end of the origin device. We don't cache these. 2473 * the end of the origin device. We don't cache these.
2474 * Just remap to the origin and carry on. 2474 * Just remap to the origin and carry on.
2475 */ 2475 */
2476 remap_to_origin_clear_discard(cache, bio, block); 2476 remap_to_origin(cache, bio);
2477 return DM_MAPIO_REMAPPED; 2477 return DM_MAPIO_REMAPPED;
2478 } 2478 }
2479 2479
2480 pb = init_per_bio_data(bio, pb_data_size);
2481
2482 if (bio->bi_rw & (REQ_FLUSH | REQ_FUA | REQ_DISCARD)) { 2480 if (bio->bi_rw & (REQ_FLUSH | REQ_FUA | REQ_DISCARD)) {
2483 defer_bio(cache, bio); 2481 defer_bio(cache, bio);
2484 return DM_MAPIO_SUBMITTED; 2482 return DM_MAPIO_SUBMITTED;