From patchwork Tue Oct 19 22:22:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sage Weil X-Patchwork-Id: 266581 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9JMMMYL007319 for ; Tue, 19 Oct 2010 22:22:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754951Ab0JSWWT (ORCPT ); Tue, 19 Oct 2010 18:22:19 -0400 Received: from cobra.newdream.net ([66.33.216.30]:48489 "EHLO cobra.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753389Ab0JSWWT (ORCPT ); Tue, 19 Oct 2010 18:22:19 -0400 Received: from localhost.localdomain (dhcp-63-161.cse.ucsc.edu [128.114.63.161]) by cobra.newdream.net (Postfix) with ESMTPA id 6D161BC670; Tue, 19 Oct 2010 15:25:13 -0700 (PDT) From: Sage Weil To: linux-btrfs@vger.kernel.org Cc: Yehuda Sadeh Subject: [PATCH 1/3] Btrfs: fix delalloc checks in clone ioctl Date: Tue, 19 Oct 2010 15:22:10 -0700 Message-Id: <1287526932-28369-2-git-send-email-sage@newdream.net> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1287526932-28369-1-git-send-email-sage@newdream.net> References: <1287526932-28369-1-git-send-email-sage@newdream.net> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 19 Oct 2010 22:22:22 +0000 (UTC) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 9254b3d..3471b22 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1530,13 +1530,15 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, while (1) { struct btrfs_ordered_extent *ordered; lock_extent(&BTRFS_I(src)->io_tree, off, off+len, GFP_NOFS); - ordered = btrfs_lookup_first_ordered_extent(inode, off+len); - if (BTRFS_I(src)->delalloc_bytes == 0 && !ordered) + ordered = btrfs_lookup_first_ordered_extent(src, off+len); + if (!ordered && + !test_range_bit(&BTRFS_I(src)->io_tree, off, off+len, + EXTENT_DELALLOC, 0, NULL)) break; unlock_extent(&BTRFS_I(src)->io_tree, off, off+len, GFP_NOFS); if (ordered) btrfs_put_ordered_extent(ordered); - btrfs_wait_ordered_range(src, off, off+len); + btrfs_wait_ordered_range(src, off, len); } /* clone data */