aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2012-08-27 10:52:20 -0600
committerChris Mason <chris.mason@fusionio.com>2012-10-01 15:19:05 -0400
commit4e2f84e63dc138eca91e89ccbc34f37732ce58f7 (patch)
tree31691a22773cf249fc289d8414be62b52d071513 /fs/btrfs/tree-log.c
parentBtrfs: do not needlessly restart the transaction for enospc (diff)
downloadlinux-dev-4e2f84e63dc138eca91e89ccbc34f37732ce58f7.tar.xz
linux-dev-4e2f84e63dc138eca91e89ccbc34f37732ce58f7.zip
Btrfs: improve fsync by filtering extents that we want
This is based on Josef's "Btrfs: turbo charge fsync". The above Josef's patch performs very good in random sync write test, because we won't have too much extents to merge. However, it does not performs good on the test: dd if=/dev/zero of=foobar bs=4k count=12500 oflag=sync The reason is when we do sequencial sync write, we need to merge the current extent just with the previous one, so that we can get accumulated extents to log: A(4k) --> AA(8k) --> AAA(12k) --> AAAA(16k) ... So we'll have to flush more and more checksum into log tree, which is the bottleneck according to my tests. But we can avoid this by telling fsync the real extents that are needed to be logged. With this, I did the above dd sync write test (size=50m), w/o (orig) w/ (josef's) w/ (this) SATA 104KB/s 109KB/s 121KB/s ramdisk 1.5MB/s 1.5MB/s 10.7MB/s (613%) Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 58075d711d24..71e71539ffb7 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2833,8 +2833,8 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
struct btrfs_root *log = root->log_root;
struct btrfs_file_extent_item *fi;
struct btrfs_key key;
- u64 start = em->start;
- u64 len = em->len;
+ u64 start = em->mod_start;
+ u64 len = em->mod_len;
u64 num_bytes;
int nritems;
int ret;
@@ -2970,7 +2970,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
* sequential then we need to copy the items we have and redo
* our search
*/
- if (args.nr && em->start != args.next_offset) {
+ if (args.nr && em->mod_start != args.next_offset) {
ret = copy_items(trans, log, dst_path, args.src,
args.start_slot, args.nr,
LOG_INODE_ALL);