From patchwork Wed Nov 29 09:15:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10081647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7CC506020B for ; Wed, 29 Nov 2017 09:16:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B62329739 for ; Wed, 29 Nov 2017 09:16:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DEE729743; Wed, 29 Nov 2017 09:16:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0527129739 for ; Wed, 29 Nov 2017 09:16:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753876AbdK2JQV (ORCPT ); Wed, 29 Nov 2017 04:16:21 -0500 Received: from prv3-mh.provo.novell.com ([137.65.250.26]:60435 "EHLO prv3-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753403AbdK2JQS (ORCPT ); Wed, 29 Nov 2017 04:16:18 -0500 Received: from adam-pc.lan (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Wed, 29 Nov 2017 02:16:08 -0700 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz Subject: [PATCH 1/9] btrfs-progs: mkfs: Cleanup temporary chunks before filling rootdir Date: Wed, 29 Nov 2017 17:15:56 +0800 Message-Id: <20171129091604.2194-2-wqu@suse.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171129091604.2194-1-wqu@suse.com> References: <20171129091604.2194-1-wqu@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Cleanup those temporary chunks should be as soon as possible, and it should be especially before doing large tree operations, like filling rootdir. Signed-off-by: Qu Wenruo --- mkfs/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mkfs/main.c b/mkfs/main.c index 2da38cb9490e..a81718d1517d 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1248,6 +1248,13 @@ raid_groups: goto out; } + ret = cleanup_temp_chunks(fs_info, &allocation, data_profile, + metadata_profile, metadata_profile); + if (ret < 0) { + error("failed to cleanup temporary chunks: %d", ret); + goto out; + } + if (source_dir_set) { trans = btrfs_start_transaction(root, 1); BUG_ON(IS_ERR(trans)); @@ -1311,12 +1318,6 @@ raid_groups: } } } - ret = cleanup_temp_chunks(fs_info, &allocation, data_profile, - metadata_profile, metadata_profile); - if (ret < 0) { - error("failed to cleanup temporary chunks: %d", ret); - goto out; - } if (verbose) { char features_buf[64];