btrfs: remove EXTENT_UPTODATE io tree flag
authorFilipe Manana <fdmanana@suse.com>
Fri, 28 Mar 2025 12:26:59 +0000 (12:26 +0000)
committerDavid Sterba <dsterba@suse.com>
Thu, 15 May 2025 12:30:39 +0000 (14:30 +0200)
The EXTENT_UPTODATE io tree flag is now used only to mark ranges in the
fs_info->excluded_extents as used by super blocks and not available for
extent allocation (to prevent adding those ranges as free space in the
in memory space caches). As we can use any flag for that purpose, and
we are using EXTENT_DIRTY for the pinned extents io tree for example,
remove the EXTENT_UPTODATE flag and use instead EXTENT_DIRTY for the
excluded extents io tree.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c
fs/btrfs/extent-io-tree.h
fs/btrfs/tests/extent-io-tests.c
include/trace/events/btrfs.h

index 8a02375f27e82cbe341f105e36b5b7aabf741c58..a38578c60f34e60ca1ea841a61dede352808b705 100644 (file)
@@ -527,7 +527,7 @@ int btrfs_add_new_free_space(struct btrfs_block_group *block_group, u64 start,
        while (start < end) {
                if (!find_first_extent_bit(&info->excluded_extents, start,
                                           &extent_start, &extent_end,
-                                          EXTENT_UPTODATE, NULL))
+                                          EXTENT_DIRTY, NULL))
                        break;
 
                if (extent_start <= start) {
@@ -834,7 +834,7 @@ out:
 static inline void btrfs_free_excluded_extents(const struct btrfs_block_group *bg)
 {
        clear_extent_bits(&bg->fs_info->excluded_extents, bg->start,
-                         bg->start + bg->length - 1, EXTENT_UPTODATE);
+                         bg->start + bg->length - 1, EXTENT_DIRTY);
 }
 
 static noinline void caching_thread(struct btrfs_work *work)
@@ -2219,7 +2219,7 @@ static int exclude_super_stripes(struct btrfs_block_group *cache)
                cache->bytes_super += stripe_len;
                ret = set_extent_bit(&fs_info->excluded_extents, cache->start,
                                     cache->start + stripe_len - 1,
-                                    EXTENT_UPTODATE, NULL);
+                                    EXTENT_DIRTY, NULL);
                if (ret)
                        return ret;
        }
@@ -2247,7 +2247,7 @@ static int exclude_super_stripes(struct btrfs_block_group *cache)
                        cache->bytes_super += len;
                        ret = set_extent_bit(&fs_info->excluded_extents, logical[nr],
                                             logical[nr] + len - 1,
-                                            EXTENT_UPTODATE, NULL);
+                                            EXTENT_DIRTY, NULL);
                        if (ret) {
                                kfree(logical);
                                return ret;
index 673af5ece25ebc14a95308aeff341ba3ea93719b..2bb74cc86f52e2461e0d0c0ff27dfd5f8f8424c1 100644 (file)
@@ -17,7 +17,6 @@ struct btrfs_inode;
 /* Bits for the extent state */
 enum {
        ENUM_BIT(EXTENT_DIRTY),
-       ENUM_BIT(EXTENT_UPTODATE),
        ENUM_BIT(EXTENT_LOCKED),
        ENUM_BIT(EXTENT_DIO_LOCKED),
        ENUM_BIT(EXTENT_NEW),
index 74aca7180a5a91678a597f6d04a8e1cd5c34d386..8773758a8cc7d2196822907f08309e7383d9b636 100644 (file)
@@ -74,7 +74,6 @@ static void extent_flag_to_str(const struct extent_state *state, char *dest)
 
        dest[0] = 0;
        PRINT_ONE_FLAG(state, dest, cur, DIRTY);
-       PRINT_ONE_FLAG(state, dest, cur, UPTODATE);
        PRINT_ONE_FLAG(state, dest, cur, LOCKED);
        PRINT_ONE_FLAG(state, dest, cur, NEW);
        PRINT_ONE_FLAG(state, dest, cur, DELALLOC);
index 3efc00cc1bcd29f7ee6e1ce66e454fce49e34467..13bd5f36a468df5840ddb67e7a534f817b0b5435 100644 (file)
@@ -143,7 +143,6 @@ FLUSH_STATES
 
 #define EXTENT_FLAGS                                           \
        { EXTENT_DIRTY,                 "DIRTY"},               \
-       { EXTENT_UPTODATE,              "UPTODATE"},            \
        { EXTENT_LOCKED,                "LOCKED"},              \
        { EXTENT_NEW,                   "NEW"},                 \
        { EXTENT_DELALLOC,              "DELALLOC"},            \