From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yan Zheng" Subject: Re: [Btrfs-devel] cloning file data Date: Sat, 3 May 2008 12:44:08 +0800 Message-ID: <3d0408630805022144h3dd137e6k40f5c315c7b18f36@mail.gmail.com> References: <200804250941.35343.chris.mason@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Cc: "Chris Mason" , btrfs-devel@oss.oracle.com, linux-btrfs@vger.kernel.org To: "Sage Weil" Return-path: In-Reply-To: List-ID: 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