Commit 1af53572 authored by Steven Whitehouse's avatar Steven Whitehouse

[GFS2] Fix write alloc required shortcut calculation

The comparison was being made against the wrong quantity.
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 05220535
...@@ -1222,10 +1222,10 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset, ...@@ -1222,10 +1222,10 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
do_div(lblock_stop, bsize); do_div(lblock_stop, bsize);
} else { } else {
unsigned int shift = sdp->sd_sb.sb_bsize_shift; 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 = offset >> shift;
lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift; lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
if (lblock_stop > ip->i_di.di_blocks) { /* writing past the if (lblock_stop > end_of_file) {
last block */
*alloc_required = 1; *alloc_required = 1;
return 0; return 0;
} }
......
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