aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2012-09-13 06:53:47 -0400
committerChris Mason <chris.mason@fusionio.com>2012-10-01 15:19:22 -0400
commit90abccf2c6e6e9c5a5d519eaed95292afa30aa11 (patch)
treedbdbb66fdb27c29597b6cc1c65f533420455d6af /fs/btrfs/file.c
parent698d0082c4875a2ccc10b52ee8f415faad46b754 (diff)
Revert "Btrfs: do not do filemap_write_and_wait_range in fsync"
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>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 0a4b03d8fcd6..d0fc4c5aaf15 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1544,12 +1544,20 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
1544 1544
1545 trace_btrfs_sync_file(file, datasync); 1545 trace_btrfs_sync_file(file, datasync);
1546 1546
1547 /*
1548 * We write the dirty pages in the range and wait until they complete
1549 * out of the ->i_mutex. If so, we can flush the dirty pages by
1550 * multi-task, and make the performance up.
1551 */
1552 ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
1553 if (ret)
1554 return ret;
1555
1547 mutex_lock(&inode->i_mutex); 1556 mutex_lock(&inode->i_mutex);
1548 1557
1549 /* 1558 /*
1550 * we wait first, since the writeback may change the inode, also wait 1559 * We flush the dirty pages again to avoid some dirty pages in the
1551 * ordered range does a filemape_write_and_wait_range which is why we 1560 * range being left.
1552 * don't do it above like other file systems.
1553 */ 1561 */
1554 atomic_inc(&root->log_batch); 1562 atomic_inc(&root->log_batch);
1555 btrfs_wait_ordered_range(inode, start, end); 1563 btrfs_wait_ordered_range(inode, start, end);