[Btrfs-devel] cloning file data

Yan Zheng yanzheng at 21cn.com
Fri May 2 21:44:08 PDT 2008


Hello Sage,

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.

Regards
YZ



More information about the Btrfs-devel mailing list