From c2ddb612a8b320dde8641a74c35e107aa496d5f3 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 3 Dec 2021 17:18:10 -0500 Subject: btrfs: only update i_size in truncate paths that care We currently will update the i_size of the inode as we truncate it down, however we skip this if we're calling btrfs_truncate_inode_items from the tree log code. However we also don't care about this in the case of evict. Instead keep track of this value in the btrfs_truncate_control and then have btrfs_truncate() and the free space cache truncate path both do the i_size update themselves. 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 beefba1f26bc..883e150f011a 100644 --- a/fs/btrfs/inode-item.h +++ b/fs/btrfs/inode-item.h @@ -26,6 +26,9 @@ struct btrfs_truncate_control { /* OUT: the number of extents truncated. */ u64 extents_found; + /* OUT: the last size we truncated this inode to. */ + u64 last_size; + /* * IN: minimum key type to remove. All key types with this type are * removed only if their offset >= new_size. -- cgit v1.2.3