]> git.hungrycats.org Git - linux/commitdiff
btrfs: remove BTRFS_RESERVE_FLUSH_FREE_SPACE_INODE
authorTal Zussman <tz2294@columbia.edu>
Thu, 17 Sep 2026 04:00:08 +0000 (00:00 -0400)
committerDavid Sterba <dsterba@suse.com>
Thu, 17 Sep 2026 17:49:48 +0000 (19:49 +0200)
Free space inodes no longer reserve data or delalloc space, as nothing
writes to them. Remove the flush mode and the special cases that
selected it.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/delalloc-space.c
fs/btrfs/space-info.c
fs/btrfs/space-info.h

index d357ed7efd99bdb70502070ddb5b4361cca4a450..77781852e417823432c004cb53881a6e37b564b9 100644 (file)
@@ -132,9 +132,7 @@ int btrfs_alloc_data_chunk_ondemand(const struct btrfs_inode *inode, u64 bytes)
        /* Make sure bytes are sectorsize aligned */
        bytes = ALIGN(bytes, fs_info->sectorsize);
 
-       if (btrfs_is_free_space_inode(inode))
-               flush = BTRFS_RESERVE_FLUSH_FREE_SPACE_INODE;
-       else if (btrfs_is_zoned(fs_info) && btrfs_is_data_reloc_root(root))
+       if (btrfs_is_zoned(fs_info) && btrfs_is_data_reloc_root(root))
                flush = BTRFS_RESERVE_FLUSH_ZONED_RELOCATION;
 
        return btrfs_reserve_data_bytes(data_sinfo_for_inode(inode), bytes, flush);
@@ -155,8 +153,6 @@ int btrfs_check_data_free_space(struct btrfs_inode *inode,
 
        if (noflush)
                flush = BTRFS_RESERVE_NO_FLUSH;
-       else if (btrfs_is_free_space_inode(inode))
-               flush = BTRFS_RESERVE_FLUSH_FREE_SPACE_INODE;
 
        ret = btrfs_reserve_data_bytes(data_sinfo_for_inode(inode), len, flush);
        if (ret < 0)
@@ -326,15 +322,10 @@ int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes,
        int ret = 0;
 
        /*
-        * If we are a free space inode we need to not flush since we will be in
-        * the middle of a transaction commit.  We also don't need the delalloc
-        * mutex since we won't race with anybody.  We need this mostly to make
-        * lockdep shut its filthy mouth.
-        *
         * If we have a transaction open (can happen if we call truncate_block
         * from truncate), then we need FLUSH_LIMIT so we don't deadlock.
         */
-       if (noflush || btrfs_is_free_space_inode(inode)) {
+       if (noflush) {
                flush = BTRFS_RESERVE_NO_FLUSH;
        } else {
                if (current->journal_info)
index 39a28e1bec8ad85c17028940aaf5ca08d7d2f671..01018152c054b0ea2a7d479fbf8a2d7d0ad1ee0f 100644 (file)
@@ -1704,7 +1704,6 @@ static int handle_reserve_ticket(struct btrfs_space_info *space_info,
                                                evict_flush_states,
                                                ARRAY_SIZE(evict_flush_states));
                break;
-       case BTRFS_RESERVE_FLUSH_FREE_SPACE_INODE:
        case BTRFS_RESERVE_FLUSH_ZONED_RELOCATION:
                priority_reclaim_data_space(space_info, ticket);
                break;
@@ -1968,7 +1967,6 @@ int btrfs_reserve_data_bytes(struct btrfs_space_info *space_info, u64 bytes,
        int ret;
 
        ASSERT(flush == BTRFS_RESERVE_FLUSH_DATA ||
-              flush == BTRFS_RESERVE_FLUSH_FREE_SPACE_INODE ||
               flush == BTRFS_RESERVE_FLUSH_ZONED_RELOCATION ||
               flush == BTRFS_RESERVE_NO_FLUSH, "flush=%d", flush);
        ASSERT(!current->journal_info || flush != BTRFS_RESERVE_FLUSH_DATA,
index aa836e8a9d4a6f2f7e491de411f26b30b8ecb271..d0130c8ba3ddafc9cd62678845e004c189e1dabb 100644 (file)
@@ -66,7 +66,6 @@ enum btrfs_reserve_flush_enum {
         * Can be interrupted by a fatal signal.
         */
        BTRFS_RESERVE_FLUSH_DATA,
-       BTRFS_RESERVE_FLUSH_FREE_SPACE_INODE,
        BTRFS_RESERVE_FLUSH_ALL,
 
        /*
@@ -82,9 +81,6 @@ enum btrfs_reserve_flush_enum {
         * priority flushing for this, because otherwise we can deadlock on
         * waiting for a ticket, that cannot be granted, because we cannot do
         * any allocations.
-        *
-        * Apart from being specific to zoned relocation, it is equal to
-        * BTRFS_FLUSH_FREE_SPACE_INODE.
         */
        BTRFS_RESERVE_FLUSH_ZONED_RELOCATION,