Commit 035cfc61 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes

* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes:
  [GFS2] fix gfs2 block allocation (cleaned up)
  [GFS2] BUG: unable to handle kernel paging request at ffff81002690e000
parents 919c0d14 5af4e7a0
...@@ -246,15 +246,11 @@ static void find_metapath(const struct gfs2_sbd *sdp, u64 block, ...@@ -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, static inline unsigned int metapath_branch_start(const struct metapath *mp)
unsigned height)
{ {
unsigned int i; if (mp->mp_list[0] == 0)
for (i = 0; i < height - 1; i++) { return 2;
if (mp->mp_list[i] != 0) return 1;
return i;
}
return height;
} }
/** /**
...@@ -436,7 +432,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, ...@@ -436,7 +432,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
struct gfs2_sbd *sdp = GFS2_SB(inode); struct gfs2_sbd *sdp = GFS2_SB(inode);
struct buffer_head *dibh = mp->mp_bh[0]; struct buffer_head *dibh = mp->mp_bh[0];
u64 bn, dblock = 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 dblks = 0;
unsigned ptrs_per_blk; unsigned ptrs_per_blk;
const unsigned end_of_metadata = height - 1; const unsigned end_of_metadata = height - 1;
...@@ -471,9 +467,8 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, ...@@ -471,9 +467,8 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
/* Building up tree height */ /* Building up tree height */
state = ALLOC_GROW_HEIGHT; state = ALLOC_GROW_HEIGHT;
iblks = height - ip->i_height; iblks = height - ip->i_height;
zmpl = zero_metapath_length(mp, height); branch_start = metapath_branch_start(mp);
iblks -= zmpl; iblks += (height - branch_start);
iblks += height;
} }
} }
...@@ -509,13 +504,13 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, ...@@ -509,13 +504,13 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
sizeof(struct gfs2_meta_header)); sizeof(struct gfs2_meta_header));
*ptr = zero_bn; *ptr = zero_bn;
state = ALLOC_GROW_DEPTH; state = ALLOC_GROW_DEPTH;
for(i = zmpl; i < height; i++) { for(i = branch_start; i < height; i++) {
if (mp->mp_bh[i] == NULL) if (mp->mp_bh[i] == NULL)
break; break;
brelse(mp->mp_bh[i]); brelse(mp->mp_bh[i]);
mp->mp_bh[i] = NULL; mp->mp_bh[i] = NULL;
} }
i = zmpl; i = branch_start;
} }
if (n == 0) if (n == 0)
break; break;
......
...@@ -195,7 +195,7 @@ static u32 gfs2_bitfit(const u8 *buffer, unsigned int buflen, u32 goal, ...@@ -195,7 +195,7 @@ static u32 gfs2_bitfit(const u8 *buffer, unsigned int buflen, u32 goal,
depending on architecture. I've experimented with several ways depending on architecture. I've experimented with several ways
of writing this section such as using an else before the goto of writing this section such as using an else before the goto
but this one seems to be the fastest. */ but this one seems to be the fastest. */
while ((unsigned char *)plong < end - 1) { while ((unsigned char *)plong < end - sizeof(unsigned long)) {
prefetch(plong + 1); prefetch(plong + 1);
if (((*plong) & LBITMASK) != lskipval) if (((*plong) & LBITMASK) != lskipval)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment