Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs: collapse report_eb_range() into its single caller
@ 2026-04-23 11:38 fdmanana
  2026-04-23 14:54 ` Johannes Thumshirn
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: fdmanana @ 2026-04-23 11:38 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

There's no point in having this static function since it's too short and
it has a single caller (check_eb_range()), so move its code into the
caller and remove it.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/extent_io.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 6a6d98eec787..2b0aec031a9a 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3976,17 +3976,6 @@ int read_extent_buffer_pages(struct extent_buffer *eb, int mirror_num,
 	return 0;
 }
 
-static bool report_eb_range(const struct extent_buffer *eb, unsigned long start,
-			    unsigned long len)
-{
-	btrfs_warn(eb->fs_info,
-		"access to eb bytenr %llu len %u out of range start %lu len %lu",
-		eb->start, eb->len, start, len);
-	DEBUG_WARN();
-
-	return true;
-}
-
 /*
  * Check if the [start, start + len) range is valid before reading/writing
  * the eb.
@@ -4000,8 +3989,13 @@ static inline int check_eb_range(const struct extent_buffer *eb,
 	unsigned long offset;
 
 	/* start, start + len should not go beyond eb->len nor overflow */
-	if (unlikely(check_add_overflow(start, len, &offset) || offset > eb->len))
-		return report_eb_range(eb, start, len);
+	if (unlikely(check_add_overflow(start, len, &offset) || offset > eb->len)) {
+		btrfs_warn(eb->fs_info,
+		   "access to eb bytenr %llu len %u out of range start %lu len %lu",
+			   eb->start, eb->len, start, len);
+		DEBUG_WARN();
+		return true;
+	}
 
 	return false;
 }
-- 
2.47.2


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

end of thread, other threads:[~2026-04-24 15:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23 11:38 [PATCH] btrfs: collapse report_eb_range() into its single caller fdmanana
2026-04-23 14:54 ` Johannes Thumshirn
2026-04-23 21:43 ` Qu Wenruo
2026-04-24  2:38 ` David Sterba
2026-04-24  3:11   ` David Sterba
2026-04-24 15:20     ` Filipe Manana

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