Re: [PATCH] btrfs: fix check_shared for fiemap ioctl

2016-06-01 Thread David Sterba
On Wed, Jun 01, 2016 at 09:23:57AM +0800, luke wrote: > > > At 06/01/2016 12:15 AM, David Sterba wrote: > > On Tue, May 31, 2016 at 11:08:39AM +0800, luke wrote: > +}; > + > +/* dynamically allocate and initialize a ref_root */ > +static struct ref_root *ref_root_alloc(gfp_t

Re: [PATCH] btrfs: fix check_shared for fiemap ioctl

2016-05-31 Thread luke
At 06/01/2016 12:23 AM, David Sterba wrote: On Tue, May 31, 2016 at 03:27:42PM +0800, luke wrote: +static void ref_root_fini(struct ref_root *ref_tree) +{ + struct ref_node *node; + struct rb_node *next; + + while ((next = rb_first(_tree->rb_root)) != NULL) { +

Re: [PATCH] btrfs: fix check_shared for fiemap ioctl

2016-05-31 Thread luke
At 06/01/2016 12:15 AM, David Sterba wrote: On Tue, May 31, 2016 at 11:08:39AM +0800, luke wrote: +}; + +/* dynamically allocate and initialize a ref_root */ +static struct ref_root *ref_root_alloc(gfp_t gfp_mask) +{ + struct ref_root *ref_tree; + + ref_tree =

Re: [PATCH] btrfs: fix check_shared for fiemap ioctl

2016-05-30 Thread Qu Wenruo
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

Re: [PATCH] btrfs: fix check_shared for fiemap ioctl

2016-05-30 Thread David Sterba
On Mon, May 16, 2016 at 11:23:50AM +0800, Lu Fengqi wrote: > +/* > + * ref_root is used as the root of the ref tree that hold a collection > + * of unique references. > + */ > +struct ref_root { > + /* > + * the unique_refs represents the number of ref_nodes with a positive > + *

Re: [PATCH] btrfs: fix check_shared for fiemap ioctl

2016-05-30 Thread David Sterba
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)

Re: [PATCH] btrfs: fix check_shared for fiemap ioctl

2016-05-26 Thread Qu Wenruo
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

Re: [PATCH] btrfs: fix check_shared for fiemap ioctl

2016-05-23 Thread luke
Does anyone have interest in this patch? 在 2016年05月16日 11:23, Lu Fengqi 写道: Only in the case of different root_id or different object_id, check_shared identified extent as the shared. However, If a extent was referred by different offset of same file, it should also be identified as shared. In

[PATCH] btrfs: fix check_shared for fiemap ioctl

2016-05-15 Thread Lu Fengqi
Only in the case of different root_id or different object_id, check_shared identified extent as the shared. However, If a extent was referred by different offset of same file, it should also be identified as shared. In addition, check_shared's loop scale is at least n^3, so if a extent has too