diff options
author | NeilBrown <neilb@cse.unsw.edu.au> | 2005-08-04 15:53:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-08-04 16:00:54 -0400 |
commit | 6b8b3e8a8b3e62b4209eaa36697e3c9df457e196 (patch) | |
tree | 8b537e5b358cbe93cd8e8ea54a9281d56a7ce205 /drivers/md/bitmap.c | |
parent | e3b9703e27aab3839dcdb76b00d98428b67d25b0 (diff) |
[PATCH] md: make sure md bitmap updates are flushed when array is stopped.
The recent change to never ignore the bitmap, revealed that the bitmap isn't
begin flushed properly when an array is stopped.
We call bitmap_daemon_work three times as there is a three-stage pipeline for
flushing updates to the bitmap file.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/bitmap.c')
-rw-r--r-- | drivers/md/bitmap.c | 23 |
1 files changed, 23 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 | */ | ||
1456 | void 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 | */ |
1456 | void bitmap_destroy(mddev_t *mddev) | 1479 | void bitmap_destroy(mddev_t *mddev) |