Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09b4068a authored by NeilBrown's avatar NeilBrown
Browse files

md/raid10: Don't skip more than 1 bitmap-chunk at a time during recovery.



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.



Cc: stable@kernel.org
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 2ec77fc9
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -2010,14 +2010,14 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
	/* There is nowhere to write, so all non-sync
	/* There is nowhere to write, so all non-sync
	 * drives must be failed, so try the next chunk...
	 * drives must be failed, so try the next chunk...
	 */
	 */
	{
	if (sector_nr + max_sync < max_sector)
	sector_t sec = max_sector - sector_nr;
		max_sector = sector_nr + max_sync;
	sectors_skipped += sec;

	sectors_skipped += (max_sector - sector_nr);
	chunks_skipped ++;
	chunks_skipped ++;
	sector_nr = max_sector;
	sector_nr = max_sector;
	goto skipped;
	goto skipped;
}
}
}


static int run(mddev_t *mddev)
static int run(mddev_t *mddev)
{
{