aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2021-12-03 17:18:11 -0500
committerDavid Sterba <dsterba@suse.com>2022-01-07 14:18:24 +0100
commit462b728ea83fa85f1c0d2b79efb6187745444ce5 (patch)
treee97daadf86d3bfc35957fa077c580470f6ebbce5 /fs/btrfs/inode.c
parentbtrfs: only update i_size in truncate paths that care (diff)
downloadlinux-dev-462b728ea83fa85f1c0d2b79efb6187745444ce5.tar.xz
linux-dev-462b728ea83fa85f1c0d2b79efb6187745444ce5.zip
btrfs: only call inode_sub_bytes in truncate paths that care
We currently have a bunch of awkward checks to make sure we only update the inode i_bytes if we're truncating the real inode. Instead keep track of the number of bytes we need to sub in the btrfs_truncate_control, and then do the appropriate adjustment in the truncate paths that care. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index f653242e3c19..38f974b16fc0 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8621,6 +8621,7 @@ static int btrfs_truncate(struct inode *inode, bool skip_writeback)
ret = btrfs_truncate_inode_items(trans, root, BTRFS_I(inode),
&control);
+ inode_sub_bytes(inode, control.sub_bytes);
btrfs_inode_safe_disk_i_size_write(BTRFS_I(inode), control.last_size);
unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start,