The commit is pushed to "branch-rh9-5.14.0-427.44.1.vz9.104.x-ovz" and will appear at g...@bitbucket.org:openvz/vzkernel.git after rh9-5.14.0-427.44.1.vz9.104.1 ------> commit 393bbd9e658a73789312b3ad2e9622697f2a863e Author: Maxim V. Patlasov <mpatla...@parallels.com> Date: Tue Oct 5 18:42:36 2021 +0300
ext4: Teach statfs to report reduced disk usage The magic 9 in there came from 512 bytes - the i_blocks is accounted in these units in any case. (cherry picked from vz7 commit 4b10f27018d330d9e03e932a98a41a3e55da81fb) Signed-off-by: Konstantin Khorenko <khore...@virtuozzo.com> Signed-off-by: Kirill Tkhai <ktk...@virtuozzo.com> Feature: fs/ext4: fast online shrink support --- fs/ext4/super.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index c5aef54cc07b..f93fd231a459 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -6867,6 +6867,22 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf) sb_has_quota_limits_enabled(sb, PRJQUOTA)) ext4_statfs_project(sb, EXT4_I(dentry->d_inode)->i_projid, buf); #endif + + if (sbi->s_balloon_ino) { + struct ext4_inode_info *ei; + blkcnt_t balloon_blocks; + + balloon_blocks = sbi->s_balloon_ino->i_blocks; + ei = EXT4_I(sbi->s_balloon_ino); + spin_lock(&ei->i_block_reservation_lock); + balloon_blocks += ei->i_reserved_data_blocks; + spin_unlock(&ei->i_block_reservation_lock); + + BUG_ON(sbi->s_balloon_ino->i_blkbits < 9); + buf->f_blocks -= balloon_blocks >> + (sbi->s_balloon_ino->i_blkbits - 9); + } + return 0; } _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel