From 462b728ea83fa85f1c0d2b79efb6187745444ce5 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 3 Dec 2021 17:18:11 -0500 Subject: 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 Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/inode-item.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fs/btrfs/inode-item.h') diff --git a/fs/btrfs/inode-item.h b/fs/btrfs/inode-item.h index 883e150f011a..7b5b455262cb 100644 --- a/fs/btrfs/inode-item.h +++ b/fs/btrfs/inode-item.h @@ -29,6 +29,9 @@ struct btrfs_truncate_control { /* OUT: the last size we truncated this inode to. */ u64 last_size; + /* OUT: the number of bytes to sub from this inode. */ + u64 sub_bytes; + /* * IN: minimum key type to remove. All key types with this type are * removed only if their offset >= new_size. -- cgit