linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: Josef Bacik <jbacik@fusionio.com>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 2/2] Btrfs: improve fsync by filtering extents that we want
Date: Tue, 28 Aug 2012 08:22:02 +0800	[thread overview]
Message-ID: <503C0F2A.9040308@oracle.com> (raw)
In-Reply-To: <20120827171240.GC4048@localhost.localdomain>

On 08/28/2012 01:12 AM, Josef Bacik wrote:
> On Mon, Aug 27, 2012 at 10:52:20AM -0600, Liu Bo wrote:
>> 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>
>> ---
>>  fs/btrfs/extent_map.c |   20 ++++++++++++++++++++
>>  fs/btrfs/extent_map.h |    2 ++
>>  fs/btrfs/inode.c      |    1 +
>>  fs/btrfs/tree-log.c   |    6 +++---
>>  4 files changed, 26 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
>> index 1fe82cf..ac606f0 100644
>> --- a/fs/btrfs/extent_map.c
>> +++ b/fs/btrfs/extent_map.c
>> @@ -203,6 +203,8 @@ static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em)
>>  			em->block_start = merge->block_start;
>>  			merge->in_tree = 0;
>>  			if (merge->generation > em->generation) {
>> +				em->mod_start = em->start;
>> +				em->mod_len = em->len;
> 
> Shouldn't this be
> 
> em->mod_start = merge->start;
> em->mod_len += merge_len;
> 

They just do the same thing.

There is already a 
em->start = merge->start;
em->len += merge_len

>>  				em->generation = merge->generation;
>>  				list_move(&em->list, &tree->modified_extents);
>>  			}
>> @@ -222,6 +224,7 @@ static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em)
>>  		rb_erase(&merge->rb_node, &tree->map);
>>  		merge->in_tree = 0;
>>  		if (merge->generation > em->generation) {
>> +			em->mod_len = em->len;
> 
> And this should be em->mod_len += em->len?
> 

No, em->len has already contained the merge's len.

thanks,
liubo


  reply	other threads:[~2012-08-28  0:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-27 16:52 [PATCH 1/2] Btrfs: cleanup extents after we finish logging inode Liu Bo
2012-08-27 16:52 ` [PATCH 2/2] Btrfs: improve fsync by filtering extents that we want Liu Bo
2012-08-27 17:12   ` Josef Bacik
2012-08-28  0:22     ` Liu Bo [this message]
2012-08-28 17:54       ` Josef Bacik
2012-08-27 17:05 ` [PATCH 1/2] Btrfs: cleanup extents after we finish logging inode Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=503C0F2A.9040308@oracle.com \
    --to=bo.li.liu@oracle.com \
    --cc=jbacik@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).