[PATCH 11/15] dm stripe: support copy
From: Mikulas Patocka
Date: Tue Jul 15 2014 - 15:42:01 EST
Support the copy operation for the stripe target.
In stripe_merge, we verify that the underlying device supports copy. If it
doesn't, we can fail fast without any bio being contructed.
Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>
---
drivers/md/dm-stripe.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
Index: linux-3.16-rc4/drivers/md/dm-stripe.c
===================================================================
--- linux-3.16-rc4.orig/drivers/md/dm-stripe.c 2014-07-11 22:20:25.000000000 +0200
+++ linux-3.16-rc4/drivers/md/dm-stripe.c 2014-07-11 22:23:54.000000000 +0200
@@ -165,6 +165,7 @@ static int stripe_ctr(struct dm_target *
ti->num_flush_bios = stripes;
ti->num_discard_bios = stripes;
ti->num_write_same_bios = stripes;
+ ti->copy_supported = 1;
sc->chunk_size = chunk_size;
if (chunk_size & (chunk_size - 1))
@@ -416,11 +417,19 @@ static int stripe_merge(struct dm_target
struct stripe_c *sc = ti->private;
sector_t bvm_sector = bvm->bi_sector;
uint32_t stripe;
+ struct block_device *bdev;
struct request_queue *q;
stripe_map_sector(sc, bvm_sector, &stripe, &bvm_sector);
- q = bdev_get_queue(sc->stripe[stripe].dev->bdev);
+ bdev = sc->stripe[stripe].dev->bdev;
+
+ if (unlikely((bvm->bi_rw & REQ_COPY) != 0)) {
+ if (!bdev_copy_offload(bdev))
+ return 0;
+ }
+
+ q = bdev_get_queue(bdev);
if (!q->merge_bvec_fn)
return max_size;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/