Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 251727
b: refs/heads/master
c: 9b8b7d3
h: refs/heads/master
i:
  251725: 9686dee
  251723: 1a3baad
  251719: 1e63eee
  251711: 5fae483
v: v3
  • Loading branch information
Amir Goldstein authored and Theodore Ts'o committed May 10, 2011
1 parent 647a16b commit 3631817
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 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: 2de8807b25de6d24476923121e3b20146fe8216b
refs/heads/master: 9b8b7d353f5f9bea758398c3af679ffa105e5cfe
33 changes: 25 additions & 8 deletions trunk/fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@ static int ext4_mb_init_cache(struct page *page, char *incore)
struct inode *inode;
char *data;
char *bitmap;
struct ext4_group_info *grinfo;

mb_debug(1, "init page %lu\n", page->index);

Expand Down Expand Up @@ -819,6 +820,18 @@ static int ext4_mb_init_cache(struct page *page, char *incore)
if (first_group + i >= ngroups)
break;

grinfo = ext4_get_group_info(sb, first_group + i);
/*
* If page is uptodate then we came here after online resize
* which added some new uninitialized group info structs, so
* we must skip all initialized uptodate buddies on the page,
* which may be currently in use by an allocating task.
*/
if (PageUptodate(page) && !EXT4_MB_GRP_NEED_INIT(grinfo)) {
bh[i] = NULL;
continue;
}

err = -EIO;
desc = ext4_get_group_desc(sb, first_group + i, NULL);
if (desc == NULL)
Expand Down Expand Up @@ -871,26 +884,28 @@ static int ext4_mb_init_cache(struct page *page, char *incore)
}

/* wait for I/O completion */
for (i = 0; i < groups_per_page && bh[i]; i++)
wait_on_buffer(bh[i]);
for (i = 0; i < groups_per_page; i++)
if (bh[i])
wait_on_buffer(bh[i]);

err = -EIO;
for (i = 0; i < groups_per_page && bh[i]; i++)
if (!buffer_uptodate(bh[i]))
for (i = 0; i < groups_per_page; i++)
if (bh[i] && !buffer_uptodate(bh[i]))
goto out;

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;

group = (first_block + i) >> 1;
if (group >= ngroups)
break;

if (!bh[group - first_group])
/* skip initialized uptodate buddy */
continue;

/*
* data carry information regarding this
* particular group in the format specified
Expand Down Expand Up @@ -919,6 +934,8 @@ static int ext4_mb_init_cache(struct page *page, char *incore)
* incore got set to the group block bitmap below
*/
ext4_lock_group(sb, group);
/* init the buddy */
memset(data, 0xff, blocksize);
ext4_mb_generate_buddy(sb, data, incore, group);
ext4_unlock_group(sb, group);
incore = NULL;
Expand Down Expand Up @@ -948,7 +965,7 @@ static int ext4_mb_init_cache(struct page *page, char *incore)

out:
if (bh) {
for (i = 0; i < groups_per_page && bh[i]; i++)
for (i = 0; i < groups_per_page; i++)
brelse(bh[i]);
if (bh != &bhs)
kfree(bh);
Expand Down

0 comments on commit 3631817

Please sign in to comment.