From patchwork Wed Sep 12 19:20:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 10597383 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 6AD2C14DB for ; Wed, 12 Sep 2018 11:21:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A18629B32 for ; Wed, 12 Sep 2018 11:21:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E28B29B84; Wed, 12 Sep 2018 11:21:13 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 E9B4329B84 for ; Wed, 12 Sep 2018 11:21:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726810AbeILQZQ (ORCPT ); Wed, 12 Sep 2018 12:25:16 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:43377 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726082AbeILQZQ (ORCPT ); Wed, 12 Sep 2018 12:25:16 -0400 Received: by mail-pl1-f194.google.com with SMTP id f66-v6so829294plb.10 for ; Wed, 12 Sep 2018 04:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nXB9blXDFZFpJXSNfaNpwCIOg0hmyJyxgIY/jgQNmpU=; b=Vy33bDOS8g5VaSE0pJSv5ymjK7YpuqXyoCad5kWPMCVEeh9SMRgO0PpWbD5GV9MD2M xexlLLRY0srCWKbB2Pzir9eqNLZNiLDNA1E0utwo9EpV5FldBvDaKxL38WsWIykA1wPq O3fUlOywHVmHnZxxR6Opg+PUTQdJ51cNMsj83mdRNpI0x3ja1/Hq4DYIVxp7+9yydgN2 bPFLPR1Cwic6kX4UqaW5hbeUN88xHRSWvQatOyLk3d6AwQn55BASD4FLnAgfLhW8EDin P/ldrRl79O79d7OsirKxOs4UyFj+IwmC3R2LQPvolNSp2bUseCL5klre0VqGT6q6xhCo NSUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nXB9blXDFZFpJXSNfaNpwCIOg0hmyJyxgIY/jgQNmpU=; b=C79hHqFs9SuGDFiQiQhtc5n7eKdnJ7m5MCfg6tlqXOC2iqL/LVOhoifVpUTSdfuzC9 TWJQ0ycSB3XQF9ShoMK7YOHtm90XW6WZIsZCWFvS98IZfKGisxJeRZ/j87owTUxtmQVj ZsqF4qSwfN1ki6TGQ/QFaiXvT9HsYUs1KSK/tvb5zlx2PCbKHN9B03WxbZ3wnI3srwNZ 8RO1utcM9jje1fStkyVlpSZT6ek0uBQa7Uccl34Y7TT6mLgGqTMyOVP4V7+NjNGUwJhR ADyJVmsEeqSlOqPBiBKBia/NAvG1XZAdt+3m4ePhpnE9SpPEoUtYkQjzxPFTLdCJi76p tUAQ== X-Gm-Message-State: APzg51CdyyUn98EbEr4kd77/ZMFdHQ1GY8qJHHmiExI8C9Tkev/MLsfr 8I2BuS6qxtQlXouQziCo5YNFRZBv X-Google-Smtp-Source: ANB0Vda/TAEUTQiCJs+Zg3WKYr7CiCwVjjkUXO66rAhaTPnZOu8Ev0Qzl+LKmc03QDSsOA87iGvOTw== X-Received: by 2002:a17:902:4503:: with SMTP id m3-v6mr1667256pld.168.1536751270863; Wed, 12 Sep 2018 04:21:10 -0700 (PDT) Received: from cat-arch.lan (li1862-137.members.linode.com. [172.105.208.137]) by smtp.gmail.com with ESMTPSA id h12-v6sm1267826pfo.135.2018.09.12.04.21.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 04:21:09 -0700 (PDT) From: damenly.su@gmail.com X-Google-Original-From: suy.fnst@cn.fujitsu.com To: linux-btrfs@vger.kernel.org Cc: suy.fnst@cn.fujitsu.com Subject: [PATCH 1/6] btrfs-progs: adjust arguments of btrfs_lookup_inode_extref() Date: Wed, 12 Sep 2018 19:20:38 +0000 Message-Id: <20180912192046.5861-2-suy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912192046.5861-1-suy.fnst@cn.fujitsu.com> References: <20180912192046.5861-1-suy.fnst@cn.fujitsu.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 From: Su Yue The argument index is not used in btrfs_lookup_inode_extref(), so remove it. And adjust positions its arguments to make it consistent with kernel part. No functional change. Fixes: 260675657767 ("btrfs-progs: Import btrfs_insert/del/lookup_extref() functions.") Signed-off-by: Su Yue --- ctree.h | 6 +++--- inode-item.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ctree.h b/ctree.h index 4719962df67d..e7f6c5df95f1 100644 --- a/ctree.h +++ b/ctree.h @@ -2708,9 +2708,9 @@ int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, struct btrfs_key *location, int mod); struct btrfs_inode_extref *btrfs_lookup_inode_extref(struct btrfs_trans_handle - *trans, struct btrfs_path *path, struct btrfs_root *root, - u64 ino, u64 parent_ino, u64 index, const char *name, - int namelen, int ins_len); + *trans, struct btrfs_root *root, struct btrfs_path *path, + const char *name, int namelen, u64 ino, u64 parent_ino, + int ins_len); int btrfs_del_inode_extref(struct btrfs_trans_handle *trans, struct btrfs_root *root, const char *name, int name_len, diff --git a/inode-item.c b/inode-item.c index 1cc106670cd4..461557cb83d6 100644 --- a/inode-item.c +++ b/inode-item.c @@ -228,9 +228,9 @@ static int btrfs_find_name_in_ext_backref(struct btrfs_path *path, } struct btrfs_inode_extref *btrfs_lookup_inode_extref(struct btrfs_trans_handle - *trans, struct btrfs_path *path, struct btrfs_root *root, - u64 ino, u64 parent_ino, u64 index, const char *name, - int namelen, int ins_len) + *trans, struct btrfs_root *root, struct btrfs_path *path, + const char *name, int namelen, u64 ino, u64 parent_ino, + int ins_len) { struct btrfs_key key; struct btrfs_inode_extref *extref; From patchwork Wed Sep 12 19:20:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 10597385 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 BD70914DB for ; Wed, 12 Sep 2018 11:21:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD88A29B47 for ; Wed, 12 Sep 2018 11:21:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB95529BB3; Wed, 12 Sep 2018 11:21: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 8509029BAF for ; Wed, 12 Sep 2018 11:21:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726819AbeILQZV (ORCPT ); Wed, 12 Sep 2018 12:25:21 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:45207 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726082AbeILQZU (ORCPT ); Wed, 12 Sep 2018 12:25:20 -0400 Received: by mail-pg1-f194.google.com with SMTP id x26-v6so885923pge.12 for ; Wed, 12 Sep 2018 04:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2rDzUBiAXq8WeOya5qKO0dSqC2zbQBO5oRNMD/vUpdo=; b=JwsSBceiOMctOBueNkWao5OvWUhv8qgUDHTW+vMBlx5g7/VpH0s7IMAvdsLoahQ9tj QgNAPeVFWrYOgC0Orh583fdPMnqgzy+NtGNL4peTQ0Ov7Jp8m4C9Ix0pDyO8Wyd7eXWl I3p9N1NAPrCmduj59XEZAZ6/LTK6WxGP8d7b2iZ39bmipFot6W+gtC+LmDLkPIgoWeAn LnACEZfR4i/NI6i0K7zihtAmvHtDucsp+4Co2McPQjouXAQ+bGaqd2vtcmy+eOHq2y6U gGkHE4W/Mmny2/LZiT9sxB/9zyhysvRmQN7Tl34L7iFz2m8mnfwLUii6DKG3MoEt6J9e vMeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2rDzUBiAXq8WeOya5qKO0dSqC2zbQBO5oRNMD/vUpdo=; b=BUYDHhB++A+Md4HrfAhMvdaMfkPS4Z2kvXVovqAqIDdKNDtAIamnfgEfEuZYom70HG zMoIr8eWldOaY3IjUyGDJERDimdSb2ap12mV4MNrx5shjonpsobgu6+SyPezD/ai6i4X +cgd5/CEkiOpTMKXgFepyw/CSMC/J4KrtyQ8ytk+KP2zg9aqUyxWrsTJt0o5lEJfVrh7 AOGa/wE1fBcZNvE473JOvuP0dGDVKL6Qind9SK3Quokolh+HOapndydEuNGrQkonmcXB RL73dRe6vmLW4akJPsBTJaZX8+l54YN7vnVAGCIC70KLu61PZ7lPJBtIoKvQ1jJIqfDf zDMg== X-Gm-Message-State: APzg51Ank65Xu+u4a9eXmdrbZhgyFSnP5PkE+dXHGqnIjJWCjKisXn5S aBW4Fw7kK3LzR6+vZm5VROdN5o7L X-Google-Smtp-Source: ANB0Vdbo/EQOrLs79ddZELKEIg5ayvfhryB21mrOGfqry7YO/O1P1yzI5vPqqMCEJoEioDtIGMBsoA== X-Received: by 2002:a62:c218:: with SMTP id l24-v6mr1717570pfg.185.1536751274479; Wed, 12 Sep 2018 04:21:14 -0700 (PDT) Received: from cat-arch.lan (li1862-137.members.linode.com. [172.105.208.137]) by smtp.gmail.com with ESMTPSA id h12-v6sm1267826pfo.135.2018.09.12.04.21.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 04:21:13 -0700 (PDT) From: damenly.su@gmail.com X-Google-Original-From: suy.fnst@cn.fujitsu.com To: linux-btrfs@vger.kernel.org Cc: suy.fnst@cn.fujitsu.com Subject: [PATCH 2/6] btrfs-progs: make btrfs_unlink() lookup inode_extref Date: Wed, 12 Sep 2018 19:20:39 +0000 Message-Id: <20180912192046.5861-3-suy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912192046.5861-1-suy.fnst@cn.fujitsu.com> References: <20180912192046.5861-1-suy.fnst@cn.fujitsu.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 From: Su Yue btrfs_unlink() uses btrfs_lookup_inode_ref() to look up inode_ref but forget inode_extref case. Let btrfs_unlink() call btrfs_lookup_inode_extref() if inode_ref is found and EXTENDED_IREF feature is enabled. Fixes: 0cc75eddd093 ("btrfs-progs: Add btrfs_unlink() and btrfs_add_link() functions.") Signed-off-by: Su Yue --- inode.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/inode.c b/inode.c index 2398bca4a109..598ad0ab6b4c 100644 --- a/inode.c +++ b/inode.c @@ -277,6 +277,7 @@ int btrfs_unlink(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_key key; struct btrfs_inode_item *inode_item; struct btrfs_inode_ref *inode_ref; + struct btrfs_inode_extref *inode_extref = NULL; struct btrfs_dir_item *dir_item; u64 inode_size; u32 nlinks; @@ -296,7 +297,18 @@ int btrfs_unlink(struct btrfs_trans_handle *trans, struct btrfs_root *root, ret = PTR_ERR(inode_ref); goto out; } - if (inode_ref) + + if (!inode_ref && btrfs_fs_incompat(root->fs_info, EXTENDED_IREF)) { + btrfs_release_path(path); + inode_extref = btrfs_lookup_inode_extref(trans, root, path, + name, namelen, ino, parent_ino, 0); + if (IS_ERR(inode_extref)) { + ret = PTR_ERR(inode_extref); + goto out; + } + } + + if (inode_ref || inode_extref) del_inode_ref = 1; btrfs_release_path(path); From patchwork Wed Sep 12 19:20:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 10597387 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 7D46614E5 for ; Wed, 12 Sep 2018 11:21:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D3B029B99 for ; Wed, 12 Sep 2018 11:21:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BB4B29BA9; Wed, 12 Sep 2018 11:21:20 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 EABAD29BAE for ; Wed, 12 Sep 2018 11:21:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726860AbeILQZX (ORCPT ); Wed, 12 Sep 2018 12:25:23 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41151 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726082AbeILQZX (ORCPT ); Wed, 12 Sep 2018 12:25:23 -0400 Received: by mail-pg1-f196.google.com with SMTP id s15-v6so898011pgv.8 for ; Wed, 12 Sep 2018 04:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xTTQtBI48mgaANzzKeLeRM6T/v0WiYj9yaH6pULdaLY=; b=ag4g+L5IS4i85+DNNl0FIXRupB5nT3hTWhDCwyCXgXHOE96zSB8mgCtRapO+7dIAeV Jc5Pk7kH5ABh+kBxLwSxuzlUkpHVHVxuiAgXyduHpfEPvHmqMu+h80FsLLOnoBP4SVWt MR6dotD2Fkia8rKYPt1bCZWeeGiLKMAStS0A8TPGMT06qx/JWU9J9GMj/v9Ur7i8VZg9 L9chjTS7lOxN08rrbdIUo/7uSVF3RFExpjxK+XIXCWzWwxO9pLBIIov/Wzbw9M7cXsTe wx+rCFZ8ENnTz3Gx/EuoLZRYNG6ou6quNmYkCXKFZdgpsXhnnYuNEMVCv85mCf7Eko/b TDSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xTTQtBI48mgaANzzKeLeRM6T/v0WiYj9yaH6pULdaLY=; b=KZ0Wez2KseYl/ug/bckg6KUrQYfyrLhR+T0QL1mosboOCptD1K/EwL1RD2TqciSqQf 0jKxQ7yuLqNcBvSuXyl9V0NfwSlhvdFHoLYicaLTFTmlGTqGfNYPDAk61be3C88V4qsX /ol9FEUPnYfzq8fkUtiLnNH0qMbMGfP+zXf7E2pSqj/97e3Xqb+Hpj/uk805jMkkyesb CRULCYEzKPvrHJAEwMDHyCa7evlZri/w8GuB9R0jqV+BJykUk/TEmN8ZZ4ssKTya9phT dl7GslNVBnppfbXDcbgNJ2mSJtdhe85RwROAb3tkEcNwOwwtW2E7EdXdKVSrFzeTJkQJ HCFw== X-Gm-Message-State: APzg51CdBRrGgzxHKiZ4g0TnaRxLEDozklehuAN9CF9eVbO6Hml1lyrP HdD8lhiOsvcGXrgk6F/R6PCkFTFe X-Google-Smtp-Source: ANB0VdYimks12GOlt10JLZrDgjtVgRGAaIts/6b7vWhzQIs0fqDb/HcaSG+Ca7n66Ej32CHSPHN3MA== X-Received: by 2002:a63:6746:: with SMTP id b67-v6mr1705841pgc.330.1536751277730; Wed, 12 Sep 2018 04:21:17 -0700 (PDT) Received: from cat-arch.lan (li1862-137.members.linode.com. [172.105.208.137]) by smtp.gmail.com with ESMTPSA id h12-v6sm1267826pfo.135.2018.09.12.04.21.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 04:21:16 -0700 (PDT) From: damenly.su@gmail.com X-Google-Original-From: suy.fnst@cn.fujitsu.com To: linux-btrfs@vger.kernel.org Cc: suy.fnst@cn.fujitsu.com Subject: [PATCH 3/6] btrfs-progs: lowmem check: find dir_item by di_key in check_dir_item() Date: Wed, 12 Sep 2018 19:20:40 +0000 Message-Id: <20180912192046.5861-4-suy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912192046.5861-1-suy.fnst@cn.fujitsu.com> References: <20180912192046.5861-1-suy.fnst@cn.fujitsu.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 From: Su Yue In check_dir_item, we are going to search corresponding dir_item/index. Commit 564901eac7a4 ("btrfs-progs: check: introduce print_dir_item_err()") Changed argument name from key to di_key but forgot to change the key name for dir_item search. So @key shouldn't be used here. It should be @di_key. Fixes: 564901eac7a4 ("btrfs-progs: check: introduce print_dir_item_err()") Signed-off-by: Su Yue --- check/mode-lowmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 1bce44f5658a..89a304bbdd69 100644 --- a/check/mode-lowmem.c +++ b/check/mode-lowmem.c @@ -1658,7 +1658,7 @@ begin: /* check relative INDEX/ITEM */ key.objectid = di_key->objectid; - if (key.type == BTRFS_DIR_ITEM_KEY) { + if (di_key->type == BTRFS_DIR_ITEM_KEY) { key.type = BTRFS_DIR_INDEX_KEY; key.offset = index; } else { From patchwork Wed Sep 12 19:20:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 10597389 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 C3B6F14E5 for ; Wed, 12 Sep 2018 11:21:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B10E429BB2 for ; Wed, 12 Sep 2018 11:21:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A584329BB7; Wed, 12 Sep 2018 11:21:23 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 5188D29BB9 for ; Wed, 12 Sep 2018 11:21:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726912AbeILQZ1 (ORCPT ); Wed, 12 Sep 2018 12:25:27 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36624 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726082AbeILQZ1 (ORCPT ); Wed, 12 Sep 2018 12:25:27 -0400 Received: by mail-pg1-f196.google.com with SMTP id d1-v6so907948pgo.3 for ; Wed, 12 Sep 2018 04:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2lgbWTPOvhCAsaKaygFcTZYRMWFYqV5/XIukbiosfa0=; b=J19mP0336IX8vADwrJZFdtqLm2sSUykn2f8POVftshlOfizHZsNHLO0zX8F2rnDiJ+ rcpKFrTUv17jBKRJH1z7Se79CFJgLqoq/npVJnoPrnU6BWMs6kAMTku/x2lhiuGoFjo+ udjmAp0tnlgAZhRmZvHg2+2TeUpk08ai9ga4ulfcuxsUQQ6YVEH1DwEWcxiJ2DvZPmex 6NXmzr+0SJ3O4KZzPgr9c9HyL4fZUx1IKhbQGJH0+lmurJanD4nJkaCVOXlwUpfd6vP0 GY4UIuAPm9q94hVdlcJmzHiVhK61tiCBfa+AvqW8cUDd5tOpfXWOdYjGp9RUyw/tmJpH nysQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2lgbWTPOvhCAsaKaygFcTZYRMWFYqV5/XIukbiosfa0=; b=Y35w7FAluds2tW3FARpz4dB9gYeVvzqup7isXzqrpUwHn9r+wdhM7uRC1qd6rr7PDy GVJ8GMFUA/wNxkqVXXrBpy4cy3BSaT5i9DLLv6YhHl/E77oE2IiPkDA2tsumwEMjubKb iYd83Ivtfzqtg8vj29JDZecgEi0hBqi/blv7iT+P4iernd6uDNC9Ci3+FRbqh0f13Nff 7As5iwTMpIV9yqk/4g0WoN4kKNJHugocDKwuWG61nkGpmqvgjupxZnZvQtSDW7tiYzRn 6yzu/hIt+yUP40cPdAqBqmMLHmrCRPqKxO/C1+oMbuZKNKlSmxXxI/GPUqUgfjV847ap InBQ== X-Gm-Message-State: APzg51AIqS0j+SF2+NzEuvUjjtHEBNpcdZopCP0m+tL+p3NblIRWsHNu 1z6ETXx0KuhaO0nQGQ6K5KjJG+9S X-Google-Smtp-Source: ANB0VdaUrZVjXTZJae2rblOlp21tw2qr1Xq1yHpj+EENSilc54lJTdUoAJM6Vra99xHe194kfWk7gg== X-Received: by 2002:a65:448a:: with SMTP id l10-v6mr1711386pgq.382.1536751281194; Wed, 12 Sep 2018 04:21:21 -0700 (PDT) Received: from cat-arch.lan (li1862-137.members.linode.com. [172.105.208.137]) by smtp.gmail.com with ESMTPSA id h12-v6sm1267826pfo.135.2018.09.12.04.21.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 04:21:20 -0700 (PDT) From: damenly.su@gmail.com X-Google-Original-From: suy.fnst@cn.fujitsu.com To: linux-btrfs@vger.kernel.org Cc: suy.fnst@cn.fujitsu.com Subject: [PATCH 4/6] btrfs-progs: lowmem: search key of root again after check_fs_root() under repair Date: Wed, 12 Sep 2018 19:20:41 +0000 Message-Id: <20180912192046.5861-5-suy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912192046.5861-1-suy.fnst@cn.fujitsu.com> References: <20180912192046.5861-1-suy.fnst@cn.fujitsu.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 From: Su Yue In check_fs_roots_lowmem(), we do search and follow the resulted path to call check_fs_root(), then call btrfs_next_item() to check next root. However, if repair is enabled, the root tree can be cowed, the existed path can cause strange errors. Solution: If repair, save the key before calling check_fs_root, search the saved key again before checking next root. Signed-off-by: Su Yue --- check/mode-lowmem.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 89a304bbdd69..8fc9edab1d66 100644 --- a/check/mode-lowmem.c +++ b/check/mode-lowmem.c @@ -4967,9 +4967,13 @@ int check_fs_roots_lowmem(struct btrfs_fs_info *fs_info) } while (1) { + struct btrfs_key saved_key; + node = path.nodes[0]; slot = path.slots[0]; btrfs_item_key_to_cpu(node, &key, slot); + if (repair) + saved_key = key; if (key.objectid > BTRFS_LAST_FREE_OBJECTID) goto out; if (key.type == BTRFS_ROOT_ITEM_KEY && @@ -5000,6 +5004,17 @@ int check_fs_roots_lowmem(struct btrfs_fs_info *fs_info) err |= ret; } next: + /* + * Since root tree can be cowed during repair, + * here search the saved key again. + */ + if (repair) { + btrfs_release_path(&path); + ret = btrfs_search_slot(NULL, fs_info->tree_root, + &saved_key, &path, 0, 0); + /* Repair never deletes trees, search must succeed. */ + BUG_ON(ret); + } ret = btrfs_next_item(tree_root, &path); if (ret > 0) goto out; From patchwork Wed Sep 12 19:20:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 10597391 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 E1F1614DB for ; Wed, 12 Sep 2018 11:21:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF63329BB9 for ; Wed, 12 Sep 2018 11:21:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDB2B29BBF; Wed, 12 Sep 2018 11:21:26 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 6C6F929BBD for ; Wed, 12 Sep 2018 11:21:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726932AbeILQZa (ORCPT ); Wed, 12 Sep 2018 12:25:30 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:41017 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726082AbeILQZa (ORCPT ); Wed, 12 Sep 2018 12:25:30 -0400 Received: by mail-pl1-f193.google.com with SMTP id b12-v6so828449plr.8 for ; Wed, 12 Sep 2018 04:21:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ob6HC2Qr+/xkJ3W9+DCgrFS7bnUvOSciHzabJpvL+xQ=; b=JR/NaIpPJ+GRE6dh8ZryJSJ+2AUMVutc2fiJv1laJGGp4UT11ACxJmkchoV5lF0FvW 5203aA4zTNg6TthPlG1iqzpYqiTQ72FrJdOZzLgMQIeOOOY1MhGk8kOFROgDstXI7OOO InJa0kAdOym/7rasgc0Bcqgo5c56n7ETj8Mp1bBUxmviJJJaZGCq7IGPjq0UENEbkAOv DkdK1laJYC/+6PrSRpJJtajodvt+2JgiD+9bxZa33xMklk4M01gz4Jm/R+rAtpxjBJPb FG8sqCJSHGd+xaset1T5rE2e/UKOKlaQy8xAY5xxocCQV0dloJh2hqSgL0Ql3bkQ9Sw3 qmNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ob6HC2Qr+/xkJ3W9+DCgrFS7bnUvOSciHzabJpvL+xQ=; b=d2QSX49hxQ159wEHo1olnAnSnBA2zzyQap/LvLLqr++hUHiRSM31kgCzExpIJElvH1 ZZS0kEVseqzxcQyF0+FPnyufKXEEbF5VWG9wljw0OrQVd4GSpp3WGUC1HEOItDe8vL+/ tl6D/aXYm4T+96doFb0uWDPHO+eJSg4LlOf4lVJ1CxqdoF+1Zvgd3m/2lon6qavct4Xb +xGXM/uIHx6H6Aa9r+6IaIlrmHUDcoBlaG8goDPpHLKR8iRVgQZaiSiK/dNhJ2XV5Cww fbOTpU7GezEF67WMilByCE2h1Le8fosgqdAVMCMB7gqvChb8/5ORnBWi8g8Odc6HI2VM HyNw== X-Gm-Message-State: APzg51ARuL14CL1LoqmLeDifvNzLMQT/beNtGg39k6WymcW97qEdQrTG G95VdMYLHquf7H0eL/apfJiacJZ1 X-Google-Smtp-Source: ANB0VdaSgsM1eTiQ0gMMZFw6EyV+64yu5hliwm6KDrr/jam/hVsD3/J7Hth6u64RgJw8bJRxyzbQ+g== X-Received: by 2002:a17:902:b70f:: with SMTP id d15-v6mr1701723pls.53.1536751284375; Wed, 12 Sep 2018 04:21:24 -0700 (PDT) Received: from cat-arch.lan (li1862-137.members.linode.com. [172.105.208.137]) by smtp.gmail.com with ESMTPSA id h12-v6sm1267826pfo.135.2018.09.12.04.21.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 04:21:23 -0700 (PDT) From: damenly.su@gmail.com X-Google-Original-From: suy.fnst@cn.fujitsu.com To: linux-btrfs@vger.kernel.org Cc: suy.fnst@cn.fujitsu.com Subject: [PATCH 5/6] btrfs-progs: lowmem: continue to check item in last slot while checking inodes Date: Wed, 12 Sep 2018 19:20:42 +0000 Message-Id: <20180912192046.5861-6-suy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912192046.5861-1-suy.fnst@cn.fujitsu.com> References: <20180912192046.5861-1-suy.fnst@cn.fujitsu.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 From: Su Yue After call of check_inode_item(), path may point to the last unchecked slot of the leaf. The outer walk_up_tree() always treats the position as checked item then skips to next item. If the last item was an inode item, yes, it was unchecked. Then walk_up_tree() will think the leaf is checked and walk up to upper node, process_one_leaf() in walk_down_tree() would skip to check next inode item. Which means, the inode item won't be checked. Solution: After check_inode_item returns, if found path point to the last item of a leaf, decrease path slot manually, so walk_up_tree() will stay on the leaf. Fixes: 5e2dc770471b ("btrfs-progs: check: skip shared node or leaf check for low_memory mode") Signed-off-by: Su Yue --- check/mode-lowmem.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index 8fc9edab1d66..b6b33786d02b 100644 --- a/check/mode-lowmem.c +++ b/check/mode-lowmem.c @@ -2612,6 +2612,18 @@ again: if (cur->start == cur_bytenr) goto again; + /* + * path may point at the last item(a inode item maybe) in a leaf. + * Without below lines, walk_up_tree() will skip the item which + * means all items related to the inode will never be checked. + * Decrease the slot manually, walk_up_tree won't skip to next node + * if it occurs. + */ + if (path->slots[0] + 1 >= btrfs_header_nritems(path->nodes[0])) { + if (path->slots[0]) + path->slots[0]--; + } + /* * we have switched to another leaf, above nodes may * have changed, here walk down the path, if a node From patchwork Wed Sep 12 19:20:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 10597395 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 CA63914E5 for ; Wed, 12 Sep 2018 11:21:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA78929BAE for ; Wed, 12 Sep 2018 11:21:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ACE3229B97; Wed, 12 Sep 2018 11:21:34 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 56A7429BB7 for ; Wed, 12 Sep 2018 11:21:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727004AbeILQZi (ORCPT ); Wed, 12 Sep 2018 12:25:38 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:37281 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726082AbeILQZi (ORCPT ); Wed, 12 Sep 2018 12:25:38 -0400 Received: by mail-pf1-f194.google.com with SMTP id h69-v6so868728pfd.4 for ; Wed, 12 Sep 2018 04:21:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=80dw1GrQfWd3iinDFz8QweSCF4rq18djF9XT9YrdnQk=; b=dhTegkH4q4ND0V5Qc8P5PlVHjA5KaxMkJYlBpwtMj4LjQKnQG2s/r+fUFIAW5ojQ3l BaeCVT1PhbDr25e4LMDKoItYhGVWS17rSi3l7/49n5CFNqIZOEMPaAOKyawdORAaGPf0 Exkx19reTnOkYgwPhSNqD/uxr1fPFMGGY8ccUiYnyhLmK6IDKH99bosmQ1K5drzzevnX 1g8bgccnpnOLaZgbosYIe7b+gAZ8ALZXWjIl+MHaA/uJQ2tnJFBd3lD2rfKVCaUJT8Ul 1ctqVAk7psxLeupN9tUfvSjMxGypJXFd4A+ZbKCUkiUE0RGdf+IpYpQvPCzULrbfltx/ rZJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=80dw1GrQfWd3iinDFz8QweSCF4rq18djF9XT9YrdnQk=; b=DU13PAAKyn+doP4C5etMRyxAIovHDe0ks29ta00uv1GDRBNFtfj5gr+Dszo7sbLWym 3yfuLKit5mUQKg1C5mq2aICwqULkcC1kXYgUaZZpMhMA9yMTriQzpeoYMf0g1t+l/vnl 2+S2ZdQNVqbfAAqUN2G7GuvCxu/67jQ/6RJhfn7WrFzps08SMpYWg4s9QaroXeMPkv4k Z4S2f/COgs0Eh/3y9Dgg45fnpnXkOFV+NTkxL0Fm77OZmHarJjJtNfK+NYpHN9LYSiFv Y8QySAfaZep6Ku29Qjh6z/RMgaZ1wpvo97+bTRC1s3uU5lS05I+m3kat+snG1xthhY7R DQxA== X-Gm-Message-State: APzg51Bh6lCPLKos6gvBYNOi1URlNqpJnSyNTB396vTeCdNAdWqJmx0H hcoKEQ4OA3fBSov0UJ3z72+nEoe/ X-Google-Smtp-Source: ANB0VdZlrwjH46xasFOQDkjvfiGREFGv0ZCOgEobEdpU+jxXTBfko8uGyH9IIhNdxUPUX98U656UtQ== X-Received: by 2002:a63:991a:: with SMTP id d26-v6mr1694290pge.159.1536751291792; Wed, 12 Sep 2018 04:21:31 -0700 (PDT) Received: from cat-arch.lan (li1862-137.members.linode.com. [172.105.208.137]) by smtp.gmail.com with ESMTPSA id h12-v6sm1267826pfo.135.2018.09.12.04.21.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 04:21:30 -0700 (PDT) From: damenly.su@gmail.com X-Google-Original-From: suy.fnst@cn.fujitsu.com To: linux-btrfs@vger.kernel.org Cc: suy.fnst@cn.fujitsu.com Subject: [PATCH 6/7] btrfs-progs: lowmem: continue to check item in last slot while checking inodes Date: Wed, 12 Sep 2018 19:20:44 +0000 Message-Id: <20180912192046.5861-8-suy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912192046.5861-1-suy.fnst@cn.fujitsu.com> References: <20180912192046.5861-1-suy.fnst@cn.fujitsu.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 From: Su Yue After call of check_inode_item(), path may point to the last unchecked slot of the leaf. The outer walk_up_tree() always treats the position as checked item then skips to next item. If the last item was an inode item, yes, it was unchecked. Then walk_up_tree() will think the leaf is checked and walk up to upper node, process_one_leaf() in walk_down_tree() would skip to check next inode item. Which means, the inode item won't be checked. Solution: After check_inode_item returns, if found path point to the last item of a leaf, decrease path slot manually, so walk_up_tree() will stay on the leaf. Fixes: 5e2dc770471b ("btrfs-progs: check: skip shared node or leaf check for low_memory mode") Signed-off-by: Su Yue --- check/mode-lowmem.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c index b665c700328c..bec2ee185cc8 100644 --- a/check/mode-lowmem.c +++ b/check/mode-lowmem.c @@ -2677,6 +2677,18 @@ again: if (cur->start == cur_bytenr) goto again; + /* + * path may point at the last item(a inode item maybe) in a leaf. + * Without below lines, walk_up_tree() will skip the item which + * means all items related to the inode will never be checked. + * Decrease the slot manually, walk_up_tree won't skip to next node + * if it occurs. + */ + if (path->slots[0] + 1 >= btrfs_header_nritems(path->nodes[0])) { + if (path->slots[0]) + path->slots[0]--; + } + /* * we have switched to another leaf, above nodes may * have changed, here walk down the path, if a node From patchwork Wed Sep 12 19:20:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 10597399 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 274B614E5 for ; Wed, 12 Sep 2018 11:21:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 126F029BAF for ; Wed, 12 Sep 2018 11:21:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05EE029BB6; Wed, 12 Sep 2018 11:21:44 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 A437929BDA for ; Wed, 12 Sep 2018 11:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727019AbeILQZq (ORCPT ); Wed, 12 Sep 2018 12:25:46 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:34739 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726082AbeILQZq (ORCPT ); Wed, 12 Sep 2018 12:25:46 -0400 Received: by mail-pg1-f196.google.com with SMTP id d19-v6so914235pgv.1 for ; Wed, 12 Sep 2018 04:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WH9R74tAHEiQvmoI8Is8Q2vzIXkZSAxkIRJmdKx7KVE=; b=O2G4nGO3zqF5kFZKoqnBuHd1+pVKdLCGX+LqOCVQivwcXxxBi6SJTekPtaUJqztgWu XT7EGyXTVcjvRZsI5yBWyoAi+Q540gBvHmA3TnviDApxOMDHxJWxyaUw9IWMu2jg0tA6 eNdpN6s3nnaJ+ZCwxPx61BGuTWvSqWTesRPJb7Q3MDBprjogXofEudQkbyGAgA9mxjKc 2Mfm5JJPyOZALPfktiqoNih1OD6/YDoT/hdWD5pOn8jg8iwhcuvtEBHSHdWD53VpG44X zqoJ4tRwecKdGbKpaYT23+kat+yS0QcrEd2+dYferj8J/69oRQteHibMGoH2BYEAY+Db PJ3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WH9R74tAHEiQvmoI8Is8Q2vzIXkZSAxkIRJmdKx7KVE=; b=IGlprRFEooCPHBEu9TF/Lah4SrrxPadufDat/7cX/pXUWa7m2ufD2MKkZSkRQe778o i/k3eIboEYfn1IOJAl4vaVgY5lJrXohRbUTy+4ZpSiYahJmP3Hl71kg+IXAG1WncymuX pUuCuUEgRdajcutSmMkOqFl+GiaymjTo8OLJnzAQehCmCYmxZ7IAQZPJGlDmjtB5ZTI0 I/5sStDVjO+a4xwmKWEXGpqlAjoAT25LAKSdVRcMDLwtIMOc0lKtTrrlufkfJGJZ86eB ZlMrxDK8vcL1ses2gL+LXtaK4xDYIX6bLCrasw7qRFmZpFrCvms4rBrqH7q31yqb63Eq IBaA== X-Gm-Message-State: APzg51ByubmPOAS2H1/y0fNcBzKXw8icnypvi1EjtgTRhtaVQyEi2fjq 6zaPlUETKmtrekkEeldvlRZAEh0m X-Google-Smtp-Source: ANB0VdaaIj+8xx349GLoGkJi22qLOanWz8tN3jMgcdLwYN4XQRHppcsE36MNfHEpI/GZcsf4YbK0MQ== X-Received: by 2002:a62:a216:: with SMTP id m22-v6mr1705956pff.163.1536751299206; Wed, 12 Sep 2018 04:21:39 -0700 (PDT) Received: from cat-arch.lan (li1862-137.members.linode.com. [172.105.208.137]) by smtp.gmail.com with ESMTPSA id h12-v6sm1267826pfo.135.2018.09.12.04.21.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 04:21:38 -0700 (PDT) From: damenly.su@gmail.com X-Google-Original-From: suy.fnst@cn.fujitsu.com To: linux-btrfs@vger.kernel.org Cc: suy.fnst@cn.fujitsu.com Subject: [PATCH 7/7] btrfs-progs: fsck-tests: add test case inode_extref without dir_item and dir_index Date: Wed, 12 Sep 2018 19:20:46 +0000 Message-Id: <20180912192046.5861-10-suy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912192046.5861-1-suy.fnst@cn.fujitsu.com> References: <20180912192046.5861-1-suy.fnst@cn.fujitsu.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 From: Su Yue This case contains an inode_extref: ========================================== ... item 1 key (257 INODE_EXTREF 3460996356) itemoff 3947 itemsize 24 index 257 parent 256 namelen 6 name: foo255 ... ========================================== The related dir_item and dir_index are missing. Add the case to ensure both original and lowmem mode check can handle the case of inode_extref. Lowmem part is supported since patch named 'btrfs-progs: lowmem: improve check_inode_extref()'. And rename default_case.img to inode_ref_without_dir_item_index.img. Signed-off-by: Su Yue --- .../inode_extref_without_dir_item_index.img | Bin 0 -> 10240 bytes ...=> inode_ref_without_dir_item_and_index.img} | Bin 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/fsck-tests/009-no-dir-item-or-index/inode_extref_without_dir_item_index.img rename tests/fsck-tests/009-no-dir-item-or-index/{default_case.img => inode_ref_without_dir_item_and_index.img} (100%) diff --git a/tests/fsck-tests/009-no-dir-item-or-index/inode_extref_without_dir_item_index.img b/tests/fsck-tests/009-no-dir-item-or-index/inode_extref_without_dir_item_index.img new file mode 100644 index 0000000000000000000000000000000000000000..85f7a8211fe66dfa9b2b1f3a98e72f54cd402616 GIT binary patch literal 10240 zcmeHscQo8j8?UlhEOymZqDGCfdWp7rf~Y~1#Of{4q9>NMSe=L(Wkn}~5JZVy61@b` zOY|NsBwmBv=mszSgNy&l!H|F1 z$NlwH{s)Ks?ejn7KN0v(1pZ$}z<*}eU&ND$kky0Zga5{R>1!Q|jBj!Kk_IdwP^`75 zM#+ojWKDf@k7f}D9aT8qYmSi4F2VupuXr{D%*M11tY*yA57Z39C|MYjWMVhzVK5j1 zieWerkiPZjcdzsBS22#CPt1DVI!`Y9h*_LYFoYww&j3lOEQw=`DnvA?wF8(}YD85$ zG7$zaGL3dVC{eyOEl3W_-qsf~#zJSUyqf<-HM2v|!&%~jSR%lz|08~jx;7^e3~;sY zT^phzaQf-A9pzJu&sDmw_AnE#I*l;xF8RnBNniHgj!g0JPRgY|`OkhQSmPV3fQT{G?g$ZX6e{@Ov^aKMAG zr|O5JwU)}O00QwdZZ<+yyfQ#~Ka9r6hA@3Oik}0|;rd7T)~&xIk460t)3|9Uli=;g zh~{}Qn(6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ux|S|eHR3U1lG_jWC>Zp*;2>kJ3OqxYzE%bSL;zHl{S5Dkaf8a70Aw@{uA6NX zA&Ci{nIgs#5Zb$>hG9D4Rl9~OH0oCjrLkLBE9>bQ}K={nB1A~ zoZVt=*ErXTr;~?hvu3zJxXZeE427umK29?hMXxdzCFd*NFB&Eo7BA4owl>%n>Z3*C zU@ryiBYu6q1sb)%#I=Ey;yHRuLKS6vBSalAM0$E@Znj$SeTm9Za=D;e^jkae#TL7u zop{9Q*i=kkmFf(1#nC>BUR#aP*L>lAHec!>dMy@#iBr}q>C~VS?F?Mr8h6h3(1c8;nAltM4PK(Hw8o8Nj2PVLWOH2NyUJs=e(u@092# kuJE&u`WfiUR27hTDGCa0|Gszr5C2aD{u6=!zasEo0Lh(cb^rhX literal 0 HcmV?d00001 diff --git a/tests/fsck-tests/009-no-dir-item-or-index/default_case.img b/tests/fsck-tests/009-no-dir-item-or-index/inode_ref_without_dir_item_and_index.img similarity index 100% rename from tests/fsck-tests/009-no-dir-item-or-index/default_case.img rename to tests/fsck-tests/009-no-dir-item-or-index/inode_ref_without_dir_item_and_index.img