* [PATCH] Btrfs: tag pages for writeback in sync
@ 2011-07-15 21:26 Josef Bacik
2011-07-15 21:50 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Josef Bacik @ 2011-07-15 21:26 UTC (permalink / raw)
To: linux-btrfs
Everybody else does this, we need to do it too. If we're syncing, we need to
tag the pages we're going to write for writeback so we don't end up writing the
same stuff over and over again if somebody is constantly redirtying our file.
This will keep us from having latencies with heavy sync workloads. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
---
fs/btrfs/extent_io.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 9a43a96..9db9b0b 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2516,6 +2516,7 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
pgoff_t index;
pgoff_t end; /* Inclusive */
int scanned = 0;
+ int tag;
pagevec_init(&pvec, 0);
if (wbc->range_cyclic) {
@@ -2526,11 +2527,16 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
end = wbc->range_end >> PAGE_CACHE_SHIFT;
scanned = 1;
}
+ if (wbc->sync_mode == WB_SYNC_ALL)
+ tag = PAGECACHE_TAG_TOWRITE;
+ else
+ tag = PAGECACHE_TAG_DIRTY;
retry:
+ if (wbc->sync_mode == WB_SYNC_ALL)
+ tag_pages_for_writeback(mapping, index, end);
while (!done && !nr_to_write_done && (index <= end) &&
- (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
- PAGECACHE_TAG_DIRTY, min(end - index,
- (pgoff_t)PAGEVEC_SIZE-1) + 1))) {
+ (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag,
+ min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) {
unsigned i;
scanned = 1;
--
1.7.5.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Btrfs: tag pages for writeback in sync
2011-07-15 21:26 [PATCH] Btrfs: tag pages for writeback in sync Josef Bacik
@ 2011-07-15 21:50 ` Christoph Hellwig
2011-07-16 0:47 ` Josef Bacik
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2011-07-15 21:50 UTC (permalink / raw)
To: Josef Bacik; +Cc: linux-btrfs
On Fri, Jul 15, 2011 at 05:26:38PM -0400, Josef Bacik wrote:
> Everybody else does this, we need to do it too. If we're syncing, we need to
> tag the pages we're going to write for writeback so we don't end up writing the
> same stuff over and over again if somebody is constantly redirtying our file.
> This will keep us from having latencies with heavy sync workloads. Thanks,
Maybe it's time to find a wait to merge the btrfs copy of write_cache_pages
back into the main one?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Btrfs: tag pages for writeback in sync
2011-07-15 21:50 ` Christoph Hellwig
@ 2011-07-16 0:47 ` Josef Bacik
0 siblings, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2011-07-16 0:47 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-btrfs
On 07/15/2011 05:50 PM, Christoph Hellwig wrote:
> On Fri, Jul 15, 2011 at 05:26:38PM -0400, Josef Bacik wrote:
>> Everybody else does this, we need to do it too. If we're syncing, we need to
>> tag the pages we're going to write for writeback so we don't end up writing the
>> same stuff over and over again if somebody is constantly redirtying our file.
>> This will keep us from having latencies with heavy sync workloads. Thanks,
>
> Maybe it's time to find a wait to merge the btrfs copy of write_cache_pages
> back into the main one?
I looked at it, but we need to be able to call a special helper to lock
the page for our btree pages, and we can queue up a bio in order to add
pages to it from delalloc which we will submit if we have to wait on a
page to complete writeback. Maybe I can use the block plugging stuff
instead of our bio thing so that if we have to wait it will get flushed
automatically, then that just leaves our locking thing which I guess
would be ok to pass down to write_cache_pages? Thanks,
Josef
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-16 0:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-15 21:26 [PATCH] Btrfs: tag pages for writeback in sync Josef Bacik
2011-07-15 21:50 ` Christoph Hellwig
2011-07-16 0:47 ` Josef Bacik
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).