diff options
author | David Sterba <dsterba@suse.com> | 2023-11-30 23:42:01 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-12-15 22:59:01 +0100 |
commit | 637e6e0f50d20dcf2f37d62b3f9edf9567b69503 (patch) | |
tree | 7f2a599b4204a511f56e3684af9580697f79e2fc /fs/btrfs/extent-io-tree.c | |
parent | ed9b50a13edf442f5493603cc54f73bfc6eca1e9 (diff) | |
download | linux-637e6e0f50d20dcf2f37d62b3f9edf9567b69503.tar.gz linux-637e6e0f50d20dcf2f37d62b3f9edf9567b69503.tar.bz2 linux-637e6e0f50d20dcf2f37d62b3f9edf9567b69503.zip |
btrfs: allocate btrfs_inode::file_extent_tree only without NO_HOLES
The file_extent_tree was added in 41a2ee75aab0 ("btrfs: introduce
per-inode file extent tree") so we have an explicit mapping of the file
extents to know where it is safe to update i_size. When the feature
NO_HOLES is enabled, and it's been a mkfs default since 5.15, the tree
is not necessary.
To save some space in the inode, allocate the tree only when necessary.
This reduces size by 16 bytes from 1096 to 1080 on a x86_64 release
config.
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent-io-tree.c')
-rw-r--r-- | fs/btrfs/extent-io-tree.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c index dbd201a99693..e3ee5449cc4a 100644 --- a/fs/btrfs/extent-io-tree.c +++ b/fs/btrfs/extent-io-tree.c @@ -962,6 +962,8 @@ int find_contiguous_extent_bit(struct extent_io_tree *tree, u64 start, struct extent_state *state; int ret = 1; + ASSERT(!btrfs_fs_incompat(extent_io_tree_to_fs_info(tree), NO_HOLES)); + spin_lock(&tree->lock); state = find_first_extent_bit_state(tree, start, bits); if (state) { |