* [PATCH 2/2] Revert "Btrfs: do not do filemap_write_and_wait_range in fsync"
@ 2012-09-13 10:53 Miao Xie
2012-09-13 12:38 ` Josef Bacik
0 siblings, 1 reply; 2+ messages in thread
From: Miao Xie @ 2012-09-13 10:53 UTC (permalink / raw)
To: Linux Btrfs
This reverts commit 0885ef5b5601e9b007c383e77c172769b1f214fd
After applying the above patch, the performance slowed down because the dirty
page flush can only be done by one task, so revert it.
The following is the test result of sysbench:
Before After
24MB/s 39MB/s
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
fs/btrfs/file.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 1a5f76b..1ea5c39 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1513,12 +1513,20 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
trace_btrfs_sync_file(file, datasync);
+ /*
+ * We write the dirty pages in the range and wait until they complete
+ * out of the ->i_mutex. If so, we can flush the dirty pages by
+ * multi-task, and make the performance up.
+ */
+ ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
+ if (ret)
+ return ret;
+
mutex_lock(&inode->i_mutex);
/*
- * we wait first, since the writeback may change the inode, also wait
- * ordered range does a filemape_write_and_wait_range which is why we
- * don't do it above like other file systems.
+ * We flush the dirty pages again to avoid some dirty pages in the
+ * range being left.
*/
atomic_inc(&root->log_batch);
btrfs_wait_ordered_range(inode, start, end);
--
1.7.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] Revert "Btrfs: do not do filemap_write_and_wait_range in fsync"
2012-09-13 10:53 [PATCH 2/2] Revert "Btrfs: do not do filemap_write_and_wait_range in fsync" Miao Xie
@ 2012-09-13 12:38 ` Josef Bacik
0 siblings, 0 replies; 2+ messages in thread
From: Josef Bacik @ 2012-09-13 12:38 UTC (permalink / raw)
To: Miao Xie; +Cc: Linux Btrfs
On Thu, Sep 13, 2012 at 04:53:47AM -0600, Miao Xie wrote:
> This reverts commit 0885ef5b5601e9b007c383e77c172769b1f214fd
>
> After applying the above patch, the performance slowed down because the dirty
> page flush can only be done by one task, so revert it.
>
> The following is the test result of sysbench:
> Before After
> 24MB/s 39MB/s
>
Ah I didn't think about that, good point, thanks!
Josef
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-13 12:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-13 10:53 [PATCH 2/2] Revert "Btrfs: do not do filemap_write_and_wait_range in fsync" Miao Xie
2012-09-13 12:38 ` 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).