summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTal Zussman <tz2294@columbia.edu>2026-10-15 10:43:30 -0400
committerDavid Sterba <dsterba@suse.com>2026-10-16 19:10:46 +0200
commit86ba02e70d841322c339adfdae328edbbba84545 (patch)
treee0c316ecbc15f083f77f6186c309de0812095596
parent557a72b63a018d3375b7d724897a65dd3a94367c (diff)
btrfs: stop special-casing free space inodes in the delalloc accounting
Free space inodes never have delalloc or outstanding extents any more, so they don't need to be kept off the root's delalloc inode list, out of the outstanding extents tracepoint, or exempt from the delalloc metadata release, which skipped the tree root since free space inodes are its only inodes with data. Assisted-by: LLM Signed-off-by: Tal Zussman <tz2294@columbia.edu> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/btrfs_inode.h2
-rw-r--r--fs/btrfs/inode.c13
2 files changed, 3 insertions, 12 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index d1c014da52a3..f7aa0d145185 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -409,8 +409,6 @@ static inline void btrfs_mod_outstanding_extents(struct btrfs_inode *inode,
{
lockdep_assert_held(&inode->lock);
inode->outstanding_extents += mod;
- if (btrfs_is_free_space_inode(inode))
- return;
trace_btrfs_inode_mod_outstanding_extents(inode->root, btrfs_ino(inode),
mod, inode->outstanding_extents);
}
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3fa632a6c920..fd8962000096 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2632,7 +2632,7 @@ void btrfs_set_delalloc_extent(struct btrfs_inode *inode, struct extent_state *s
* and are therefore protected against concurrent calls of this
* function and btrfs_clear_delalloc_extent().
*/
- if (!btrfs_is_free_space_inode(inode) && prev_delalloc_bytes == 0)
+ if (prev_delalloc_bytes == 0)
btrfs_add_delalloc_inode(inode);
}
@@ -2676,13 +2676,7 @@ void btrfs_clear_delalloc_extent(struct btrfs_inode *inode,
btrfs_mod_outstanding_extents(inode, -num_extents);
spin_unlock(&inode->lock);
- /*
- * We don't reserve metadata space for space cache inodes so we
- * don't need to call delalloc_release_metadata if there is an
- * error.
- */
- if (bits & EXTENT_CLEAR_META_RESV &&
- root != fs_info->tree_root)
+ if (bits & EXTENT_CLEAR_META_RESV)
btrfs_delalloc_release_metadata(inode, len, true);
/* For sanity tests. */
@@ -2690,7 +2684,6 @@ void btrfs_clear_delalloc_extent(struct btrfs_inode *inode,
return;
if (!btrfs_is_data_reloc_root(root) &&
- !btrfs_is_free_space_inode(inode) &&
!(state->state & EXTENT_NORESERVE) &&
(bits & EXTENT_CLEAR_DATA_RESV))
btrfs_free_reserved_data_space_noquota(inode, len);
@@ -2708,7 +2701,7 @@ void btrfs_clear_delalloc_extent(struct btrfs_inode *inode,
* and are therefore protected against concurrent calls of this
* function and btrfs_set_delalloc_extent().
*/
- if (!btrfs_is_free_space_inode(inode) && new_delalloc_bytes == 0) {
+ if (new_delalloc_bytes == 0) {
spin_lock(&root->delalloc_lock);
btrfs_del_delalloc_inode(inode);
spin_unlock(&root->delalloc_lock);