]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
gfs2: Fix an incorrect gfs2_assert()
authorTim Smith <tim.smith@citrix.com>
Wed, 6 Mar 2019 14:00:43 +0000 (07:00 -0700)
committerBob Peterson <rpeterso@redhat.com>
Wed, 6 Mar 2019 14:00:43 +0000 (07:00 -0700)
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>
fs/gfs2/inode.h

index 793808263c6d7b7b5c801578628d303b0121bd2c..18d4af7417fa34df7e548dc72ea0d0849794de1f 100644 (file)
@@ -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;
 }