Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98430
b: refs/heads/master
c: 5af4e7a
h: refs/heads/master
v: v3
  • Loading branch information
Benjamin Marzinski authored and Steven Whitehouse committed Jun 24, 2008
1 parent 26c8a72 commit 7b2c501
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 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: 17c15da00c0e7289375ad57e8fea0c7892b74aa0
refs/heads/master: 5af4e7a0bea715f2dd7190859a43eb2258b1f388
23 changes: 9 additions & 14 deletions trunk/fs/gfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,11 @@ static void find_metapath(const struct gfs2_sbd *sdp, u64 block,

}

static inline unsigned int zero_metapath_length(const struct metapath *mp,
unsigned height)
static inline unsigned int metapath_branch_start(const struct metapath *mp)
{
unsigned int i;
for (i = 0; i < height - 1; i++) {
if (mp->mp_list[i] != 0)
return i;
}
return height;
if (mp->mp_list[0] == 0)
return 2;
return 1;
}

/**
Expand Down Expand Up @@ -436,7 +432,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
struct gfs2_sbd *sdp = GFS2_SB(inode);
struct buffer_head *dibh = mp->mp_bh[0];
u64 bn, dblock = 0;
unsigned n, i, blks, alloced = 0, iblks = 0, zmpl = 0;
unsigned n, i, blks, alloced = 0, iblks = 0, branch_start = 0;
unsigned dblks = 0;
unsigned ptrs_per_blk;
const unsigned end_of_metadata = height - 1;
Expand Down Expand Up @@ -471,9 +467,8 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
/* Building up tree height */
state = ALLOC_GROW_HEIGHT;
iblks = height - ip->i_height;
zmpl = zero_metapath_length(mp, height);
iblks -= zmpl;
iblks += height;
branch_start = metapath_branch_start(mp);
iblks += (height - branch_start);
}
}

Expand Down Expand Up @@ -509,13 +504,13 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
sizeof(struct gfs2_meta_header));
*ptr = zero_bn;
state = ALLOC_GROW_DEPTH;
for(i = zmpl; i < height; i++) {
for(i = branch_start; i < height; i++) {
if (mp->mp_bh[i] == NULL)
break;
brelse(mp->mp_bh[i]);
mp->mp_bh[i] = NULL;
}
i = zmpl;
i = branch_start;
}
if (n == 0)
break;
Expand Down

0 comments on commit 7b2c501

Please sign in to comment.