diff options
author | Neil Brown <neilb@suse.de> | 2007-08-23 00:56:48 +0200 |
---|---|---|
committer | Adrian Bunk <bunk@stusta.de> | 2007-08-23 00:56:48 +0200 |
commit | 32b268195c968892eec3cdb328e2594e379a658b (patch) | |
tree | b80c629b01d5ff32de27185d0a3a315a45bdcbf4 /drivers/md/raid1.c | |
parent | 287440c90e8bf967622072c0766d1c680d3c16ae (diff) |
md: Allow re-add to work on array without bitmaps
When an array has a bitmap, a device can be removed and re-added and only
blocks changes since the removal (as recorded in the bitmap) will be resynced.
It should be possible to do a similar thing to arrays without bitmaps. i.e.
if a device is removed and re-added and *no* changes have been made in the
interim, then the add should not require a resync.
This patch allows that option. This means that when assembling an array one
device at a time (e.g. during device discovery) the array can be enabled
read-only as soon as enough devices are available, but extra devices can still
be added without causing a resync.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 0a01a0cbd88..b8889200718 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1630,6 +1630,12 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i /* before building a request, check if we can skip these blocks.. * This call the bitmap_start_sync doesn't actually record anything */ + if (mddev->bitmap == NULL && + mddev->recovery_cp == MaxSector && + conf->fullsync == 0) { + *skipped = 1; + return max_sector - sector_nr; + } if (!bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, 1) && !conf->fullsync && !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { /* We can skip this block, and probably several more */ |