Skip to contentSkip to conversation

ext4: Init the complete page while building buddy cache

PATCH New Aneesh Kumar K.V 1 participant 1 message Dec 2, 2008 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: Init the complete page while building buddy cache

We need to init the complete page during buddy cache init by setting the contents to '1'. This ensures that during resize when we increment the s_groups_count we don't hit the erros as below.

EXT4-fs error (device sdb1): ext4_mb_mark_diskspace_used:
Allocating block 1040385 in system zone of 127 group

V3 changes:
We don't need to do a memset when updating buddy cache since we do a complete init of the page.

---
 fs/ext4/mballoc.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
fs/ext4/mballoc.c +2 -1
index 8f33691..0ecc7c7 100644
@@ -846,6 +846,8 @@ static int ext4_mb_init_cache(struct page *page, char *incore)
 
 	err = 0;
 	first_block = page->index * blocks_per_page;
+	/* init the page  */
+	memset(page_address(page), 0xff, PAGE_CACHE_SIZE);
 	for (i = 0; i < blocks_per_page; i++) {
 		int group;
 		struct ext4_group_info *grinfo;
@@ -872,7 +874,6 @@ static int ext4_mb_init_cache(struct page *page, char *incore)
 			BUG_ON(incore == NULL);
 			mb_debug("put buddy for group %u in page %lu/%x\n",
 				group, page->index, i * blocksize);
-			memset(data, 0xff, blocksize);
 			grinfo = ext4_get_group_info(sb, group);
 			grinfo->bb_fragments = 0;
 			memset(grinfo->bb_counters, 0,
Signature · 1 line
1.6.1.rc1