[Btrfs-devel] cloning file data

Chris Mason chris.mason at oracle.com
Mon May 5 03:27:46 PDT 2008


On Saturday 03 May 2008, Yan Zheng wrote:
> 2008/5/3, Sage Weil <sage at newdream.net>:
> > Hi Yan-
> >
> > On Sat, 3 May 2008, Yan Zheng wrote:
> > > I think the clone ioctl won't work in some corner case. The big loop
> > > in btrfs_ioctl_clone uses path->slots[0]++ and btrfs_next_leaf to get
> > > next item in the tree. However, this approach works only when the
> > > layout of tree keeps unchangeed. In btrfs_ioctl_clone, both
> > > btrfs_insert_file_extent and dup_item_to_inode may change the layout
> > > of tree.
> > >
> > > To be safe, I think the codes should:
> > >  use btrfs_search_slot to find next item.
> > >  use a intermediate buffer when coping item between two extent buffer.

 [ ... ]

> In my previous mail, I said items of different types should be
> differentiated. Actually, there is no need to do that. Please consider
> changing the big loop in btrfs_ioctl_clone to something like:

Oh, nice catch Yan, thanks.  I've pushed out a new version to the unstable 
tree.  Sage, could you please give this a try too?

-chris



More information about the Btrfs-devel mailing list