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>
This commit is contained in:
Tal Zussman 2026-10-15 10:43:30 -04:00 committed by David Sterba
parent 557a72b63a
commit 86ba02e70d
2 changed files with 3 additions and 12 deletions

View File

@ -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);
}

View File

@ -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);