提交 f7aaa06b 编写于 作者: J Josef Bacik 提交者: Chris Mason

Btrfs: tag pages for writeback in sync

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: NJosef Bacik <josef@redhat.com>
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 9e0baf60
...@@ -2421,6 +2421,7 @@ static int extent_write_cache_pages(struct extent_io_tree *tree, ...@@ -2421,6 +2421,7 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
pgoff_t index; pgoff_t index;
pgoff_t end; /* Inclusive */ pgoff_t end; /* Inclusive */
int scanned = 0; int scanned = 0;
int tag;
pagevec_init(&pvec, 0); pagevec_init(&pvec, 0);
if (wbc->range_cyclic) { if (wbc->range_cyclic) {
...@@ -2431,11 +2432,16 @@ static int extent_write_cache_pages(struct extent_io_tree *tree, ...@@ -2431,11 +2432,16 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
end = wbc->range_end >> PAGE_CACHE_SHIFT; end = wbc->range_end >> PAGE_CACHE_SHIFT;
scanned = 1; scanned = 1;
} }
if (wbc->sync_mode == WB_SYNC_ALL)
tag = PAGECACHE_TAG_TOWRITE;
else
tag = PAGECACHE_TAG_DIRTY;
retry: retry:
if (wbc->sync_mode == WB_SYNC_ALL)
tag_pages_for_writeback(mapping, index, end);
while (!done && !nr_to_write_done && (index <= end) && while (!done && !nr_to_write_done && (index <= end) &&
(nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag,
PAGECACHE_TAG_DIRTY, min(end - index, min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) {
(pgoff_t)PAGEVEC_SIZE-1) + 1))) {
unsigned i; unsigned i;
scanned = 1; scanned = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册