* [PATCH] Btrfs: remove repeated eb->pages check in, disk-io.c/csum_dirty_buffer
@ 2012-10-08 13:26 Wang Sheng-Hui
2012-10-09 13:39 ` Chris Mason
0 siblings, 1 reply; 2+ messages in thread
From: Wang Sheng-Hui @ 2012-10-08 13:26 UTC (permalink / raw)
To: chris.mason, linux-btrfs, linux-kernel
In csum_dirty_buffer, we first get eb from page->private.
Then we check if the page is the first page of eb. Later
we check it again. Remove the repeated check here.
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
fs/btrfs/disk-io.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 22e98e0..8919c56 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -432,14 +432,12 @@ static int csum_dirty_buffer(struct btrfs_root *root, struct page *page)
tree = &BTRFS_I(page->mapping->host)->io_tree;
eb = (struct extent_buffer *)page->private;
- if (page != eb->pages[0])
- return 0;
- found_start = btrfs_header_bytenr(eb);
- if (found_start != start) {
+ if (page != eb->pages[0]) {
WARN_ON(1);
return 0;
}
- if (eb->pages[0] != page) {
+ found_start = btrfs_header_bytenr(eb);
+ if (found_start != start) {
WARN_ON(1);
return 0;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Btrfs: remove repeated eb->pages check in, disk-io.c/csum_dirty_buffer
2012-10-08 13:26 [PATCH] Btrfs: remove repeated eb->pages check in, disk-io.c/csum_dirty_buffer Wang Sheng-Hui
@ 2012-10-09 13:39 ` Chris Mason
0 siblings, 0 replies; 2+ messages in thread
From: Chris Mason @ 2012-10-09 13:39 UTC (permalink / raw)
To: Wang Sheng-Hui
Cc: Chris Mason, linux-btrfs@vger.kernel.org,
linux-kernel@vger.kernel.org
On Mon, Oct 08, 2012 at 07:26:15AM -0600, Wang Sheng-Hui wrote:
> In csum_dirty_buffer, we first get eb from page->private.
> Then we check if the page is the first page of eb. Later
> we check it again. Remove the repeated check here.
You had the right idea here, two checks and one has a warning, so you
kept the warning. But when the metadata block size is bigger than a
page, the WARN_ON triggers for any page that isn't the first one in the
extent buffer.
I kept this commit but removed the WARN_ON(1)
-chris
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-09 13:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-08 13:26 [PATCH] Btrfs: remove repeated eb->pages check in, disk-io.c/csum_dirty_buffer Wang Sheng-Hui
2012-10-09 13:39 ` Chris Mason
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).