All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <dsterba@suse.cz>, Lu Fengqi <lufq.fnst@cn.fujitsu.com>,
	<linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs: fix check_shared for fiemap ioctl
Date: Tue, 31 May 2016 08:38:25 +0800	[thread overview]
Message-ID: <b91c1b77-39ee-1a75-a530-4618f7765bd6@cn.fujitsu.com> (raw)
In-Reply-To: <20160530151528.GB29147@twin.jikos.cz>



David Sterba wrote on 2016/05/30 17:15 +0200:
> On Fri, May 27, 2016 at 09:39:53AM +0800, Qu Wenruo wrote:
>> Any comment?
>>
>> This patch does not fix the submitted generic/352[1] and generic/353[2]
>> test cases, but also introduce a much better structure and design for
>> later backref walk use.
>>
>> Instead of a list and do a O(n^3)~O(n^4) iteration for fiemap ioctl on a
>> reflinked(deduped) file, it's now only O(n)~O(nlogn) for SHARED flag
>> check to pass generic/352.
>
> This is a good improvement, though there's potentially hidden cost in
> the allocations and maintaining the temporary structures. Do you have
> actual performance numbers?
>
>
Test case generic/352 is already the proof.

For a 1G file whose all file extents are pointing to the same 128K file 
extent, fiemap will just soft lockup for backref walk.

Even for case(*) it doesn't hang, it takes about 3~4 seconds to do 
check_shared() for one extent.


With this patch, chech_shared() returned immediately, if found any other 
delayed ref/extent ref, making the whole fiemap ioctl super fast for 
deduped file case.

*: Two 1G file, inside the same subvolume, pointing to the same 128K 
file extent will not cause soft lockup.


We can use such patch to rework current backref walk code, which does 
unneeded list iteration instead of faster rb tree search, but it's too 
aggressive, and we want to do it step by step, starting from these bugs 
exposed by inband dedupe.

Thanks,
Qu



  reply	other threads:[~2016-05-31  0:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-16  3:23 [PATCH] btrfs: fix check_shared for fiemap ioctl Lu Fengqi
2016-05-24  3:42 ` luke
2016-05-27  1:39 ` Qu Wenruo
2016-05-30 15:15   ` David Sterba
2016-05-31  0:38     ` Qu Wenruo [this message]
2016-05-30 15:25 ` David Sterba
     [not found]   ` <f7e6d563-9964-5427-d9ad-cf7db858ad24@cn.fujitsu.com>
     [not found]     ` <20160531161555.GI29147@suse.cz>
2016-06-01  1:23       ` luke
2016-06-01 15:09         ` David Sterba
     [not found]   ` <b3c38efb-ddb6-d2b8-34e6-558b1c44065a@cn.fujitsu.com>
     [not found]     ` <20160531162325.GJ29147@suse.cz>
2016-06-01  5:43       ` luke

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=b91c1b77-39ee-1a75-a530-4618f7765bd6@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lufq.fnst@cn.fujitsu.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.