diff options
Diffstat (limited to 'drivers/md/dm-raid1.c')
-rw-r--r-- | drivers/md/dm-raid1.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index d44bc497dad9..751660b0c574 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -237,6 +237,40 @@ out: | |||
237 | schedule_work(&ms->trigger_event); | 237 | schedule_work(&ms->trigger_event); |
238 | } | 238 | } |
239 | 239 | ||
240 | static int mirror_flush(struct dm_target *ti) | ||
241 | { | ||
242 | struct mirror_set *ms = ti->private; | ||
243 | unsigned long error_bits; | ||
244 | |||
245 | unsigned int i; | ||
246 | struct dm_io_region io[ms->nr_mirrors]; | ||
247 | struct mirror *m; | ||
248 | struct dm_io_request io_req = { | ||
249 | .bi_rw = WRITE_BARRIER, | ||
250 | .mem.type = DM_IO_KMEM, | ||
251 | .mem.ptr.bvec = NULL, | ||
252 | .client = ms->io_client, | ||
253 | }; | ||
254 | |||
255 | for (i = 0, m = ms->mirror; i < ms->nr_mirrors; i++, m++) { | ||
256 | io[i].bdev = m->dev->bdev; | ||
257 | io[i].sector = 0; | ||
258 | io[i].count = 0; | ||
259 | } | ||
260 | |||
261 | error_bits = -1; | ||
262 | dm_io(&io_req, ms->nr_mirrors, io, &error_bits); | ||
263 | if (unlikely(error_bits != 0)) { | ||
264 | for (i = 0; i < ms->nr_mirrors; i++) | ||
265 | if (test_bit(i, &error_bits)) | ||
266 | fail_mirror(ms->mirror + i, | ||
267 | DM_RAID1_WRITE_ERROR); | ||
268 | return -EIO; | ||
269 | } | ||
270 | |||
271 | return 0; | ||
272 | } | ||
273 | |||
240 | /*----------------------------------------------------------------- | 274 | /*----------------------------------------------------------------- |
241 | * Recovery. | 275 | * Recovery. |
242 | * | 276 | * |
@@ -896,7 +930,8 @@ static struct dm_dirty_log *create_dirty_log(struct dm_target *ti, | |||
896 | return NULL; | 930 | return NULL; |
897 | } | 931 | } |
898 | 932 | ||
899 | dl = dm_dirty_log_create(argv[0], ti, NULL, param_count, argv + 2); | 933 | dl = dm_dirty_log_create(argv[0], ti, mirror_flush, param_count, |
934 | argv + 2); | ||
900 | if (!dl) { | 935 | if (!dl) { |
901 | ti->error = "Error creating mirror dirty log"; | 936 | ti->error = "Error creating mirror dirty log"; |
902 | return NULL; | 937 | return NULL; |