md: Update md bitmap during resync.
Currently an md array with a write-intent bitmap does not updated that bitmap to reflect successful partial resync. Rather the entire bitmap is updated when the resync completes. This is because there is no guarentee that resync requests will complete in order, and tracking each request individually is unnecessarily burdensome. However there is value in regularly updating the bitmap, so add code to periodically pause while all pending sync requests complete, then update the bitmap. Doing this only every few seconds (the same as the bitmap update time) does not notciably affect resync performance. [snitzer@gmail.com: export bitmap_cond_end_sync] Signed-off-by: Neil Brown <neilb@suse.de> Cc: "Mike Snitzer" <snitzer@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
66c811e993
commit
b47490c9bc
@ -1348,16 +1348,40 @@ void bitmap_close_sync(struct bitmap *bitmap)
|
||||
*/
|
||||
sector_t sector = 0;
|
||||
int blocks;
|
||||
if (!bitmap) return;
|
||||
if (!bitmap)
|
||||
return;
|
||||
while (sector < bitmap->mddev->resync_max_sectors) {
|
||||
bitmap_end_sync(bitmap, sector, &blocks, 0);
|
||||
/*
|
||||
if (sector < 500) printk("bitmap_close_sync: sec %llu blks %d\n",
|
||||
(unsigned long long)sector, blocks);
|
||||
*/ sector += blocks;
|
||||
sector += blocks;
|
||||
}
|
||||
}
|
||||
|
||||
void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector)
|
||||
{
|
||||
sector_t s = 0;
|
||||
int blocks;
|
||||
|
||||
if (!bitmap)
|
||||
return;
|
||||
if (sector == 0) {
|
||||
bitmap->last_end_sync = jiffies;
|
||||
return;
|
||||
}
|
||||
if (time_before(jiffies, (bitmap->last_end_sync
|
||||
+ bitmap->daemon_sleep * HZ)))
|
||||
return;
|
||||
wait_event(bitmap->mddev->recovery_wait,
|
||||
atomic_read(&bitmap->mddev->recovery_active) == 0);
|
||||
|
||||
sector &= ~((1ULL << CHUNK_BLOCK_SHIFT(bitmap)) - 1);
|
||||
s = 0;
|
||||
while (s < sector && s < bitmap->mddev->resync_max_sectors) {
|
||||
bitmap_end_sync(bitmap, s, &blocks, 0);
|
||||
s += blocks;
|
||||
}
|
||||
bitmap->last_end_sync = jiffies;
|
||||
}
|
||||
|
||||
static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int needed)
|
||||
{
|
||||
/* For each chunk covered by any of these sectors, set the
|
||||
@ -1565,3 +1589,4 @@ EXPORT_SYMBOL(bitmap_start_sync);
|
||||
EXPORT_SYMBOL(bitmap_end_sync);
|
||||
EXPORT_SYMBOL(bitmap_unplug);
|
||||
EXPORT_SYMBOL(bitmap_close_sync);
|
||||
EXPORT_SYMBOL(bitmap_cond_end_sync);
|
||||
|
Reference in New Issue
Block a user