The comparison was being made against the wrong quantity.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
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;
}