aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/bitmap.c23
-rw-r--r--drivers/md/md.c2
-rw-r--r--include/linux/raid/bitmap.h1
3 files changed, 26 insertions, 0 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 09d32db06d20..41df4cda66e2 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1451,6 +1451,29 @@ static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset)
1451} 1451}
1452 1452
1453/* 1453/*
1454 * flush out any pending updates
1455 */
1456void bitmap_flush(mddev_t *mddev)
1457{
1458 struct bitmap *bitmap = mddev->bitmap;
1459 int sleep;
1460
1461 if (!bitmap) /* there was no bitmap */
1462 return;
1463
1464 /* run the daemon_work three time to ensure everything is flushed
1465 * that can be
1466 */
1467 sleep = bitmap->daemon_sleep;
1468 bitmap->daemon_sleep = 0;
1469 bitmap_daemon_work(bitmap);
1470 bitmap_daemon_work(bitmap);
1471 bitmap_daemon_work(bitmap);
1472 bitmap->daemon_sleep = sleep;
1473 bitmap_update_sb(bitmap);
1474}
1475
1476/*
1454 * free memory that was allocated 1477 * free memory that was allocated
1455 */ 1478 */
1456void bitmap_destroy(mddev_t *mddev) 1479void bitmap_destroy(mddev_t *mddev)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9fd4dbea0d0d..480f658db6f2 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1798,6 +1798,8 @@ static int do_md_stop(mddev_t * mddev, int ro)
1798 goto out; 1798 goto out;
1799 mddev->ro = 1; 1799 mddev->ro = 1;
1800 } else { 1800 } else {
1801 bitmap_flush(mddev);
1802 wait_event(mddev->sb_wait, atomic_read(&mddev->pending_writes)==0);
1801 if (mddev->ro) 1803 if (mddev->ro)
1802 set_disk_ro(disk, 0); 1804 set_disk_ro(disk, 0);
1803 blk_queue_make_request(mddev->queue, md_fail_request); 1805 blk_queue_make_request(mddev->queue, md_fail_request);
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index 6213e976eade..4bf1659f8aa8 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -248,6 +248,7 @@ struct bitmap {
248 248
249/* these are used only by md/bitmap */ 249/* these are used only by md/bitmap */
250int bitmap_create(mddev_t *mddev); 250int bitmap_create(mddev_t *mddev);
251void bitmap_flush(mddev_t *mddev);
251void bitmap_destroy(mddev_t *mddev); 252void bitmap_destroy(mddev_t *mddev);
252int bitmap_active(struct bitmap *bitmap); 253int bitmap_active(struct bitmap *bitmap);
253 254