aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/dm-raid1.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 2a3e2f80aa4b..bde904606099 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -21,6 +21,7 @@
21#include <linux/workqueue.h> 21#include <linux/workqueue.h>
22 22
23#define DM_MSG_PREFIX "raid1" 23#define DM_MSG_PREFIX "raid1"
24#define DM_IO_PAGES 64
24 25
25#define DM_RAID1_HANDLE_ERRORS 0x01 26#define DM_RAID1_HANDLE_ERRORS 0x01
26 27
@@ -126,6 +127,8 @@ struct mirror_set {
126 struct bio_list reads; 127 struct bio_list reads;
127 struct bio_list writes; 128 struct bio_list writes;
128 129
130 struct dm_io_client *io_client;
131
129 /* recovery */ 132 /* recovery */
130 region_t nr_regions; 133 region_t nr_regions;
131 int in_sync; 134 int in_sync;
@@ -796,6 +799,14 @@ static void do_write(struct mirror_set *ms, struct bio *bio)
796 unsigned int i; 799 unsigned int i;
797 struct io_region io[KCOPYD_MAX_REGIONS+1]; 800 struct io_region io[KCOPYD_MAX_REGIONS+1];
798 struct mirror *m; 801 struct mirror *m;
802 struct dm_io_request io_req = {
803 .bi_rw = WRITE,
804 .mem.type = DM_IO_BVEC,
805 .mem.ptr.bvec = bio->bi_io_vec + bio->bi_idx,
806 .notify.fn = write_callback,
807 .notify.context = bio,
808 .client = ms->io_client,
809 };
799 810
800 for (i = 0; i < ms->nr_mirrors; i++) { 811 for (i = 0; i < ms->nr_mirrors; i++) {
801 m = ms->mirror + i; 812 m = ms->mirror + i;
@@ -806,9 +817,8 @@ static void do_write(struct mirror_set *ms, struct bio *bio)
806 } 817 }
807 818
808 bio_set_ms(bio, ms); 819 bio_set_ms(bio, ms);
809 dm_io_async_bvec(ms->nr_mirrors, io, WRITE, 820
810 bio->bi_io_vec + bio->bi_idx, 821 (void) dm_io(&io_req, ms->nr_mirrors, io, NULL);
811 write_callback, bio);
812} 822}
813 823
814static void do_writes(struct mirror_set *ms, struct bio_list *writes) 824static void do_writes(struct mirror_set *ms, struct bio_list *writes)
@@ -924,6 +934,13 @@ static struct mirror_set *alloc_context(unsigned int nr_mirrors,
924 ms->in_sync = 0; 934 ms->in_sync = 0;
925 ms->default_mirror = &ms->mirror[DEFAULT_MIRROR]; 935 ms->default_mirror = &ms->mirror[DEFAULT_MIRROR];
926 936
937 ms->io_client = dm_io_client_create(DM_IO_PAGES);
938 if (IS_ERR(ms->io_client)) {
939 ti->error = "Error creating dm_io client";
940 kfree(ms);
941 return NULL;
942 }
943
927 if (rh_init(&ms->rh, ms, dl, region_size, ms->nr_regions)) { 944 if (rh_init(&ms->rh, ms, dl, region_size, ms->nr_regions)) {
928 ti->error = "Error creating dirty region hash"; 945 ti->error = "Error creating dirty region hash";
929 kfree(ms); 946 kfree(ms);
@@ -939,6 +956,7 @@ static void free_context(struct mirror_set *ms, struct dm_target *ti,
939 while (m--) 956 while (m--)
940 dm_put_device(ti, ms->mirror[m].dev); 957 dm_put_device(ti, ms->mirror[m].dev);
941 958
959 dm_io_client_destroy(ms->io_client);
942 rh_exit(&ms->rh); 960 rh_exit(&ms->rh);
943 kfree(ms); 961 kfree(ms);
944} 962}
@@ -1062,7 +1080,6 @@ static int parse_features(struct mirror_set *ms, unsigned argc, char **argv,
1062 * 1080 *
1063 * If present, features must be "handle_errors". 1081 * If present, features must be "handle_errors".
1064 */ 1082 */
1065#define DM_IO_PAGES 64
1066static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) 1083static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1067{ 1084{
1068 int r; 1085 int r;