diff options
author | Josef Bacik <josef@toxicpanda.com> | 2021-12-04 01:18:11 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-01-07 16:18:24 +0300 |
commit | 462b728ea83fa85f1c0d2b79efb6187745444ce5 (patch) | |
tree | e97daadf86d3bfc35957fa077c580470f6ebbce5 /fs/btrfs/inode.c | |
parent | c2ddb612a8b320dde8641a74c35e107aa496d5f3 (diff) | |
download | linux-462b728ea83fa85f1c0d2b79efb6187745444ce5.tar.xz |
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.c | 1 |
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, |