From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp1040.oracle.com ([156.151.31.81]:31065 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750895Ab3JNFBU (ORCPT ); Mon, 14 Oct 2013 01:01:20 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r9E51J7D000710 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 14 Oct 2013 05:01:20 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r9E51Ia5000553 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 14 Oct 2013 05:01:19 GMT Received: from abhmt102.oracle.com (abhmt102.oracle.com [141.146.116.54]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r9E51IeI000084 for ; Mon, 14 Oct 2013 05:01:18 GMT From: Liu Bo To: linux-btrfs@vger.kernel.org Subject: [PATCH v7 11/13] Btrfs: don't return space for dedup extent Date: Mon, 14 Oct 2013 12:59:53 +0800 Message-Id: <1381726796-27191-12-git-send-email-bo.li.liu@oracle.com> In-Reply-To: <1381726796-27191-1-git-send-email-bo.li.liu@oracle.com> References: <1381726796-27191-1-git-send-email-bo.li.liu@oracle.com> Sender: linux-btrfs-owner@vger.kernel.org List-ID: If the ordered extent had an IOERR or something else went wrong we need to return the space for this ordered extent back to the allocator, but if the extent is marked as a dedup one, we don't free the space because we just use the existing space instead of allocating new space. Signed-off-by: Liu Bo --- fs/btrfs/inode.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 00fd6e9..6ab6246 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3190,6 +3190,7 @@ out: * truncated case if we didn't write out the extent at all. */ if ((ret || !logical_len) && + !ordered_extent->dedup && !test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags) && !test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) btrfs_free_reserved_extent(root, ordered_extent->start, -- 1.7.7