From patchwork Mon Mar 25 08:22:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10868191 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF2B815AC for ; Mon, 25 Mar 2019 08:23:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DBA8290FC for ; Mon, 25 Mar 2019 08:23:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9213429129; Mon, 25 Mar 2019 08:23:18 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 4A081290FC for ; Mon, 25 Mar 2019 08:23:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730028AbfCYIXR (ORCPT ); Mon, 25 Mar 2019 04:23:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:36606 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729943AbfCYIXR (ORCPT ); Mon, 25 Mar 2019 04:23:17 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 397C1AE7F for ; Mon, 25 Mar 2019 08:23:16 +0000 (UTC) From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 6/7] btrfs: check/original: Check and repair free space cache inode item Date: Mon, 25 Mar 2019 16:22:52 +0800 Message-Id: <20190325082253.19583-7-wqu@suse.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190325082253.19583-1-wqu@suse.com> References: <20190325082253.19583-1-wqu@suse.com> MIME-Version: 1.0 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 Just like lowmem mode, also check and repair free space cache inode item. And since we don't really have a good timing/function to check free space chace inodes, we use the same lowmem mode check_repair_free_space_inode() when iterating root tree. Signed-off-by: Qu Wenruo --- check/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/check/main.c b/check/main.c index 5db0716d23a1..b920165e3d0d 100644 --- a/check/main.c +++ b/check/main.c @@ -3620,6 +3620,17 @@ again: key.type == BTRFS_ROOT_BACKREF_KEY) { process_root_ref(leaf, path.slots[0], &key, root_cache); + } else if (key.type == BTRFS_INODE_ITEM_KEY && + is_fstree(key.objectid)) { + ret = check_repair_free_space_inode(fs_info, &path); + if (ret < 0 && !path.nodes[0]) { + err = 1; + goto out; + } + if (ret < 0 && path.nodes[0]) { + err = 1; + goto next; + } } next: path.slots[0]++;