[PATCH] md: split reshape portion of raid5 sync_request into a separate function
... as raid5 sync_request is WAY too big. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
5e56341d02
commit
52c03291a8
@@ -2696,39 +2696,8 @@ static int make_request(request_queue_t *q, struct bio * bi)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME go_faster isn't used */
|
||||
static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster)
|
||||
static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped)
|
||||
{
|
||||
raid5_conf_t *conf = (raid5_conf_t *) mddev->private;
|
||||
struct stripe_head *sh;
|
||||
int pd_idx;
|
||||
sector_t first_sector, last_sector;
|
||||
int raid_disks = conf->raid_disks;
|
||||
int data_disks = raid_disks - conf->max_degraded;
|
||||
sector_t max_sector = mddev->size << 1;
|
||||
int sync_blocks;
|
||||
int still_degraded = 0;
|
||||
int i;
|
||||
|
||||
if (sector_nr >= max_sector) {
|
||||
/* just being told to finish up .. nothing much to do */
|
||||
unplug_slaves(mddev);
|
||||
if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) {
|
||||
end_reshape(conf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mddev->curr_resync < max_sector) /* aborted */
|
||||
bitmap_end_sync(mddev->bitmap, mddev->curr_resync,
|
||||
&sync_blocks, 1);
|
||||
else /* completed sync */
|
||||
conf->fullsync = 0;
|
||||
bitmap_close_sync(mddev->bitmap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) {
|
||||
/* reshaping is quite different to recovery/resync so it is
|
||||
* handled quite separately ... here.
|
||||
*
|
||||
@@ -2738,6 +2707,12 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
|
||||
* As the reads complete, handle_stripe will copy the data
|
||||
* into the destination stripe and release that stripe.
|
||||
*/
|
||||
raid5_conf_t *conf = (raid5_conf_t *) mddev->private;
|
||||
struct stripe_head *sh;
|
||||
int pd_idx;
|
||||
sector_t first_sector, last_sector;
|
||||
int raid_disks;
|
||||
int data_disks;
|
||||
int i;
|
||||
int dd_idx;
|
||||
sector_t writepos, safepos, gap;
|
||||
@@ -2843,7 +2818,42 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
|
||||
first_sector += STRIPE_SECTORS;
|
||||
}
|
||||
return conf->chunk_size>>9;
|
||||
}
|
||||
|
||||
/* FIXME go_faster isn't used */
|
||||
static inline sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster)
|
||||
{
|
||||
raid5_conf_t *conf = (raid5_conf_t *) mddev->private;
|
||||
struct stripe_head *sh;
|
||||
int pd_idx;
|
||||
int raid_disks = conf->raid_disks;
|
||||
int data_disks = raid_disks - conf->max_degraded;
|
||||
sector_t max_sector = mddev->size << 1;
|
||||
int sync_blocks;
|
||||
int still_degraded = 0;
|
||||
int i;
|
||||
|
||||
if (sector_nr >= max_sector) {
|
||||
/* just being told to finish up .. nothing much to do */
|
||||
unplug_slaves(mddev);
|
||||
if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) {
|
||||
end_reshape(conf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mddev->curr_resync < max_sector) /* aborted */
|
||||
bitmap_end_sync(mddev->bitmap, mddev->curr_resync,
|
||||
&sync_blocks, 1);
|
||||
else /* completed sync */
|
||||
conf->fullsync = 0;
|
||||
bitmap_close_sync(mddev->bitmap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery))
|
||||
return reshape_request(mddev, sector_nr, skipped);
|
||||
|
||||
/* if there is too many failed drives and we are trying
|
||||
* to resync, then assert that we are finished, because there is
|
||||
* nothing we can do.
|
||||
|
Reference in New Issue
Block a user