summaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorTim Smith <tim.smith@citrix.com>2019-03-06 07:00:43 -0700
committerBob Peterson <rpeterso@redhat.com>2019-03-06 07:00:43 -0700
commit7c03e756b449218b1bddf8e00a12ec7a6be62664 (patch)
tree01059d4dc4edb41cce2e25c7e4c22c90d47ccf7e /fs/gfs2
parent2abbf9a4d262511999ac11b4ddc8521c9ee72b88 (diff)
downloadlinux-7c03e756b449218b1bddf8e00a12ec7a6be62664.tar.bz2
gfs2: Fix an incorrect gfs2_assert()
When updating the inode information after a change in allocation, convert the change into the same units as the inode's i_blocks count before comparing it in an assertion. Also, change the comparison so that it is still possible to set i_blocks to zero by adding -i_blocks, something that was previously only possible because of the difference in units. Signed-off-by: Tim Smith <tim.smith@citrix.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/inode.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/gfs2/inode.h b/fs/gfs2/inode.h
index 793808263c6d..18d4af7417fa 100644
--- a/fs/gfs2/inode.h
+++ b/fs/gfs2/inode.h
@@ -59,8 +59,8 @@ static inline u64 gfs2_get_inode_blocks(const struct inode *inode)
static inline void gfs2_add_inode_blocks(struct inode *inode, s64 change)
{
- gfs2_assert(GFS2_SB(inode), (change >= 0 || inode->i_blocks > -change));
- change *= (GFS2_SB(inode)->sd_sb.sb_bsize/GFS2_BASIC_BLOCK);
+ change <<= inode->i_blkbits - GFS2_BASIC_BLOCK_SHIFT;
+ gfs2_assert(GFS2_SB(inode), (change >= 0 || inode->i_blocks >= -change));
inode->i_blocks += change;
}