md/raid10: reformat some loops with less indenting.
When a loop ends with an 'if' with a large body, it is neater to make the if 'continue' on the inverse condition, and then the body is indented less. Apply this pattern 3 times, and wrap some other long lines. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
f17ed07c85
commit
ab9d47e990
|
@ -1736,7 +1736,8 @@ static int init_resync(conf_t *conf)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster)
|
static sector_t sync_request(mddev_t *mddev, sector_t sector_nr,
|
||||||
|
int *skipped, int go_faster)
|
||||||
{
|
{
|
||||||
conf_t *conf = mddev->private;
|
conf_t *conf = mddev->private;
|
||||||
r10bio_t *r10_bio;
|
r10bio_t *r10_bio;
|
||||||
|
@ -1830,14 +1831,20 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
|
||||||
int j, k;
|
int j, k;
|
||||||
r10_bio = NULL;
|
r10_bio = NULL;
|
||||||
|
|
||||||
for (i=0 ; i<conf->raid_disks; i++)
|
for (i=0 ; i<conf->raid_disks; i++) {
|
||||||
if (conf->mirrors[i].rdev &&
|
int still_degraded;
|
||||||
!test_bit(In_sync, &conf->mirrors[i].rdev->flags)) {
|
r10bio_t *rb2;
|
||||||
int still_degraded = 0;
|
sector_t sect;
|
||||||
/* want to reconstruct this device */
|
|
||||||
r10bio_t *rb2 = r10_bio;
|
|
||||||
sector_t sect = raid10_find_virt(conf, sector_nr, i);
|
|
||||||
int must_sync;
|
int must_sync;
|
||||||
|
|
||||||
|
if (conf->mirrors[i].rdev == NULL ||
|
||||||
|
test_bit(In_sync, &conf->mirrors[i].rdev->flags))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
still_degraded = 0;
|
||||||
|
/* want to reconstruct this device */
|
||||||
|
rb2 = r10_bio;
|
||||||
|
sect = raid10_find_virt(conf, sector_nr, i);
|
||||||
/* Unless we are doing a full sync, we only need
|
/* Unless we are doing a full sync, we only need
|
||||||
* to recover the block if it is set in the bitmap
|
* to recover the block if it is set in the bitmap
|
||||||
*/
|
*/
|
||||||
|
@ -1882,8 +1889,9 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
|
||||||
|
|
||||||
for (j=0; j<conf->copies;j++) {
|
for (j=0; j<conf->copies;j++) {
|
||||||
int d = r10_bio->devs[j].devnum;
|
int d = r10_bio->devs[j].devnum;
|
||||||
if (conf->mirrors[d].rdev &&
|
if (!conf->mirrors[d].rdev ||
|
||||||
test_bit(In_sync, &conf->mirrors[d].rdev->flags)) {
|
!test_bit(In_sync, &conf->mirrors[d].rdev->flags))
|
||||||
|
continue;
|
||||||
/* This is where we read from */
|
/* This is where we read from */
|
||||||
bio = r10_bio->devs[0].bio;
|
bio = r10_bio->devs[0].bio;
|
||||||
bio->bi_next = biolist;
|
bio->bi_next = biolist;
|
||||||
|
@ -1917,7 +1925,6 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (j == conf->copies) {
|
if (j == conf->copies) {
|
||||||
/* Cannot recover, so abort the recovery */
|
/* Cannot recover, so abort the recovery */
|
||||||
put_buf(r10_bio);
|
put_buf(r10_bio);
|
||||||
|
@ -1949,7 +1956,8 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
|
||||||
|
|
||||||
if (!bitmap_start_sync(mddev->bitmap, sector_nr,
|
if (!bitmap_start_sync(mddev->bitmap, sector_nr,
|
||||||
&sync_blocks, mddev->degraded) &&
|
&sync_blocks, mddev->degraded) &&
|
||||||
!conf->fullsync && !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
|
!conf->fullsync && !test_bit(MD_RECOVERY_REQUESTED,
|
||||||
|
&mddev->recovery)) {
|
||||||
/* We can skip this block */
|
/* We can skip this block */
|
||||||
*skipped = 1;
|
*skipped = 1;
|
||||||
return sync_blocks + sectors_skipped;
|
return sync_blocks + sectors_skipped;
|
||||||
|
@ -1994,7 +2002,8 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
|
||||||
for (i=0; i<conf->copies; i++) {
|
for (i=0; i<conf->copies; i++) {
|
||||||
int d = r10_bio->devs[i].devnum;
|
int d = r10_bio->devs[i].devnum;
|
||||||
if (r10_bio->devs[i].bio->bi_end_io)
|
if (r10_bio->devs[i].bio->bi_end_io)
|
||||||
rdev_dec_pending(conf->mirrors[d].rdev, mddev);
|
rdev_dec_pending(conf->mirrors[d].rdev,
|
||||||
|
mddev);
|
||||||
}
|
}
|
||||||
put_buf(r10_bio);
|
put_buf(r10_bio);
|
||||||
biolist = NULL;
|
biolist = NULL;
|
||||||
|
@ -2024,12 +2033,16 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
break;
|
break;
|
||||||
for (bio= biolist ; bio ; bio=bio->bi_next) {
|
for (bio= biolist ; bio ; bio=bio->bi_next) {
|
||||||
page = bio->bi_io_vec[bio->bi_vcnt].bv_page;
|
|
||||||
if (bio_add_page(bio, page, len, 0) == 0) {
|
|
||||||
/* stop here */
|
|
||||||
struct bio *bio2;
|
struct bio *bio2;
|
||||||
|
page = bio->bi_io_vec[bio->bi_vcnt].bv_page;
|
||||||
|
if (bio_add_page(bio, page, len, 0))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* stop here */
|
||||||
bio->bi_io_vec[bio->bi_vcnt].bv_page = page;
|
bio->bi_io_vec[bio->bi_vcnt].bv_page = page;
|
||||||
for (bio2 = biolist; bio2 && bio2 != bio; bio2 = bio2->bi_next) {
|
for (bio2 = biolist;
|
||||||
|
bio2 && bio2 != bio;
|
||||||
|
bio2 = bio2->bi_next) {
|
||||||
/* remove last page from this bio */
|
/* remove last page from this bio */
|
||||||
bio2->bi_vcnt--;
|
bio2->bi_vcnt--;
|
||||||
bio2->bi_size -= len;
|
bio2->bi_size -= len;
|
||||||
|
@ -2037,7 +2050,6 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
|
||||||
}
|
}
|
||||||
goto bio_full;
|
goto bio_full;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
nr_sectors += len>>9;
|
nr_sectors += len>>9;
|
||||||
sector_nr += len>>9;
|
sector_nr += len>>9;
|
||||||
} while (biolist->bi_vcnt < RESYNC_PAGES);
|
} while (biolist->bi_vcnt < RESYNC_PAGES);
|
||||||
|
|
Loading…
Reference in New Issue