Skip to content

Commit

Permalink
[GFS2] Fix write alloc required shortcut calculation
Browse files Browse the repository at this point in the history
The comparison was being made against the wrong quantity.

Signed-off-by: Steven Whitehouse <[email protected]>
  • Loading branch information
swhiteho committed Jan 25, 2008
1 parent 0522053 commit 1af5357
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/gfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,10 +1222,10 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
do_div(lblock_stop, bsize);
} else {
unsigned int shift = sdp->sd_sb.sb_bsize_shift;
u64 end_of_file = (ip->i_di.di_size + sdp->sd_sb.sb_bsize - 1) >> shift;
lblock = offset >> shift;
lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
if (lblock_stop > ip->i_di.di_blocks) { /* writing past the
last block */
if (lblock_stop > end_of_file) {
*alloc_required = 1;
return 0;
}
Expand Down

0 comments on commit 1af5357

Please sign in to comment.