diff options
author | Josef Bacik <josef@toxicpanda.com> | 2021-12-04 01:18:10 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-01-07 16:18:24 +0300 |
commit | c2ddb612a8b320dde8641a74c35e107aa496d5f3 (patch) | |
tree | 77fc91acdf9b46ed29462609a5dffe677ebc1762 /fs/btrfs/free-space-cache.c | |
parent | d9ac19c3806434af2a92b4008dbf39c2a67c60cf (diff) | |
download | linux-c2ddb612a8b320dde8641a74c35e107aa496d5f3.tar.xz |
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 <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/free-space-cache.c')
-rw-r--r-- | fs/btrfs/free-space-cache.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index a05dd3d29695..fd469beb0985 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -338,6 +338,9 @@ int btrfs_truncate_free_space_cache(struct btrfs_trans_handle *trans, * need to check for -EAGAIN. */ ret = btrfs_truncate_inode_items(trans, root, inode, &control); + + btrfs_inode_safe_disk_i_size_write(inode, control.last_size); + unlock_extent_cached(&inode->io_tree, 0, (u64)-1, &cached_state); if (ret) goto fail; |