From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp1040.oracle.com ([141.146.126.69]:30117 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932572AbaDIHJo (ORCPT ); Wed, 9 Apr 2014 03:09:44 -0400 From: Liu Bo To: linux-btrfs@vger.kernel.org Cc: Marcel Ritter , Christian Robert , , Konstantinos Skarlatos , David Sterba , Martin Steigerwald , Josef Bacik , Chris Mason Subject: [PATCH v9 08/16] Btrfs: don't return space for dedup extent Date: Wed, 9 Apr 2014 15:08:36 +0800 Message-Id: <1397027325-27151-9-git-send-email-bo.li.liu@oracle.com> In-Reply-To: <1397027325-27151-1-git-send-email-bo.li.liu@oracle.com> References: <1397027325-27151-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 file changed, 1 insertion(+) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c69e530..d32b066 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3213,6 +3213,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.8.2.1