aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c37
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;