From patchwork Wed Sep 22 00:00:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yehuda Sadeh X-Patchwork-Id: 198262 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 o8M01YBC024060 for ; Wed, 22 Sep 2010 00:01:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752272Ab0IVABc (ORCPT ); Tue, 21 Sep 2010 20:01:32 -0400 Received: from mail.hq.newdream.net ([66.33.206.127]:53750 "EHLO mail.hq.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752084Ab0IVABb (ORCPT ); Tue, 21 Sep 2010 20:01:31 -0400 Received: from mail.hq.newdream.net (localhost [127.0.0.1]) by mail.hq.newdream.net (Postfix) with ESMTP id 55DE127D48; Tue, 21 Sep 2010 17:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=hq.newdream.net; h=from:to :cc:subject:date:message-id; s=drama; bh=8IkS5F/uLSAFm3OSdYr8Xm3 /pSE=; b=FqBAXHfCLRElB5kOMuMdOr/npbZxoZiieNOJq/UuWCtiackJZqnWVtJ /V5wLz+ZL2cK7gzXjw8nooSvO4IgwuYB6yjGo2GV2So9bV3+qWeym+kox3tKAvF/ SjlhwirmgBkIKpCx6mOTS1Tlp8IvP0c76MIpAs/YSj2ra13HsG9k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=hq.newdream.net; h=from:to :cc:subject:date:message-id; q=dns; s=drama; b=p27z40ec5gXCoYEjt MzZ96D50kQ3Or5/b9ALvmCBNQNYKaa1P3t6b0VryXt4EP7E8y6kHK1R475ldyHxn srE4yh1UMpdrM/zap6y53lGV7NTmEq02+MM/14QF2eMFEY7nAJ8d8hFzAHP34pvx ik4ENGeuedTY8FwlHi1/9UYDRA= Received: from localhost.localdomain (ip-66-33-206-8.dreamhost.com [66.33.206.8]) by mail.hq.newdream.net (Postfix) with ESMTP id 51F6127D42; Tue, 21 Sep 2010 17:01:31 -0700 (PDT) From: Yehuda Sadeh To: linux-btrfs@vger.kernel.org Cc: sage@newdream.net, Yehuda Sadeh Subject: [PATCH v2] Btrfs: fix delalloc checks in clone ioctl Date: Tue, 21 Sep 2010 17:00:56 -0700 Message-Id: <630121e7c17b2804bc24194e13469d5e58d51174.1285113216.git.yehuda@hq.newdream.net> X-Mailer: git-send-email 1.5.6.5 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]); Wed, 22 Sep 2010 00:01:35 +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 */