From patchwork Mon Jul 29 07:43:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 11063361 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 8E6A414E5 for ; Mon, 29 Jul 2019 07:43:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 813D2286A0 for ; Mon, 29 Jul 2019 07:43:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 735E1286AA; Mon, 29 Jul 2019 07:43:46 +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 183E8286A0 for ; Mon, 29 Jul 2019 07:43:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726837AbfG2Hnp (ORCPT ); Mon, 29 Jul 2019 03:43:45 -0400 Received: from mx2.suse.de ([195.135.220.15]:35556 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725917AbfG2Hno (ORCPT ); Mon, 29 Jul 2019 03:43:44 -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 D7294AE1C for ; Mon, 29 Jul 2019 07:43:43 +0000 (UTC) From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 0/3] btrfs: tree-checker: Add extent items check Date: Mon, 29 Jul 2019 15:43:34 +0800 Message-Id: <20190729074337.10573-1-wqu@suse.com> X-Mailer: git-send-email 2.22.0 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 Finally, we are going to add tree-checker support for extent items, which includes: - EXTENT_ITEM/METADATA_ITEM Which futher contains inline backrefs of: * TREE_BLOCK_REF * SHARED_BLOCK_REF * EXETNT_DATA_REF * SHARED_DATA_REF - TREE_BLOCK_REF - SHARED_BLOCK_REF - EXTENT_DATA_REF - SHARED_DATA_REF Keyed version of the above types The complexity of the on-disk format can be found in the first patch, which contains a basic introduction as comment. Hidden pitfalls are everywhere, e.g. inlined EXTENT_DATA_REF don't use iref->offset, but put its own data at iref->offset. But SHARED_DATA_REF uses iref->offset, and put extra data after iref. Such on-disk layout makes sense, but definitely a mess to read. Thankfully we at least have print-tree code from btrfs-progs as a reference. Qu Wenruo (3): btrfs: tree-checker: Add EXTENT_ITEM and METADATA_ITEM check btrfs: tree-checker: Add simple keyed refs check btrfs: tree-checker: Add EXTENT_DATA_REF check fs/btrfs/ctree.h | 1 + fs/btrfs/extent-tree.c | 2 +- fs/btrfs/tree-checker.c | 335 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 337 insertions(+), 1 deletion(-)