Skip to contentSkip to conversation

fs/buffer.c: exit if already confirmed page has dirty and writeback buffers

PATCH RESEND In review Gu Zheng 2 participants 3 messages Nov 5, 2013 – Nov 8, 2013 VFS

lore
Share & tools
lore

Gu Zheng

author
#0 lore raw

PATCH RESEND 1/1 fs/buffer.c: exit if already confirmed page has dirty and writeback buffers

Stop the loop of iterating bh if we have confirmed page has dirty and writeback buffers.

---
 fs/buffer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/buffer.c +1 -1
index 6024877..519cc5c 100644
@@ -112,7 +112,7 @@ void buffer_check_dirty_writeback(struct page *page,
 			*dirty = true;
 
 		bh = bh->b_this_page;
-	} while (bh != head);
+	} while ((bh != head) && !(*writeback && *dirty));
 }
 EXPORT_SYMBOL(buffer_check_dirty_writeback);
 
Signature · 1 line
1.7.7
reviewer
#1 lore raw
Quoted 2 lines · Gu Zheng

Stop the loop of iterating bh if we have confirmed page has dirty and writeback buffers.

Thanks for the patch. What I'm somewhat missing here is a motivation of
the patch. For the common case where blocksize == pagesize this is a noop (only adds some code). For the case where blocksize < pagesize we can possibly save checking some buffers but how common is that going be? Does that minimal speed up outweight the cost of additional check / code complication?

Honza

Quoted 26 lines
---
 fs/buffer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/buffer.c +1 -1
index 6024877..519cc5c 100644
@@ -112,7 +112,7 @@ void buffer_check_dirty_writeback(struct page *page,
 			*dirty = true;
 
 		bh = bh->b_this_page;
-	} while (bh != head);
+	} while ((bh != head) && !(*writeback && *dirty));
 }
 EXPORT_SYMBOL(buffer_check_dirty_writeback);
 
Signature · 6 lines
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
author
#2 lore raw

Hi Jan,

Quoted 6 lines · Jan Kara
Quoted 2 lines · Gu Zheng

Stop the loop of iterating bh if we have confirmed page has dirty and writeback buffers.

Thanks for the patch. What I'm somewhat missing here is a motivation of
the patch. For the common case where blocksize == pagesize this is a noop (only adds some code).

Yes, you're right.

Quoted 2 lines

For the case where blocksize < pagesize we can
possibly save checking some buffers but how common is that going be?

It's really hard to say.:( But many file systems support small blocksize.

Quoted 2 lines

Does that minimal speed up outweight the cost of additional check / code complication?

In fact, without complete test. But I think the speed up can outweigh the cost if blocksize small enough. For example, blocksize: 1k, pagesize: 4k, we can reduce 6 bh check(3 dirty, 3 writeback) in the best case.

Best regards,
Gu

Quoted 29 lines

Honza

Quoted 26 lines
---
 fs/buffer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/buffer.c +1 -1
index 6024877..519cc5c 100644
@@ -112,7 +112,7 @@ void buffer_check_dirty_writeback(struct page *page,
 			*dirty = true;
 
 		bh = bh->b_this_page;
-	} while (bh != head);
+	} while ((bh != head) && !(*writeback && *dirty));
 }
 EXPORT_SYMBOL(buffer_check_dirty_writeback);
 
Signature · 6 lines
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html