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 _______________________________________________ Btrfs-devel mailing list [email protected] http://oss.oracle.com/mailman/listinfo/btrfs-devel
