From patchwork Wed Jun 7 09:59:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13270334 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22B67C77B7A for ; Wed, 7 Jun 2023 10:00:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240149AbjFGKAs (ORCPT ); Wed, 7 Jun 2023 06:00:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238911AbjFGKAp (ORCPT ); Wed, 7 Jun 2023 06:00:45 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15E911735 for ; Wed, 7 Jun 2023 03:00:44 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3576Jrn0011465 for ; Wed, 7 Jun 2023 10:00:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=fXmR+Pb1c8prEnEQkYNE7BKalV5Bl2iF+OlONFwjVpQ=; b=tHvEk8Krs9HS4yRZfYmqAcjpzh2TyvpEVMEiDlt1Y2I8DzdtvjM3jnbgL0EqDZY5BTtq zz7K9Iq8H4SwUaC/GZuIPMzQFrcFRJco2ZoyMOnGv229LUQOOYELejeoJ74l71O3lT0e aSQ/qU9sgIoPGsuMT3rV4Ff3KvwQBq4aZwWc76O91yx9FpO32ZbSL415EQJeNRy7etzw OLGx+IHqy9V7AZcZ1SuHdyMAcXwL9DL5ZW0gbkCkec012i1DBivzfILjvCJmKZwCJcw3 hNFMgFQN3QAAT5ll8cW4kTM+TH7PSPXZpscx4yL1hI098oHCIRrI8NuFRQdhqvR2kEED ng== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r2a6uscvu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 07 Jun 2023 10:00:43 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3579e7X6036887 for ; Wed, 7 Jun 2023 10:00:43 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r2a6h12hv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 07 Jun 2023 10:00:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Aux7HxiwHKNAl7DrzvkRIeuiBHBqmyp7JvyqQso/Zq5cevQxpgwk0Wfn2KJ83s8DyGmg7drw5/T95D4tlmWXS/VSzOJ+f7eQhbvIZaOm1nzxXvp3X0a6kmHsfWt+v/g3s5gvNIzg1Gg5qbyHyfQU20wLfCs1stp7vO2yHaWcRkKIBcsZlhuJVzx+bpGcekOctyLRxlsbnB6ykqT6DlMMGmv59fgsSUHIlBjKdZhXrpwWaGMiGGwNkcaGxiHbLTKzDAGaEOf3B9BD1gAIM4KYdJUcG6vspB0HX68tX6mEUa00Fv4BYfMT+lnlHNOC7trKmHfMIFn8OrZSC4EHF4zr8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fXmR+Pb1c8prEnEQkYNE7BKalV5Bl2iF+OlONFwjVpQ=; b=CzfOR5zGO3tAy4iue9V/zwcluZyy7hMqyrhK6+fcvtFCBJxgXksUdgLPgmy8rOn6Jc7IOG8/KWWmXhFL59u53XaNRHmFC2v0ZzaU71UyuycYbnbw2TxUqL7j7Xq/BiUUhehylPOvwd6d/69DbCIH9N6EEgwmQvZT8QxL0MlgnhNDShmSRUgbD7S2Li4JfJZwIjtbZAwObqxMnMBzkWnN2lKQMXvzahxbKFefab0rime6wzBpld23V1FJZkkd3INJ8Z0HsA5UK9J4U6dWBXCzccU8DwFxPn/HDj0tKAFHrUSw8tqgKB3T5gtsTU4nJpcsaf2dmEXO5KaIoo15hMY0EA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fXmR+Pb1c8prEnEQkYNE7BKalV5Bl2iF+OlONFwjVpQ=; b=neovJfgayZ/YCosmzYwaX2MbWGwAjQIFAS+WPmgjIxffeTS4y4BT5VWch9ipZhBNLi2U1mkehSiFQS9fk+y/pnxCGGyV50VP8pNJOT/Qni0Pd0cSoMsrEeuJQtRA1l+bFnipNXrmiHyPxkS2waPBh2zZUGPoPSJYOOxcUW5+fWo= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SA2PR10MB4762.namprd10.prod.outlook.com (2603:10b6:806:114::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Wed, 7 Jun 2023 10:00:40 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::bc67:ac75:2c91:757e%7]) with mapi id 15.20.6455.030; Wed, 7 Jun 2023 10:00:40 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 09/11] btrfs-progs: tune: add noscan option Date: Wed, 7 Jun 2023 17:59:14 +0800 Message-Id: <2e199f307c89151e46d9b66193259ad53eb04595.1686131669.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SGXP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::17) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SA2PR10MB4762:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ca8affb-e6b3-45b6-f859-08db673e0ca8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IgW8BDDMU3eMQ+7pCt4d1E7AhV2qsmqglWWZawK6yrEbILK8Refid35mbMEI/z/oMaoou0JWLqbPufbmVlnUzJZ3n+pGvbFAtjOQJ9+h5/JbzqZo7xEulmLU6m7PEmsee+Ib+HDOScj7KQN86/b2E72wTgBp+2N65FvsJOqX+emTKbhtVpoxgd6twYUVc0GNEZve8p8IN9vt+Glo3e3QJk9prxgOuKUf+GdlZSaxlYDu+GxPQsvAJUzy46uTv4s6n3PYveLdg5xNqx36ELqnivT7BvR0CCUHPfCjoNEYF1cCBtDAAkvmS8J5VXETV8995HI/RDlMmx1T8Ec/ceFS+W/apXOCSyfVl2KCuutxqlFw+X2rKJib0L0a69oUgqkATfWOJ4HvdtBW11kTFF6tSawk107GppflE/8K/FeMnkmzlSQhCDtBr75SzLyXW9qHjlUJTJbfqmj+Wt+di1s9oN5gMxCPUHnFwhjCLMse0IyY9r6EhaBjVYTi/bhKL8hzdm63raOKeGUW8JCPptztueiBC/Q2Gx2ji2Sf0lDW0xU0Ml896xBlBu5VwXv0APJD3cTRknfJfOjsXTHt4wjatSQudthPD6DthM0sTCVAe0gkvT3qOrPFV4yJkZnzzx86 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(346002)(366004)(376002)(396003)(136003)(451199021)(83380400001)(2906002)(2616005)(36756003)(86362001)(38100700002)(41300700001)(6486002)(316002)(6666004)(5660300002)(107886003)(8936002)(8676002)(478600001)(66556008)(66946007)(66476007)(6916009)(4326008)(6506007)(6512007)(26005)(186003)(44832011)(461764006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: V07K399cr587SbtwvTpjZf90Ec3vAKxMDvpJp0pjGDNgM6sb54Zm4c1Q5X2NyRHZAU79R7gVMVb3soBKTtZ30La7ivsRqsJXJkuxoRKPsl4efTKRqk0L8piSpOR10ap6jmOUpic51MDMonyAFYqyzg6kccaCWy9WXTpmtMk+YioTgHKp69g4rlTFH93OsuGhMunZf3tqON58bc+PA7esKER8fcM+9rX17dyM/d6uTuWkoEFJ3TZLE4lc18JqN0LiLgsvxbejyEb06zJawZnIRBeX+AH3RppUfGcMcts3MW25K3Q3a3wularYTaMvoJIW5CiidbVWWwmGhkzi8eiVIY3H0f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riginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ca8affb-e6b3-45b6-f859-08db673e0ca8 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 10:00:40.3666 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MVkiz6ytejh9472tmXJCdn8yNMTUbd6GSeRbfMZ/YcMnYnypg/I9utSqWKvY+bjPUAf3qwGf9vAB8/+qxWAACw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4762 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-07_06,2023-06-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306070081 X-Proofpoint-GUID: 9PMN8DXlsefnW65UwY3BiT4wcXWVpvV_ X-Proofpoint-ORIG-GUID: 9PMN8DXlsefnW65UwY3BiT4wcXWVpvV_ Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Signed-off-by: Anand Jain --- tune/main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tune/main.c b/tune/main.c index 9a6223f4aa0c..fa49f1685e0f 100644 --- a/tune/main.c +++ b/tune/main.c @@ -143,6 +143,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) bool to_extent_tree = false; bool to_bg_tree = false; bool to_fst = false; + bool noscan = false; int csum_type = -1; char *new_fsid_str = NULL; int ret; @@ -155,7 +156,8 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) enum { GETOPT_VAL_CSUM = GETOPT_VAL_FIRST, GETOPT_VAL_ENABLE_BLOCK_GROUP_TREE, GETOPT_VAL_DISABLE_BLOCK_GROUP_TREE, - GETOPT_VAL_ENABLE_FREE_SPACE_TREE }; + GETOPT_VAL_ENABLE_FREE_SPACE_TREE, + GETOPT_VAL_NOSCAN }; static const struct option long_options[] = { { "help", no_argument, NULL, GETOPT_VAL_HELP}, { "convert-to-block-group-tree", no_argument, NULL, @@ -167,6 +169,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) #if EXPERIMENTAL { "csum", required_argument, NULL, GETOPT_VAL_CSUM }, #endif + { "noscan", no_argument, NULL, GETOPT_VAL_NOSCAN }, { NULL, 0, NULL, 0 } }; int c = getopt_long(argc, argv, "S:rxfuU:nmM:", long_options, NULL); @@ -224,6 +227,10 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) csum_type = parse_csum_type(optarg); break; #endif + case GETOPT_VAL_NOSCAN: + ctree_flags |= OPEN_CTREE_NO_DEVICES; + noscan = true; + break; case GETOPT_VAL_HELP: default: usage(&tune_cmd, c != GETOPT_VAL_HELP); @@ -268,7 +275,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) } ret = check_mounted_where(fd, device, NULL, 0, NULL, - SBREAD_IGNORE_FSID_MISMATCH, false); + SBREAD_IGNORE_FSID_MISMATCH, noscan); if (ret < 0) { errno = -ret; error("could not check mount status of %s: %m", device); @@ -289,7 +296,6 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) return 1; root = open_ctree_fd(fd, device, 0, ctree_flags); - if (!root) { error("open ctree failed"); return 1;