summaryrefslogtreecommitdiff
path: root/fs/btrfs/inode-item.h
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2021-12-04 01:18:11 +0300
committerDavid Sterba <dsterba@suse.com>2022-01-07 16:18:24 +0300
commit462b728ea83fa85f1c0d2b79efb6187745444ce5 (patch)
treee97daadf86d3bfc35957fa077c580470f6ebbce5 /fs/btrfs/inode-item.h
parentc2ddb612a8b320dde8641a74c35e107aa496d5f3 (diff)
downloadlinux-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-item.h')
-rw-r--r--fs/btrfs/inode-item.h3
1 files changed, 3 insertions, 0 deletions
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.