btrfs: remove now unneeded btrfs_redirty_list_add
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Thu, 23 Nov 2023 15:47:17 +0000 (07:47 -0800)
committerDavid Sterba <dsterba@suse.com>
Fri, 15 Dec 2023 19:27:03 +0000 (20:27 +0100)
Now that we're not clearing the dirty flag off of extent_buffers in zoned mode,
all that is left of btrfs_redirty_list_add() is a memzero() and some
ASSERT()ions.

As we're also memzero()ing the buffer on write-out btrfs_redirty_list_add()
has become obsolete and can be removed.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c
fs/btrfs/tree-log.c
fs/btrfs/zoned.c
fs/btrfs/zoned.h

index 1f48c7e..99f9876 100644 (file)
@@ -3466,10 +3466,8 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
 
                if (root_id != BTRFS_TREE_LOG_OBJECTID) {
                        ret = check_ref_cleanup(trans, buf->start);
-                       if (!ret) {
-                               btrfs_redirty_list_add(trans->transaction, buf);
+                       if (!ret)
                                goto out;
-                       }
                }
 
                cache = btrfs_lookup_block_group(fs_info, buf->start);
@@ -3500,7 +3498,6 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
                        must_pin = true;
 
                if (must_pin || btrfs_is_zoned(fs_info)) {
-                       btrfs_redirty_list_add(trans->transaction, buf);
                        pin_down_extent(trans, cache, buf->start, buf->len, 1);
                        btrfs_put_block_group(cache);
                        goto out;
index 7d6729d..bee0658 100644 (file)
@@ -2575,7 +2575,6 @@ static int clean_log_buffer(struct btrfs_trans_handle *trans,
                ret = btrfs_pin_reserved_extent(trans, eb);
                if (ret)
                        return ret;
-               btrfs_redirty_list_add(trans->transaction, eb);
        } else {
                unaccount_log_buffer(eb->fs_info, eb->start);
        }
index 2c7fe66..910841b 100644 (file)
@@ -1706,23 +1706,6 @@ void btrfs_calc_zone_unusable(struct btrfs_block_group *cache)
        cache->zone_unusable = unusable;
 }
 
-void btrfs_redirty_list_add(struct btrfs_transaction *trans,
-                           struct extent_buffer *eb)
-{
-       if (!btrfs_is_zoned(eb->fs_info) ||
-           btrfs_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN))
-               return;
-
-       ASSERT(test_bit(EXTENT_BUFFER_DIRTY, &eb->bflags));
-       ASSERT(test_bit(EXTENT_BUFFER_ZONED_ZEROOUT, &eb->bflags));
-
-       memzero_extent_buffer(eb, 0, eb->len);
-       set_bit(EXTENT_BUFFER_ZONED_ZEROOUT, &eb->bflags);
-       set_extent_buffer_dirty(eb);
-       set_extent_bit(&trans->dirty_pages, eb->start, eb->start + eb->len - 1,
-                       EXTENT_DIRTY, NULL);
-}
-
 bool btrfs_use_zone_append(struct btrfs_bio *bbio)
 {
        u64 start = (bbio->bio.bi_iter.bi_sector << SECTOR_SHIFT);
index b9cec52..7bfe1d6 100644 (file)
@@ -59,8 +59,6 @@ int btrfs_reset_device_zone(struct btrfs_device *device, u64 physical,
 int btrfs_ensure_empty_zones(struct btrfs_device *device, u64 start, u64 size);
 int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new);
 void btrfs_calc_zone_unusable(struct btrfs_block_group *cache);
-void btrfs_redirty_list_add(struct btrfs_transaction *trans,
-                           struct extent_buffer *eb);
 bool btrfs_use_zone_append(struct btrfs_bio *bbio);
 void btrfs_record_physical_zoned(struct btrfs_bio *bbio);
 int btrfs_check_meta_write_pointer(struct btrfs_fs_info *fs_info,
@@ -180,9 +178,6 @@ static inline int btrfs_load_block_group_zone_info(
 
 static inline void btrfs_calc_zone_unusable(struct btrfs_block_group *cache) { }
 
-static inline void btrfs_redirty_list_add(struct btrfs_transaction *trans,
-                                         struct extent_buffer *eb) { }
-
 static inline bool btrfs_use_zone_append(struct btrfs_bio *bbio)
 {
        return false;