aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-raid1.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2011-01-13 14:59:48 -0500
committerAlasdair G Kergon <agk@redhat.com>2011-01-13 14:59:48 -0500
commit5fc2ffeabb9ee0fc0e71ff16b49f34f0ed3d05b4 (patch)
tree338c273e43209ebf5de5aef13186ce0666e7e06f /drivers/md/dm-raid1.c
parent84c89557a302e18414a011cc52b1abd034860743 (diff)
dm raid1: support discard
Enable discard support in the DM mirror target. Also change an existing use of 'bvec' to 'addr' in the union. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-raid1.c')
-rw-r--r--drivers/md/dm-raid1.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 19a59b041c27..c87756eb7a21 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -261,7 +261,7 @@ static int mirror_flush(struct dm_target *ti)
261 struct dm_io_request io_req = { 261 struct dm_io_request io_req = {
262 .bi_rw = WRITE_FLUSH, 262 .bi_rw = WRITE_FLUSH,
263 .mem.type = DM_IO_KMEM, 263 .mem.type = DM_IO_KMEM,
264 .mem.ptr.bvec = NULL, 264 .mem.ptr.addr = NULL,
265 .client = ms->io_client, 265 .client = ms->io_client,
266 }; 266 };
267 267
@@ -637,6 +637,12 @@ static void do_write(struct mirror_set *ms, struct bio *bio)
637 .client = ms->io_client, 637 .client = ms->io_client,
638 }; 638 };
639 639
640 if (bio->bi_rw & REQ_DISCARD) {
641 io_req.bi_rw |= REQ_DISCARD;
642 io_req.mem.type = DM_IO_KMEM;
643 io_req.mem.ptr.addr = NULL;
644 }
645
640 for (i = 0, m = ms->mirror; i < ms->nr_mirrors; i++, m++) 646 for (i = 0, m = ms->mirror; i < ms->nr_mirrors; i++, m++)
641 map_region(dest++, m, bio); 647 map_region(dest++, m, bio);
642 648
@@ -670,7 +676,8 @@ static void do_writes(struct mirror_set *ms, struct bio_list *writes)
670 bio_list_init(&requeue); 676 bio_list_init(&requeue);
671 677
672 while ((bio = bio_list_pop(writes))) { 678 while ((bio = bio_list_pop(writes))) {
673 if (bio->bi_rw & REQ_FLUSH) { 679 if ((bio->bi_rw & REQ_FLUSH) ||
680 (bio->bi_rw & REQ_DISCARD)) {
674 bio_list_add(&sync, bio); 681 bio_list_add(&sync, bio);
675 continue; 682 continue;
676 } 683 }
@@ -1076,6 +1083,7 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1076 ti->private = ms; 1083 ti->private = ms;
1077 ti->split_io = dm_rh_get_region_size(ms->rh); 1084 ti->split_io = dm_rh_get_region_size(ms->rh);
1078 ti->num_flush_requests = 1; 1085 ti->num_flush_requests = 1;
1086 ti->num_discard_requests = 1;
1079 1087
1080 ms->kmirrord_wq = create_singlethread_workqueue("kmirrord"); 1088 ms->kmirrord_wq = create_singlethread_workqueue("kmirrord");
1081 if (!ms->kmirrord_wq) { 1089 if (!ms->kmirrord_wq) {