From patchwork Wed Dec 10 20:51:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mwilck@arcor.de X-Patchwork-Id: 5472401 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 62150BEEA8 for ; Wed, 10 Dec 2014 21:05:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 08427201B4 for ; Wed, 10 Dec 2014 21:05:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2DA482018E for ; Wed, 10 Dec 2014 21:05:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933300AbaLJVFj (ORCPT ); Wed, 10 Dec 2014 16:05:39 -0500 Received: from mail-in-05.arcor-online.net ([151.189.21.45]:35401 "EHLO mail-in-05.arcor-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933296AbaLJVFi (ORCPT ); Wed, 10 Dec 2014 16:05:38 -0500 Received: from mail-in-01-z2.arcor-online.net (mail-in-01-z2.arcor-online.net [151.189.8.13]) by mx.arcor.de (Postfix) with ESMTP id DC1EAE3E94 for ; Wed, 10 Dec 2014 22:05:36 +0100 (CET) Received: from mail-in-10.arcor-online.net (mail-in-10.arcor-online.net [151.189.21.50]) by mail-in-01-z2.arcor-online.net (Postfix) with ESMTP id D96937DA0FF; Wed, 10 Dec 2014 22:05:36 +0100 (CET) X-Greylist: Passed host: 188.96.131.100 X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-10.arcor-online.net AF35C2D65F5 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arcor.de; s=mail-in; t=1418245536; bh=A81BWUqx1+sY1M55ptUX/yqBd3pckwWT5tcg502Kh6w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=TyhoN33vIAMpO4alHUh2BvGkQhF0dEBGLzdcsuizKGDb21R1SqHNDCar8cESLG0Bv hbUXocGt7e81vdJhScp4jnXiAt/eVBKF+XMf2pbSUydWETaRX2YYUFn8wZSbKCfRMl d9P/rZEPU7VVi4+AlakDkZOnJfEYueiCTT99N7D0= X-Greylist: Passed host: 188.96.131.100 Received: from localhost.localdomain (dslb-188-096-131-100.188.096.pools.vodafone-ip.de [188.96.131.100]) (Authenticated sender: mwilck@arcor.de) by mail-in-10.arcor-online.net (Postfix) with ESMTPSA id AF35C2D65F5; Wed, 10 Dec 2014 22:05:36 +0100 (CET) From: mwilck@arcor.de To: linux-btrfs@vger.kernel.org Cc: mwilck@arcor.de Subject: [PATCH 01/18] btrfs-progs: btrfs-debug-tree: add option -f for "block only" Date: Wed, 10 Dec 2014 21:51:31 +0100 Message-Id: <1418244708-7087-2-git-send-email-mwilck@arcor.de> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1418244708-7087-1-git-send-email-mwilck@arcor.de> References: <1418244708-7087-1-git-send-email-mwilck@arcor.de> 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 From: Martin Wilck btrfs-debug-tree prints only the given block. It is sometimes useful to be able to print the subtree under this block. This patch enables this behavior with the option "-f". Signed-off-by: Martin Wilck --- btrfs-debug-tree.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/btrfs-debug-tree.c b/btrfs-debug-tree.c index e46500d..e61c71c 100644 --- a/btrfs-debug-tree.c +++ b/btrfs-debug-tree.c @@ -41,6 +41,8 @@ static int print_usage(void) fprintf(stderr, "\t-u : print info of uuid tree only\n"); fprintf(stderr, "\t-b block_num : print info of the specified block" " only\n"); + fprintf(stderr, "\t-f : (with -b) follow subtree of the specified" + " block\n"); fprintf(stderr, "\t-t tree_id : print only the tree with the given id\n"); fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION); @@ -137,6 +139,7 @@ int main(int ac, char **av) int roots_only = 0; int root_backups = 0; u64 block_only = 0; + int block_follow = 0; struct btrfs_root *tree_root_scan; u64 tree_id = 0; @@ -144,7 +147,7 @@ int main(int ac, char **av) while(1) { int c; - c = getopt(ac, av, "deb:rRut:"); + c = getopt(ac, av, "defb:rRut:"); if (c < 0) break; switch(c) { @@ -167,6 +170,9 @@ int main(int ac, char **av) case 'b': block_only = arg_strtou64(optarg); break; + case 'f': + block_follow = 1; + break; case 't': tree_id = arg_strtou64(optarg); break; @@ -211,7 +217,7 @@ int main(int ac, char **av) (unsigned long long)block_only); goto close_root; } - btrfs_print_tree(root, leaf, 0); + btrfs_print_tree(root, leaf, block_follow); goto close_root; }