diff options
author | NeilBrown <neilb@cse.unsw.edu.au> | 2005-07-15 06:56:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-15 12:54:51 -0400 |
commit | 6a806c510de490318846b53bbfec463d02ca274b (patch) | |
tree | 7018abfd9db7856708bc2c578f48c30eab8855b1 /drivers/md/raid1.c | |
parent | a1287ba1ba810aae1f8b81e32560d5d3bf3ff9f0 (diff) |
[PATCH] md/raid1: clear bitmap when fullsync completes
We need to be careful differentiating between a resync of a complete array,
in which we can clear the bitmap, and a resync of a degraded array, in
which we cannot.
This patch cleans all that up.
Cc: Paul Clements <paul.clements@steeleye.com>
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/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index ff1dbec864af..5f253ee536bb 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1126,21 +1126,19 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1126 | * only be one in raid1 resync. | 1126 | * only be one in raid1 resync. |
1127 | * We can find the current addess in mddev->curr_resync | 1127 | * We can find the current addess in mddev->curr_resync |
1128 | */ | 1128 | */ |
1129 | if (!conf->fullsync) { | 1129 | if (mddev->curr_resync < max_sector) /* aborted */ |
1130 | if (mddev->curr_resync < max_sector) | 1130 | bitmap_end_sync(mddev->bitmap, mddev->curr_resync, |
1131 | bitmap_end_sync(mddev->bitmap, | ||
1132 | mddev->curr_resync, | ||
1133 | &sync_blocks, 1); | 1131 | &sync_blocks, 1); |
1134 | bitmap_close_sync(mddev->bitmap); | 1132 | else /* completed sync */ |
1135 | } | ||
1136 | if (mddev->curr_resync >= max_sector) | ||
1137 | conf->fullsync = 0; | 1133 | conf->fullsync = 0; |
1134 | |||
1135 | bitmap_close_sync(mddev->bitmap); | ||
1138 | close_sync(conf); | 1136 | close_sync(conf); |
1139 | return 0; | 1137 | return 0; |
1140 | } | 1138 | } |
1141 | 1139 | ||
1142 | if (!conf->fullsync && | 1140 | if (!bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, mddev->degraded) && |
1143 | !bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks)) { | 1141 | !conf->fullsync) { |
1144 | /* We can skip this block, and probably several more */ | 1142 | /* We can skip this block, and probably several more */ |
1145 | *skipped = 1; | 1143 | *skipped = 1; |
1146 | return sync_blocks; | 1144 | return sync_blocks; |
@@ -1243,15 +1241,15 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1243 | len = (max_sector - sector_nr) << 9; | 1241 | len = (max_sector - sector_nr) << 9; |
1244 | if (len == 0) | 1242 | if (len == 0) |
1245 | break; | 1243 | break; |
1246 | if (!conf->fullsync) { | 1244 | if (sync_blocks == 0) { |
1247 | if (sync_blocks == 0) { | 1245 | if (!bitmap_start_sync(mddev->bitmap, sector_nr, |
1248 | if (!bitmap_start_sync(mddev->bitmap, | 1246 | &sync_blocks, mddev->degraded) && |
1249 | sector_nr, &sync_blocks)) | 1247 | !conf->fullsync) |
1250 | break; | 1248 | break; |
1251 | if (sync_blocks < (PAGE_SIZE>>9)) | 1249 | if (sync_blocks < (PAGE_SIZE>>9)) |
1252 | BUG(); | 1250 | BUG(); |
1253 | if (len > (sync_blocks<<9)) len = sync_blocks<<9; | 1251 | if (len > (sync_blocks<<9)) |
1254 | } | 1252 | len = sync_blocks<<9; |
1255 | } | 1253 | } |
1256 | 1254 | ||
1257 | for (i=0 ; i < conf->raid_disks; i++) { | 1255 | for (i=0 ; i < conf->raid_disks; i++) { |
@@ -1264,7 +1262,8 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1264 | while (i > 0) { | 1262 | while (i > 0) { |
1265 | i--; | 1263 | i--; |
1266 | bio = r1_bio->bios[i]; | 1264 | bio = r1_bio->bios[i]; |
1267 | if (bio->bi_end_io==NULL) continue; | 1265 | if (bio->bi_end_io==NULL) |
1266 | continue; | ||
1268 | /* remove last page from this bio */ | 1267 | /* remove last page from this bio */ |
1269 | bio->bi_vcnt--; | 1268 | bio->bi_vcnt--; |
1270 | bio->bi_size -= len; | 1269 | bio->bi_size -= len; |