From patchwork Fri Sep 17 22:42:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yehuda Sadeh X-Patchwork-Id: 189372 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 o8HNBev0008652 for ; Fri, 17 Sep 2010 23:11:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752935Ab0IQXLh (ORCPT ); Fri, 17 Sep 2010 19:11:37 -0400 Received: from mail.hq.newdream.net ([66.33.206.127]:47702 "EHLO mail.hq.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751934Ab0IQXLg (ORCPT ); Fri, 17 Sep 2010 19:11:36 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 17 Sep 2010 23:11:40 +0000 (UTC) X-Greylist: delayed 1758 seconds by postgrey-1.27 at vger.kernel.org; Fri, 17 Sep 2010 19:11:36 EDT Received: from mail.hq.newdream.net (localhost [127.0.0.1]) by mail.hq.newdream.net (Postfix) with ESMTP id F0439C064; Fri, 17 Sep 2010 15:42:17 -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=66c79giPAgWhltXXut08wxE MRBY=; b=biwCnD6sJm7OWB+hajYWMWM9u9lcZO2Mm7W2tAmnUo6I7mXHhiIsbJx 7WPBUI0CwB4Q1kDywrSBgxUumH9Rv+GoJXtSqfejYi2YpdypBXa8h4fD6RYUWmsX R/Ior/us/hacaDmOpoJxZbrEhCHmnvRyxGxg5NO0N1WZVzClNwtE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=hq.newdream.net; h=from:to :cc:subject:date:message-id; q=dns; s=drama; b=h6oZytcRcwbrKh28D tdOjxDrKpzhoigiE3HQPT4OstZdq7bYsvXreKX73p3k7GZ+uymZ+Mxj8bWHOPOst xjrVMolDeaL2ZYv7Y9u04/QvCGzgfRDwaFCXIJMkwrMSu3Gr+6wrZZw1yU4Th4ga lwSZzJF3PMeQH3oOykb2SGjvJI= Received: from localhost.localdomain (ip-66-33-206-8.dreamhost.com [66.33.206.8]) by mail.hq.newdream.net (Postfix) with ESMTP id EC48EC063; Fri, 17 Sep 2010 15:42:17 -0700 (PDT) From: Yehuda Sadeh To: linux-btrfs@vger.kernel.org Cc: sage@newdream.net, Yehuda Sadeh Subject: [PATCH] Btrfs: fix delalloc checks in clone ioctl Date: Fri, 17 Sep 2010 15:42:05 -0700 Message-Id: <812cd3a0ede2021247239945ffeb49e2fa421f22.1284763172.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 diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 9254b3d..e09d6f0 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 */