From patchwork Thu Mar 6 05:53:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 3781531 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C461F9F369 for ; Thu, 6 Mar 2014 05:56:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D148201DD for ; Thu, 6 Mar 2014 05:56:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D839201D5 for ; Thu, 6 Mar 2014 05:56:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751837AbaCFF4F (ORCPT ); Thu, 6 Mar 2014 00:56:05 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:52580 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751811AbaCFF4B (ORCPT ); Thu, 6 Mar 2014 00:56:01 -0500 X-IronPort-AV: E=Sophos;i="4.97,598,1389715200"; d="scan'208";a="9652961" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 06 Mar 2014 13:52:07 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s265tv8X010090 for ; Thu, 6 Mar 2014 13:55:59 +0800 Received: from wangs.fnst.cn.fujitsu.com ([10.167.226.104]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2014030613532373-441950 ; Thu, 6 Mar 2014 13:53:23 +0800 From: Wang Shilong To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/5] Btrfs-progs: fsck: reset balance after reiniting extent root Date: Thu, 6 Mar 2014 13:53:57 +0800 Message-Id: <1394085240-23520-2-git-send-email-wangsl.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1394085240-23520-1-git-send-email-wangsl.fnst@cn.fujitsu.com> References: <1394085240-23520-1-git-send-email-wangsl.fnst@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2014/03/06 13:53:23, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2014/03/06 13:53:25, Serialize complete at 2014/03/06 13:53:25 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP reset balance need cow block which will insert extent item into extent tree. If we do this before reinitting extent root, we may encounter EEIXST. Signed-off-by: Wang Shilong --- cmds-check.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index 3cf59b6..8a3f2cd 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -6253,12 +6253,6 @@ static int reinit_extent_tree(struct btrfs_trans_handle *trans, return ret; } - ret = reset_balance(trans, fs_info); - if (ret) { - fprintf(stderr, "error reseting the pending balance\n"); - return ret; - } - /* Ok we can allocate now, reinit the extent root */ ret = btrfs_fsck_reinit_root(trans, fs_info->extent_root, 0); if (ret) { @@ -6293,7 +6287,11 @@ static int reinit_extent_tree(struct btrfs_trans_handle *trans, btrfs_extent_post_op(trans, fs_info->extent_root); } - return 0; + ret = reset_balance(trans, fs_info); + if (ret) + fprintf(stderr, "error reseting the pending balance\n"); + + return ret; } static int recow_extent_buffer(struct btrfs_root *root, struct extent_buffer *eb)