From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 3/3] btrfs: Simplify dump_eb_and_memory_contents()
Date: Fri, 13 Jun 2025 20:07:02 +0100 [thread overview]
Message-ID: <20250613190705.3166969-4-willy@infradead.org> (raw)
In-Reply-To: <20250613190705.3166969-1-willy@infradead.org>
Remove the casting from folio back to page and remove the use of memcmp
for a single byte. Change the type to u8 so we can do direct array
arithmetic instead of doing complicated casts.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/btrfs/tests/extent-io-tests.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/tests/extent-io-tests.c b/fs/btrfs/tests/extent-io-tests.c
index 36720b77b440..f5f6accbdc21 100644
--- a/fs/btrfs/tests/extent-io-tests.c
+++ b/fs/btrfs/tests/extent-io-tests.c
@@ -664,17 +664,17 @@ static int test_find_first_clear_extent_bit(void)
return ret;
}
-static void dump_eb_and_memory_contents(struct extent_buffer *eb, void *memory,
- const char *test_name)
+static void dump_eb_and_memory_contents(const struct extent_buffer *eb,
+ const u8 *memory, const char *test_name)
{
for (int i = 0; i < eb->len; i++) {
- struct page *page = folio_page(eb->folios[i >> PAGE_SHIFT], 0);
- void *addr = page_address(page) + offset_in_page(i);
+ struct folio *folio = eb->folios[i / PAGE_SIZE];
+ u8 *addr = folio_address(folio) + i % PAGE_SIZE;
- if (memcmp(addr, memory + i, 1) != 0) {
+ if (*addr != memory[i]) {
test_err("%s failed", test_name);
test_err("eb and memory diffs at byte %u, eb has 0x%02x memory has 0x%02x",
- i, *(u8 *)addr, *(u8 *)(memory + i));
+ i, *addr, memory[i]);
return;
}
}
--
2.47.2
next prev parent reply other threads:[~2025-06-13 19:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-13 19:06 [PATCH 0/3] Folio conversions in extent-io-tests Matthew Wilcox (Oracle)
2025-06-13 19:07 ` [PATCH 1/3] btrfs: Convert test_find_delalloc() to use a folio Matthew Wilcox (Oracle)
2025-06-19 2:50 ` Matthew Wilcox
2025-06-19 5:41 ` Qu Wenruo
2025-06-20 13:14 ` David Sterba
2025-06-20 13:03 ` David Sterba
2025-06-13 19:07 ` [PATCH 2/3] btrfs: Convert test_find_delalloc() to use a folio, part two Matthew Wilcox (Oracle)
2025-06-13 23:35 ` Qu Wenruo
2025-06-14 0:04 ` Qu Wenruo
2025-06-13 19:07 ` Matthew Wilcox (Oracle) [this message]
2025-06-20 13:11 ` [PATCH 0/3] Folio conversions in extent-io-tests David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250613190705.3166969-4-willy@infradead.org \
--to=willy@infradead.org \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).