The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove EXTENT_BUFFER_IN_TREE flag
@ 2025-03-18  9:54 Daniel Vacek
  2025-03-18 15:45 ` David Sterba
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Daniel Vacek @ 2025-03-18  9:54 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba
  Cc: Daniel Vacek, linux-btrfs, linux-kernel

This flag is set after inserting the eb to the buffer tree and cleared on
it's removal. But it does not bring any added value. Just kill it for good.

Signed-off-by: Daniel Vacek <neelx@suse.com>
---
 fs/btrfs/extent_io.c | 18 ++++++------------
 fs/btrfs/extent_io.h |  1 -
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index b168dc354f20b..864bdffaa1123 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3048,7 +3048,6 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
 			goto again;
 	}
 	check_buffer_tree_ref(eb);
-	set_bit(EXTENT_BUFFER_IN_TREE, &eb->bflags);
 
 	return eb;
 free_eb:
@@ -3368,7 +3367,6 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
 	}
 	/* add one reference for the tree */
 	check_buffer_tree_ref(eb);
-	set_bit(EXTENT_BUFFER_IN_TREE, &eb->bflags);
 
 	/*
 	 * Now it's safe to unlock the pages because any calls to
@@ -3432,18 +3430,14 @@ static int release_extent_buffer(struct extent_buffer *eb)
 
 	WARN_ON(atomic_read(&eb->refs) == 0);
 	if (atomic_dec_and_test(&eb->refs)) {
-		if (test_and_clear_bit(EXTENT_BUFFER_IN_TREE, &eb->bflags)) {
-			struct btrfs_fs_info *fs_info = eb->fs_info;
+		struct btrfs_fs_info *fs_info = eb->fs_info;
 
-			spin_unlock(&eb->refs_lock);
+		spin_unlock(&eb->refs_lock);
 
-			spin_lock(&fs_info->buffer_lock);
-			radix_tree_delete(&fs_info->buffer_radix,
-					  eb->start >> fs_info->sectorsize_bits);
-			spin_unlock(&fs_info->buffer_lock);
-		} else {
-			spin_unlock(&eb->refs_lock);
-		}
+		spin_lock(&fs_info->buffer_lock);
+		radix_tree_delete_item(&fs_info->buffer_radix,
+				       eb->start >> fs_info->sectorsize_bits, eb);
+		spin_unlock(&fs_info->buffer_lock);
 
 		btrfs_leak_debug_del_eb(eb);
 		/* Should be safe to release folios at this point. */
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 2e261892c7bc7..9cfb1e8f9b42d 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -47,7 +47,6 @@ enum {
 	/* read IO error */
 	EXTENT_BUFFER_READ_ERR,
 	EXTENT_BUFFER_UNMAPPED,
-	EXTENT_BUFFER_IN_TREE,
 	/* write IO error */
 	EXTENT_BUFFER_WRITE_ERR,
 	/* Indicate the extent buffer is written zeroed out (for zoned) */
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-03-27 18:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18  9:54 [PATCH] btrfs: remove EXTENT_BUFFER_IN_TREE flag Daniel Vacek
2025-03-18 15:45 ` David Sterba
2025-03-18 17:07   ` Daniel Vacek
2025-03-18 17:16     ` David Sterba
2025-03-18 16:00 ` David Sterba
2025-03-18 16:04   ` David Sterba
2025-03-18 17:08     ` Daniel Vacek
2025-03-27 18:01 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox