Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 2584
b: refs/heads/master
c: cdbb4cc
h: refs/heads/master
v: v3
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Jun 22, 2005
1 parent 11e0271 commit f3dab03
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bc7f77de2cd81718dd789a2cfe68a7cf1b48f016
refs/heads/master: cdbb4cc2e5c30895709163d8544057db21ee23e0
27 changes: 12 additions & 15 deletions trunk/drivers/md/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ int bitmap_unplug(struct bitmap *bitmap)
}

static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset,
unsigned long sectors, int set);
unsigned long sectors, int in_sync);
/* * bitmap_init_from_disk -- called at bitmap_create time to initialize
* the in-memory bitmap from the on-disk bitmap -- also, sets up the
* memory mapping of the bitmap file
Expand All @@ -756,7 +756,7 @@ static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset,
* previously kicked from the array, we mark all the bits as
* 1's in order to cause a full resync.
*/
static int bitmap_init_from_disk(struct bitmap *bitmap)
static int bitmap_init_from_disk(struct bitmap *bitmap, int in_sync)
{
unsigned long i, chunks, index, oldindex, bit;
struct page *page = NULL, *oldpage = NULL;
Expand All @@ -782,7 +782,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap)

bytes = (chunks + 7) / 8;

num_pages = (bytes + sizeof(bitmap_super_t) + PAGE_SIZE - 1) / PAGE_SIZE + 1;
num_pages = (bytes + sizeof(bitmap_super_t) + PAGE_SIZE - 1) / PAGE_SIZE;

if (i_size_read(file->f_mapping->host) < bytes + sizeof(bitmap_super_t)) {
printk(KERN_INFO "%s: bitmap file too short %lu < %lu\n",
Expand Down Expand Up @@ -854,14 +854,9 @@ static int bitmap_init_from_disk(struct bitmap *bitmap)
if (test_bit(bit, page_address(page))) {
/* if the disk bit is set, set the memory bit */
bitmap_set_memory_bits(bitmap,
i << CHUNK_BLOCK_SHIFT(bitmap), 1, 1);
i << CHUNK_BLOCK_SHIFT(bitmap), 1, in_sync);
bit_cnt++;
}
#if 0
else
bitmap_set_memory_bits(bitmap,
i << CHUNK_BLOCK_SHIFT(bitmap), 1, 0);
#endif
}

/* everything went OK */
Expand Down Expand Up @@ -1331,10 +1326,10 @@ void bitmap_close_sync(struct bitmap *bitmap)
}

static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset,
unsigned long sectors, int set)
unsigned long sectors, int in_sync)
{
/* For each chunk covered by any of these sectors, set the
* resync needed bit, and the counter to 1. They should all
* counter to 1 and set resync_needed unless in_sync. They should all
* be 0 at this point
*/
while (sectors) {
Expand All @@ -1346,10 +1341,12 @@ static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset,
spin_unlock_irq(&bitmap->lock);
return;
}
if (set && !NEEDED(*bmc)) {
BUG_ON(*bmc);
*bmc = NEEDED_MASK | 1;
if (! *bmc) {
struct page *page;
*bmc = 1 | (in_sync? 0 : NEEDED_MASK);
bitmap_count_page(bitmap, offset, 1);
page = filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap));
set_page_attr(bitmap, page, BITMAP_PAGE_CLEAN);
}
spin_unlock_irq(&bitmap->lock);
if (sectors > secs)
Expand Down Expand Up @@ -1489,7 +1486,7 @@ int bitmap_create(mddev_t *mddev)

/* now that we have some pages available, initialize the in-memory
* bitmap from the on-disk bitmap */
err = bitmap_init_from_disk(bitmap);
err = bitmap_init_from_disk(bitmap, mddev->recovery_cp == MaxSector);
if (err)
return err;

Expand Down

0 comments on commit f3dab03

Please sign in to comment.