diff options
author | NeilBrown <neilb@suse.de> | 2009-02-25 13:18:47 +1100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-16 17:52:54 -0700 |
commit | d56e3f4ea3854531d1ab2bd6a490c3ea41c8d577 (patch) | |
tree | 570238524823a9118cb378ec6652ea9b5aa57ac6 | |
parent | 87dcb6eae60dceb981fe931144d94b157a91f466 (diff) |
md/raid10: Don't skip more than 1 bitmap-chunk at a time during recovery.
commit 09b4068a7fe442efc40e9dcbcf5ff37c3338ab15 upstream.
When doing recovery on a raid10 with a write-intent bitmap, we only
need to recovery chunks that are flagged in the bitmap.
However if we choose to skip a chunk as it isn't flag, the code
currently skips the whole raid10-chunk, thus it might not recovery
some blocks that need recovering.
This patch fixes it.
In case that is confusing, it might help to understand that there
is a 'raid10 chunk size' which guides how data is distributed across
the devices, and a 'bitmap chunk size' which says how much data
corresponds to a single bit in the bitmap.
This bug only affects cases where the bitmap chunk size is smaller
than the raid10 chunk size.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/md/raid10.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index c2dfaa80243..dc50f989951 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -2010,13 +2010,13 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i /* There is nowhere to write, so all non-sync * drives must be failed, so try the next chunk... */ - { - sector_t sec = max_sector - sector_nr; - sectors_skipped += sec; + if (sector_nr + max_sync < max_sector) + max_sector = sector_nr + max_sync; + + sectors_skipped += (max_sector - sector_nr); chunks_skipped ++; sector_nr = max_sector; goto skipped; - } } static int run(mddev_t *mddev) |