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

2016-06-05 Thread Lu Fengqi
At 06/03/2016 10:02 PM, Josef Bacik wrote: On 06/01/2016 01:48 AM, Lu Fengqi wrote: 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

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

2016-06-03 Thread Josef Bacik
On 06/01/2016 01:48 AM, Lu Fengqi wrote: 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

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

2016-06-02 Thread Mark Fasheh
On Thu, Jun 02, 2016 at 02:17:40PM -0700, Mark Fasheh wrote: > On Thu, Jun 02, 2016 at 04:56:06PM -0400, Jeff Mahoney wrote: > > On 6/2/16 3:08 PM, Mark Fasheh wrote: > > > On Thu, Jun 02, 2016 at 07:07:32PM +0200, David Sterba wrote: > > >> On Wed, Jun 01, 2016 at 02:15:22PM -0700, Mark Fasheh

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

2016-06-02 Thread Mark Fasheh
On Thu, Jun 02, 2016 at 04:56:06PM -0400, Jeff Mahoney wrote: > On 6/2/16 3:08 PM, Mark Fasheh wrote: > > On Thu, Jun 02, 2016 at 07:07:32PM +0200, David Sterba wrote: > >> On Wed, Jun 01, 2016 at 02:15:22PM -0700, Mark Fasheh wrote: > +/* dynamically allocate and initialize a ref_root */ >

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

2016-06-02 Thread Jeff Mahoney
On 6/2/16 3:08 PM, Mark Fasheh wrote: > On Thu, Jun 02, 2016 at 07:07:32PM +0200, David Sterba wrote: >> On Wed, Jun 01, 2016 at 02:15:22PM -0700, Mark Fasheh wrote: +/* dynamically allocate and initialize a ref_root */ +static struct ref_root *ref_root_alloc(void) +{ + struct

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

2016-06-02 Thread Mark Fasheh
On Thu, Jun 02, 2016 at 01:46:27PM +0800, Lu Fengqi wrote: > > At 06/02/2016 05:15 AM, Mark Fasheh wrote: > >Thanks for trying to fix this problem, comments below. > > > >On Wed, Jun 01, 2016 at 01:48:05PM +0800, Lu Fengqi wrote: > >>Only in the case of different root_id or different object_id,

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

2016-06-02 Thread Mark Fasheh
On Thu, Jun 02, 2016 at 07:07:32PM +0200, David Sterba wrote: > On Wed, Jun 01, 2016 at 02:15:22PM -0700, Mark Fasheh wrote: > > > +/* dynamically allocate and initialize a ref_root */ > > > +static struct ref_root *ref_root_alloc(void) > > > +{ > > > + struct ref_root *ref_tree; > > > + > > > +

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

2016-06-02 Thread David Sterba
On Wed, Jun 01, 2016 at 02:15:22PM -0700, Mark Fasheh wrote: > > +/* dynamically allocate and initialize a ref_root */ > > +static struct ref_root *ref_root_alloc(void) > > +{ > > + struct ref_root *ref_tree; > > + > > + ref_tree = kmalloc(sizeof(*ref_tree), GFP_KERNEL); > > I'm pretty sure

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

2016-06-01 Thread Lu Fengqi
At 06/02/2016 05:15 AM, Mark Fasheh wrote: Thanks for trying to fix this problem, comments below. On Wed, Jun 01, 2016 at 01:48:05PM +0800, Lu Fengqi wrote: Only in the case of different root_id or different object_id, check_shared identified extent as the shared. However, If a extent was

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

2016-06-01 Thread Mark Fasheh
On Wed, Jun 01, 2016 at 02:15:22PM -0700, Mark Fasheh wrote: > > +static int ref_tree_add(struct ref_root *ref_tree, u64 root_id, u64 > > object_id, > > + u64 offset, u64 parent, int count) > > +{ > > + struct ref_node *node = NULL; > > + struct rb_node **pos = NULL; > > +

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

2016-06-01 Thread Mark Fasheh
Thanks for trying to fix this problem, comments below. On Wed, Jun 01, 2016 at 01:48:05PM +0800, Lu Fengqi wrote: > 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,

[PATCH v2] btrfs: fix check_shared for fiemap ioctl

2016-05-31 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