mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] btrfs: extent buffer flags cleanup
@ 2025-03-25 16:31 Daniel Vacek
  2025-03-25 16:31 ` [PATCH 1/3] btrfs: cleanup EXTENT_BUFFER_READ_ERR flag Daniel Vacek
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Daniel Vacek @ 2025-03-25 16:31 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba
  Cc: Daniel Vacek, linux-btrfs, linux-kernel

There are a few leftover extent buffer flags not being meaningfully used
anymore for some time. Simply clean them up.

Daniel Vacek (3):
  btrfs: cleanup EXTENT_BUFFER_READ_ERR flag
  btrfs: cleanup EXTENT_BUFFER_READAHEAD flag
  btrfs: cleanup EXTENT_BUFFER_CORRUPT flag

 fs/btrfs/disk-io.c     | 11 ++---------
 fs/btrfs/extent-tree.c |  6 ------
 fs/btrfs/extent_io.c   |  7 ++-----
 fs/btrfs/extent_io.h   |  5 -----
 4 files changed, 4 insertions(+), 25 deletions(-)

-- 
2.47.2


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

* [PATCH 1/3] btrfs: cleanup EXTENT_BUFFER_READ_ERR flag
  2025-03-25 16:31 [PATCH 0/3] btrfs: extent buffer flags cleanup Daniel Vacek
@ 2025-03-25 16:31 ` Daniel Vacek
  2025-03-25 16:31 ` [PATCH 2/3] btrfs: cleanup EXTENT_BUFFER_READAHEAD flag Daniel Vacek
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Vacek @ 2025-03-25 16:31 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba
  Cc: Daniel Vacek, linux-btrfs, linux-kernel

This flag was added by commit 656f30dba7ab ("Btrfs: be aware of btree inode
write errors to avoid fs corruption") but it stopped being used after commit
046b562b20a5 ("btrfs: use a separate end_io handler for read_extent_buffer").

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

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index b168dc354f20b..578195959f7cb 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3651,12 +3651,10 @@ static void end_bbio_meta_read(struct btrfs_bio *bbio)
 	    btrfs_validate_extent_buffer(eb, &bbio->parent_check) < 0)
 		uptodate = false;
 
-	if (uptodate) {
+	if (uptodate)
 		set_extent_buffer_uptodate(eb);
-	} else {
+	else
 		clear_extent_buffer_uptodate(eb);
-		set_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags);
-	}
 
 	clear_extent_buffer_reading(eb);
 	free_extent_buffer(eb);
@@ -3695,7 +3693,6 @@ int read_extent_buffer_pages_nowait(struct extent_buffer *eb, int mirror_num,
 		return 0;
 	}
 
-	clear_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags);
 	eb->read_mirror = 0;
 	check_buffer_tree_ref(eb);
 	atomic_inc(&eb->refs);
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 2e261892c7bc7..fb3f5815b28e7 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -44,8 +44,6 @@ enum {
 	EXTENT_BUFFER_TREE_REF,
 	EXTENT_BUFFER_STALE,
 	EXTENT_BUFFER_WRITEBACK,
-	/* read IO error */
-	EXTENT_BUFFER_READ_ERR,
 	EXTENT_BUFFER_UNMAPPED,
 	EXTENT_BUFFER_IN_TREE,
 	/* write IO error */
-- 
2.47.2


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

* [PATCH 2/3] btrfs: cleanup EXTENT_BUFFER_READAHEAD flag
  2025-03-25 16:31 [PATCH 0/3] btrfs: extent buffer flags cleanup Daniel Vacek
  2025-03-25 16:31 ` [PATCH 1/3] btrfs: cleanup EXTENT_BUFFER_READ_ERR flag Daniel Vacek
@ 2025-03-25 16:31 ` Daniel Vacek
  2025-03-25 16:31 ` [PATCH 3/3] btrfs: cleanup EXTENT_BUFFER_CORRUPT flag Daniel Vacek
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Vacek @ 2025-03-25 16:31 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba
  Cc: Daniel Vacek, linux-btrfs, linux-kernel

This flag is no longer being used. Remove it.

It was added by commit ab0fff03055d ("btrfs: add READAHEAD extent buffer flag")
and used in commits:

79fb65a1f6d9 ("Btrfs: don't call readahead hook until we have read the entire eb")
78e62c02abb9 ("btrfs: Remove extent_io_ops::readpage_io_failed_hook")
371cdc0700c7 ("btrfs: introduce subpage metadata validation check")

Finally all the code using it was removed by commit f26c92386028 ("btrfs: remove
reada infrastructure").

Signed-off-by: Daniel Vacek <neelx@suse.com>
---
 fs/btrfs/extent_io.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index fb3f5815b28e7..d0b3526749aa2 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -39,8 +39,6 @@ enum {
 	EXTENT_BUFFER_UPTODATE,
 	EXTENT_BUFFER_DIRTY,
 	EXTENT_BUFFER_CORRUPT,
-	/* this got triggered by readahead */
-	EXTENT_BUFFER_READAHEAD,
 	EXTENT_BUFFER_TREE_REF,
 	EXTENT_BUFFER_STALE,
 	EXTENT_BUFFER_WRITEBACK,
-- 
2.47.2


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

* [PATCH 3/3] btrfs: cleanup EXTENT_BUFFER_CORRUPT flag
  2025-03-25 16:31 [PATCH 0/3] btrfs: extent buffer flags cleanup Daniel Vacek
  2025-03-25 16:31 ` [PATCH 1/3] btrfs: cleanup EXTENT_BUFFER_READ_ERR flag Daniel Vacek
  2025-03-25 16:31 ` [PATCH 2/3] btrfs: cleanup EXTENT_BUFFER_READAHEAD flag Daniel Vacek
@ 2025-03-25 16:31 ` Daniel Vacek
  2025-03-25 21:36 ` [PATCH 0/3] btrfs: extent buffer flags cleanup Qu Wenruo
  2025-03-27 16:58 ` David Sterba
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Vacek @ 2025-03-25 16:31 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba
  Cc: Daniel Vacek, linux-btrfs, linux-kernel

This flag is no longer being used. Remove it.

It was added by commit a826d6dcb32d ("Btrfs: check items for correctness as
we search") but it's no longer being used after commit f26c92386028 ("btrfs:
remove reada infrastructure").

Signed-off-by: Daniel Vacek <neelx@suse.com>
---
 fs/btrfs/disk-io.c     | 11 ++---------
 fs/btrfs/extent-tree.c |  6 ------
 fs/btrfs/extent_io.h   |  1 -
 3 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 1a916716cefeb..6303d4dda8725 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -224,7 +224,6 @@ int btrfs_read_extent_buffer(struct extent_buffer *eb,
 	ASSERT(check);
 
 	while (1) {
-		clear_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags);
 		ret = read_extent_buffer_pages(eb, mirror_num, check);
 		if (!ret)
 			break;
@@ -452,15 +451,9 @@ int btrfs_validate_extent_buffer(struct extent_buffer *eb,
 			goto out;
 	}
 
-	/*
-	 * If this is a leaf block and it is corrupt, set the corrupt bit so
-	 * that we don't try and read the other copies of this block, just
-	 * return -EIO.
-	 */
-	if (found_level == 0 && btrfs_check_leaf(eb)) {
-		set_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags);
+	/* If this is a leaf block and it is corrupt, just return -EIO. */
+	if (found_level == 0 && btrfs_check_leaf(eb))
 		ret = -EIO;
-	}
 
 	if (found_level > 0 && btrfs_check_node(eb))
 		ret = -EIO;
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 957230abd8271..47db37b7236d3 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3488,12 +3488,6 @@ int btrfs_free_tree_block(struct btrfs_trans_handle *trans,
 	trace_btrfs_reserved_extent_free(fs_info, buf->start, buf->len);
 
 out:
-
-	/*
-	 * Deleting the buffer, clear the corrupt flag since it doesn't
-	 * matter anymore.
-	 */
-	clear_bit(EXTENT_BUFFER_CORRUPT, &buf->bflags);
 	return 0;
 }
 
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index d0b3526749aa2..c74e4a07d0ad1 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -38,7 +38,6 @@ struct btrfs_tree_parent_check;
 enum {
 	EXTENT_BUFFER_UPTODATE,
 	EXTENT_BUFFER_DIRTY,
-	EXTENT_BUFFER_CORRUPT,
 	EXTENT_BUFFER_TREE_REF,
 	EXTENT_BUFFER_STALE,
 	EXTENT_BUFFER_WRITEBACK,
-- 
2.47.2


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

* Re: [PATCH 0/3] btrfs: extent buffer flags cleanup
  2025-03-25 16:31 [PATCH 0/3] btrfs: extent buffer flags cleanup Daniel Vacek
                   ` (2 preceding siblings ...)
  2025-03-25 16:31 ` [PATCH 3/3] btrfs: cleanup EXTENT_BUFFER_CORRUPT flag Daniel Vacek
@ 2025-03-25 21:36 ` Qu Wenruo
  2025-03-27 16:58 ` David Sterba
  4 siblings, 0 replies; 6+ messages in thread
From: Qu Wenruo @ 2025-03-25 21:36 UTC (permalink / raw)
  To: Daniel Vacek, Chris Mason, Josef Bacik, David Sterba
  Cc: linux-btrfs, linux-kernel



在 2025/3/26 03:01, Daniel Vacek 写道:
> There are a few leftover extent buffer flags not being meaningfully used
> anymore for some time. Simply clean them up.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu


>
> Daniel Vacek (3):
>    btrfs: cleanup EXTENT_BUFFER_READ_ERR flag
>    btrfs: cleanup EXTENT_BUFFER_READAHEAD flag
>    btrfs: cleanup EXTENT_BUFFER_CORRUPT flag
>
>   fs/btrfs/disk-io.c     | 11 ++---------
>   fs/btrfs/extent-tree.c |  6 ------
>   fs/btrfs/extent_io.c   |  7 ++-----
>   fs/btrfs/extent_io.h   |  5 -----
>   4 files changed, 4 insertions(+), 25 deletions(-)
>


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

* Re: [PATCH 0/3] btrfs: extent buffer flags cleanup
  2025-03-25 16:31 [PATCH 0/3] btrfs: extent buffer flags cleanup Daniel Vacek
                   ` (3 preceding siblings ...)
  2025-03-25 21:36 ` [PATCH 0/3] btrfs: extent buffer flags cleanup Qu Wenruo
@ 2025-03-27 16:58 ` David Sterba
  4 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2025-03-27 16:58 UTC (permalink / raw)
  To: Daniel Vacek
  Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs, linux-kernel

On Tue, Mar 25, 2025 at 05:31:35PM +0100, Daniel Vacek wrote:
> There are a few leftover extent buffer flags not being meaningfully used
> anymore for some time. Simply clean them up.
> 
> Daniel Vacek (3):
>   btrfs: cleanup EXTENT_BUFFER_READ_ERR flag
>   btrfs: cleanup EXTENT_BUFFER_READAHEAD flag
>   btrfs: cleanup EXTENT_BUFFER_CORRUPT flag

Added to for-next, thanks. Please write more descriptive subject lines,
'cleanup' is too broad, 'remove unused flag' is ok in this case.
Updated in git.

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-25 16:31 [PATCH 0/3] btrfs: extent buffer flags cleanup Daniel Vacek
2025-03-25 16:31 ` [PATCH 1/3] btrfs: cleanup EXTENT_BUFFER_READ_ERR flag Daniel Vacek
2025-03-25 16:31 ` [PATCH 2/3] btrfs: cleanup EXTENT_BUFFER_READAHEAD flag Daniel Vacek
2025-03-25 16:31 ` [PATCH 3/3] btrfs: cleanup EXTENT_BUFFER_CORRUPT flag Daniel Vacek
2025-03-25 21:36 ` [PATCH 0/3] btrfs: extent buffer flags cleanup Qu Wenruo
2025-03-27 16:58 ` David Sterba

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

all inboxes | Powered by JetHome®