X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=fs%2Fgfs2%2Fbmap.c;h=e4effc47abfc865f82f71b6855f06521253c25b5;hb=00f5e06c032507206c4ac0c846ad82b75ae7665b;hp=4356cc2fb3f5cca827a4b290c1e6871e8fe44bbe;hpb=05220535196d413db434527a3edcba79b7187df8;p=linux-2.6-omap-h63xx.git diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 4356cc2fb3f..e4effc47abf 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -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; }