From patchwork Fri Oct 31 18:01:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 5206201 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 11D639F349 for ; Fri, 31 Oct 2014 18:01:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1E69F2013D for ; Fri, 31 Oct 2014 18:01:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 392FF2013A for ; Fri, 31 Oct 2014 18:01:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753468AbaJaSBs (ORCPT ); Fri, 31 Oct 2014 14:01:48 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:25504 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750808AbaJaSBr (ORCPT ); Fri, 31 Oct 2014 14:01:47 -0400 Received: from pps.filterd (m0004003 [127.0.0.1]) by mx0b-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id s9VHsJWK020465; Fri, 31 Oct 2014 11:01:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=FdDnX6Kd0yjKW8VwXjXecjyqONd0Ltmp4rsEbVmMN/o=; b=NcST9AzP/5p5gHNt4YjfxMhv/egFze/odk7Gfjmub3/wMZ5cv45pa/m/0H91a+yoWS/d gSBQWojfMHJGYWGYiRcYjWzAfXA3fxT+xklDm4bs7OvTwMRdytLyd34j3jtH/WXMuZ/t Q7LrodmonDR0/AHPEUggNq8+tHLn5ZK8wGk= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 1qcd368ra7-8 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK); Fri, 31 Oct 2014 11:01:45 -0700 Received: from localhost (192.168.57.29) by mail.thefacebook.com (192.168.16.16) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 31 Oct 2014 11:01:40 -0700 From: Josef Bacik To: , Subject: [PATCH 03/11] Btrfs-progs: allow fsck to take the tree bytenr Date: Fri, 31 Oct 2014 14:01:21 -0400 Message-ID: <1414778489-4049-4-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1414778489-4049-1-git-send-email-jbacik@fb.com> References: <1414778489-4049-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 X-Originating-IP: [192.168.57.29] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.12.52, 1.0.28, 0.0.0000 definitions=2014-10-31_08:2014-10-31, 2014-10-31, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=2.87009407511322 compositescore=0.980601274849849 urlsuspect_oldscore=0.980601274849849 suspectscore=0 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=64355 rbsscore=0.980601274849849 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1410310168 X-FB-Internal: deliver Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Sometimes we have a pretty corrupted fs but have an old tree bytenr that we could use, add the ability to specify the tree root bytenr. Thanks, Signed-off-by: Josef Bacik Tested-by: Ansgar Hockmann-Stolle --- cmds-check.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index 2a5f823..38f8d11 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -7546,6 +7546,7 @@ static struct option long_options[] = { { "backup", 0, NULL, 0 }, { "subvol-extents", no_argument, NULL, 'E' }, { "qgroup-report", 0, NULL, 'Q' }, + { "tree-root", 1, NULL, 'r' }, { NULL, 0, NULL, 0} }; @@ -7561,6 +7562,7 @@ const char * const cmd_check_usage[] = { "--check-data-csum verify checkums of data blocks", "--qgroup-report print a report on qgroup consistency", "--subvol-extents print subvolume extents and sharing state", + "--tree-root use the given bytenr for the tree root", NULL }; @@ -7571,6 +7573,7 @@ int cmd_check(int argc, char **argv) struct btrfs_fs_info *info; u64 bytenr = 0; u64 subvolid = 0; + u64 tree_root_bytenr = 0; char uuidbuf[BTRFS_UUID_UNPARSED_SIZE]; int ret; u64 num; @@ -7581,7 +7584,7 @@ int cmd_check(int argc, char **argv) while(1) { int c; - c = getopt_long(argc, argv, "as:b", long_options, + c = getopt_long(argc, argv, "as:br:", long_options, &option_index); if (c < 0) break; @@ -7608,6 +7611,9 @@ int cmd_check(int argc, char **argv) case 'E': subvolid = arg_strtou64(optarg); break; + case 'r': + tree_root_bytenr = arg_strtou64(optarg); + break; case '?': case 'h': usage(cmd_check_usage); @@ -7651,7 +7657,8 @@ int cmd_check(int argc, char **argv) if (repair) ctree_flags |= OPEN_CTREE_PARTIAL; - info = open_ctree_fs_info(argv[optind], bytenr, 0, ctree_flags); + info = open_ctree_fs_info(argv[optind], bytenr, tree_root_bytenr, + ctree_flags); if (!info) { fprintf(stderr, "Couldn't open file system\n"); ret = -EIO;