From patchwork Tue Jun 13 10:26:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13278323 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 2CA33C7EE2E for ; Tue, 13 Jun 2023 10:27:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238134AbjFMK14 (ORCPT ); Tue, 13 Jun 2023 06:27:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239013AbjFMK11 (ORCPT ); Tue, 13 Jun 2023 06:27:27 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C996173F for ; Tue, 13 Jun 2023 03:27:20 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35D65XTi028790; Tue, 13 Jun 2023 10:27:15 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=tQoUgU10NfXxtTmRfy17b1vMg23I/Iuw1Sazxxo3rPk=; b=02GxCLbIAZvfsXIVNwyHm5cS+EVBFZEbpRzIb3YXPg3wJvc8AlMVCds812ubr7F9uVsN Cb0W6mBfYDtnhyfq2EBFFqv4/BFI7+6MwgiAFDoqn1wlDussY8bpazUDSVHW2bE8GLge aEXN68RkJOZ4trsiom1pSALYcATitwY8M0QCRg6AOrVxOCMCz7eARzor7cdx2xe7x9FV b55rwXdPSMQ19fwZUD1QAGvu+XwA2iw8y7iKwlpsAhtNtqosA/1biqL2mWcMmkg+A01L 1GZlPcAxiH4lHlqJevQPyfT/evEVCIRQo2aS+NZByTmYsJRsyFzxMckERQ2VPbfiBp1M rw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fkdmua6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Jun 2023 10:27:15 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35DA5f32008927; Tue, 13 Jun 2023 10:27:15 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm47v2u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Jun 2023 10:27:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mmDaLtzJfnSFCmIo2AtM6t6V3oGoWTW+GQLpXHtHGbs6DroPhyUgZf36w1IYZOzrloyuiFiucV4MnrTRMIpNV8k+0Rluax8ytvsw6kuFEPy4R+yJjiCD/RHWx4MMdmdLEAxqCH6oFHEvTr5rNzT/KVoLd3/DuI0vhYxI9b+eOKtUmA9btnTS3scGVV0K6fcac5Kb5UmO1GwS6uGfdi2TbjlOece0SupzIybSeAh7lXMNP16+nbALFPiplN2geEXktqX5n7JzkIW6HyoMZ+cky9IBGsJ30eHXljShIsRu2pgUp6oO6GljSU1IIpd59WPJYTib8vcnCjXjHr3hZfrWZQ== 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=tQoUgU10NfXxtTmRfy17b1vMg23I/Iuw1Sazxxo3rPk=; b=bPmlMSNC9MxDIQnRNJnfHc1uNsP9EMx3RXXPXUbY5p6oCDD6uHTV9/WA9CwfWWjYOB3B9L/IndfBpnotCIP2jR28+NbCLJ73WiKJuRg5uDHnQOlVrphbZqkVc6mr6nObJuva2AADbTpod2MHVOUmi+CAFB5HS8yaiSybFs9yD42/zsx88x7Db0eaV1DTKZARyKNa8whDjQ0sJFh5a+fu3EbsAnJvzLje3Bt0Nt9lBy8UjyEMHjzr9A5fDPV6J3BZgtby3QkKx87sKI4ppPh5rU+IO0EedKkP7n7Rv/NLTOqG/LeuM7miVr88JZgwhhv6dykCvSqdnln7frZJXrxvSA== 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=tQoUgU10NfXxtTmRfy17b1vMg23I/Iuw1Sazxxo3rPk=; b=Exrdzd55QZB7+ZErYP1mq7bZ40oDRv37RGMs3vq8pR1HiaIxZgvEvFBikSzPfYa4d+SAtFgFTLBV3SAQS99cbngxeVDhDA18+krzLoC7LYeQCRAyLSn4z9y+8NT31X1PH/ifFNafLnz0aUy2bPbZrnxtg7V3EsHLzkECjKENavo= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by MW5PR10MB5716.namprd10.prod.outlook.com (2603:10b6:303:1a3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 13 Jun 2023 10:27:12 +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.6477.028; Tue, 13 Jun 2023 10:27:12 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Qu Wenruo Subject: [PATCH 1/6] btrfs-progs: check_mounted_where: declare is_btrfs as bool Date: Tue, 13 Jun 2023 18:26:52 +0800 Message-Id: <0979640321150fc458dad36bef002a070c804469.1686484067.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0002.apcprd02.prod.outlook.com (2603:1096:4:1f7::16) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|MW5PR10MB5716:EE_ X-MS-Office365-Filtering-Correlation-Id: 704083b0-1d59-4615-aa12-08db6bf8c057 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vj16ZHPkarEylK8xViexLop3O+rkoepbBcMLWRaZeY8IUg83X9bmKfZe1dAVR5QSgvKxBYVGzUvt7OO9qMPQP5bvryt/oZAHFi2RYkcA0yZIVNJDakZ9eigbKiLvDhf8NQCAla5kiq6csQu7evHmXwUpM+hDUusNoOXqmTWgD1cQIWKBDkTLOVnVCDxDB5jOCKhH72DsE8LIxS20sxo7G2jU5Vokvr8n8gZVgjDsUXzd6W1DlZBgphNHsXThQWXpQee6Tlmebzgcc7LBH0FiD4b8iVUxD5Qj5jUEvyQucljlECRIwempuy2HUGj6lnCYN5oc1ECM+OThBXtWIG4I0CVN73C5mrFI0oW1GBlLr+OT99velB7BlQTKddLTBDBAc+okT9h9KJpVbwoEMaBpYGQ70tbVZmQWCzwQFDKfoLXi7xE5dfFDfjkDZKZmXXG9zjQMI776t6Zic7xXyWOzrEaxgD/c5sdfORl/eCtM18JIsUSdk8aqsEM7e+X462EMJCTHlrjOatGg/rhpW/qVI4Uc1FTigQ9Q4WtH84xPLQtKITd1iyUgtTN45/xNHks7 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)(366004)(396003)(346002)(136003)(376002)(39860400002)(451199021)(186003)(8936002)(478600001)(6486002)(6666004)(5660300002)(316002)(41300700001)(26005)(66556008)(44832011)(8676002)(6506007)(66476007)(6916009)(66946007)(4326008)(6512007)(2616005)(83380400001)(2906002)(4744005)(38100700002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jnu7AuDFqQEuQ+6TBBpP0RW4SC1dF3JPXQOqEie98XqtXew3ZL1yfE9VGwKtRLTVp4QFVwBYVpatkX5DrOTVKkejyCYQiuq/0c0qjCUIl8kJafBhj18nv4fO5ieciPDi3uVsctsc7IROKolKBBT1rDVDDrUFdgqLt/1e/UrQ8wL5KkrMKWMxwDW3IY4Bzfi+MAV7WduXtT13skU8bTHE9EKtlJhYbcRJt4NPZwPNmnSiJKDxSvaeC6SduuSGMnemef+Ir6yudDOTpTwIHo6uYrUO+Elx3HmJhv0XwvTnD6JEHgO4UID+gXQvJECIfxLGSfPHgY7oeiEUMy5Pm0tBaHiuU1nbGFBhu8wTXyO28oEUa7N5NOcj6CfXrP/EoIS1gWBgu6RoASO7xPydxTgu4ICxwsIfh+/PX6XjGBmEj5ODCtoQ45b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IgR+O+l7dZM7jI+XtAJ/cA+qERluTG96aYFCsl/NPlvlzMfhEFd95v8f/5WhnT X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: jy4zv0ef3eKuhBU3055HF+lyGs5+xm0FgU7qe0tS5CS2cHmabAgr7eEmTJGJIDSOuECKLjL9q9P4UZnNZl4dHsKR1gIw0C3C2GIqtxoeBmVgBvfm4tKBp+om0FotU2lowSCqsLgD30hzS0MZhQaEdgILFAHBveJxRg24T5xSRDT2AryVkQEqBQWPuMn42oWgBURx4qDSEe6KzroM+2ksRZhubczY2PRlBGq6Hl0wPgJdVkOI2Uv4f4Gvhz5DXdnIuLX4BKQgznL7Sd1VGRW8mCMZSGoGeRAx0maAB1QAUm//A4LyP+L6fsDsshU/6Ieh/2wr4lILBuJXRRCG2tc05GRm4lzJsb7udb3I5VmZcYaBtDRoWWRDbO38isJS2ZtM4sQYX3ppymJbCzbRbllKpLTZSX2o+Iogam3oCuXa6fuAQC73LlgnmSCjXn7zuzORr+RVTQzeviQPd7OCxRxe4am3Keskj9ug46GDUJA9EHLD1nF16F+sDKGWR31fRiZLecWOUl6t3AEr9+6U1InG9yNty67gTokYGuLGp081O1viBwAtl/XEIx7dcKV8B/z39fty8tHbbKEtMiKNKo3GGi3oFNiaO2A7IHRaq5b8EeF3ZOnsI8fEXKtyLqB4jFduzRnDToVQWS36GMxN8vg9koyOsmrZXJkqTDxh8hIsWvd9uZTtjaOsxYcsFYG8bc2Z1Pp1N2So1CU1j8VEPXINq//f7mo9JIqkFRvJX7c/Uxx9U0vDvaWA7KZI1kjUev6rR56k7cygHlCI3TkS5yBTIhp9OhUZnf5s5PKQ8hylfK0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 704083b0-1d59-4615-aa12-08db6bf8c057 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 10:27:12.7360 (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: ZTl1nZmIku7Y1SN99loZtzKamIXA2Ow2FKFcEwVQ6oCu7IAYiwprJPdgYsQVo43w8NPBXJg2G2qUKblSUWkQ+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR10MB5716 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-13_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306130092 X-Proofpoint-ORIG-GUID: eEepnQ1J-5-OODpr7b5_Mww9ImyVf07v X-Proofpoint-GUID: eEepnQ1J-5-OODpr7b5_Mww9ImyVf07v Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The variable 'is_btrfs' is declared as an integer but could be a boolean instead. Signed-off-by: Anand Jain Reviewed-by: Qu Wenruo --- common/open-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/open-utils.c b/common/open-utils.c index d4fdb2b01c7f..01d747d8ac43 100644 --- a/common/open-utils.c +++ b/common/open-utils.c @@ -57,7 +57,7 @@ int check_mounted_where(int fd, const char *file, char *where, int size, { int ret; u64 total_devs = 1; - int is_btrfs; + bool is_btrfs; struct btrfs_fs_devices *fs_devices_mnt = NULL; FILE *f; struct mntent *mnt; From patchwork Tue Jun 13 10:26:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13278324 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 1DF6BC77B7A for ; Tue, 13 Jun 2023 10:28:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238653AbjFMK2C (ORCPT ); Tue, 13 Jun 2023 06:28:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240537AbjFMK1b (ORCPT ); Tue, 13 Jun 2023 06:27:31 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E51419A7 for ; Tue, 13 Jun 2023 03:27:26 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35D65FuP003835 for ; Tue, 13 Jun 2023 10:27:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=C5+t32R+K6g7V92RYqZ1zDieYtSn41noNJ87r+RD17w=; b=z/cTD3uTmAPYrziKlDwiKlg1Dy4/duJrs46xhPo2K2a8Prr2YdNrf2zU2PO79O2aW6FL q0k4PVFk/filNOTGw8siWnoboqtMIRQDqpCyaiFnM0L96rKTswnRlONQprOYlJEN8Lds VII/9iNWkGQ7CgZCqQ4MZm6uYN+nvVzRr90HPp8KIwVH/y6pWSjha478NQvFmvNyaNuZ qY83D+ldR1oh7a14a/HC2Ye14CKgKgKVTuhHqVB/zXSRNWHE3N7yWt7fqaC3eaJX+JL0 fh3iZ0h+m9xquXAJ6cSPFpGGyqTobWvd2pEuDQgtr9lpsSEFlwBkh+isNAXQ5ZGI4J/a Aw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h7d4vs3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 13 Jun 2023 10:27:25 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35D8PHV8021727 for ; Tue, 13 Jun 2023 10:27:24 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2105.outbound.protection.outlook.com [104.47.58.105]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm3ywu4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 13 Jun 2023 10:27:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MnQ8wzid50VN91JLyjSsrPuGEhHTWVJRZuxt1qsV3oMewa/tf4dV7Ap2eVuZVWp/SudHBAxh1OxbMUFpGdKL6vK4DlR/ZGTudiVyscvdN5T5bDSG7hH0HtvU95MHlsEGn7uVntDZbjMCRWEww8Xlbx16UH3xO+5hZ0KeJ0pRG1pBpKb/2lyT86RSgbuhvH5CJoEqmYMUxgKRzCI5zqGvbidnRrb4qNk1h0kEmBgJTupb5RKOY7x+U2T62LBCHHGq4OuLNNAcX8YmTdZSg1WzTKcWQIgkgKdPp/dAgRwHYiwjNPwqiRziSz2ILwyjoD6spc/Sp8TnpnzO2D0jYIvAPA== 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=C5+t32R+K6g7V92RYqZ1zDieYtSn41noNJ87r+RD17w=; b=BpaehSll59fg1YDLTmnsawLtkVerRPK13QgdZHVS2JpQg/ZKcQ305qbfdVVxUCWZ+03sDOQ0tTZIBepA2n8ZcAotwCc+C7exHHcd0GPfaAQXK1eZCuIPtf0e5w1A/Rd7f+4A9+nHhuX2gbDogezCG1JAVv052St0jSNiIWraOxNY2DgibGafiUkTVHFxDMSrcFDnMR5SiSakCaM8wUhqLgxiP2wYRzuz1HLl6lpD+ZYr2+1kbz5hWRkiGP9jC9A3XB4ds9R+ubB0kJAI/auDRraO9hS+xhLD0OCeAPt7/Nq3nyu9w/ad7lImrlc1MS1NFjP5WCvxdgA7KiouzfXluQ== 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=C5+t32R+K6g7V92RYqZ1zDieYtSn41noNJ87r+RD17w=; b=USTtKmrmdgsQCp1a/RaNrLEiS0GoH9AUhex9hgliPZqN/cTFIxxzEwr7e3LmIjuRKVh3bfQYUplt/cw6UOGpImgktM21I0PoFg4/2pNtK5u4l+scroIKn2IfrWWsyyAY+3tKN3IWkTiEXUNYWozT0jJngyl80H62IQnD5FBnS9E= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by MN2PR10MB4398.namprd10.prod.outlook.com (2603:10b6:208:1dc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.44; Tue, 13 Jun 2023 10:27:21 +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.6477.028; Tue, 13 Jun 2023 10:27:20 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/6] btrfs-progs: rename struct open_ctree_flags to open_ctree_args Date: Tue, 13 Jun 2023 18:26:53 +0800 Message-Id: <452c6fb3507f8e9b864efbcfccc8a759040f356e.1686484067.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0132.apcprd02.prod.outlook.com (2603:1096:4:188::15) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|MN2PR10MB4398:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fb0a7bc-d41e-42ba-0edb-08db6bf8c509 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dOdq7qBgps7LraKJ0uFfLIiN+OULHRxkts3TCwMDAZaPLC8a4SHerEC53Ie73HUAykyBzY2rLSnwDZXUZwXuerCXLz+3w/wFLNEgvGUj4IMM79mox07LeS6E1M/68doWww5ZoZeYfisVJQipDeY/6WEfPalTFUe42Py7uqrw1NIt4wdnjgE7mXvfknUeQR7c8CS+4D5m8oban/g5XXeI7h+QWdS0hNw3nD/Y5Np4MumQNgLBNIuElZ3YbgNyFBAy3XXGT0zpGw++k7NBC+FeHECAqwJO8gerSOX2lgmj6XHuTahLCcEC+FKQYzPHk9n6yn7XoJGweRjjtu3ixLb2Wy9TVraZcI82IYciDwYHesXu4Fc63xoK7tsNEJ9ldg0bxLZqzyazDD8pa/o4+55tgA3OKGwamOtPdMXjVZtWQQYpyhva8LAXjja0kGB55e90H2dUotqoTrAez5qUFYpCgh1MdEjc9Ne/lgmJmrzhRBm7/3XRTYL2XWEUUOJtAZSgKQktHrLGNm63w1MzRxAAKay1JOa9+JpNfYeppRRy5+HKb4VGcbzzGxr4P9YGK0gq 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)(346002)(136003)(376002)(366004)(39860400002)(396003)(451199021)(38100700002)(5660300002)(478600001)(316002)(6916009)(2616005)(8936002)(8676002)(66946007)(66476007)(41300700001)(66556008)(186003)(83380400001)(6486002)(6666004)(26005)(6512007)(6506007)(44832011)(86362001)(30864003)(2906002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lYQoSv78oF56gEa/NSH6OsmOU6ZVEt8ubgCtL8YTItq9oiue0LM1UDdFtO/heUnQ3Lanf3vK/V4xc9PBuJmY/3MgzADjKd/NxKyRy7tTkcNCqrYpdtR+pFewlZtAGLBUuOQ/J+ASGIOujEiV2kdj8A/53zII85DOYQJ1pi7NLKvaGWPgYq7Gs6fDvkKANzboMmcx51R7w2AfQSZWgWBK61f9GFjs8Dqgs6l1xLyRzd/IorjC7edlWTPUAJk3oiYy6fG7PoeI1BdbDSJqHyYzjSMU7VBYt/LzOrR/P8y0HC0Rr0HqUZ0XxMh7GV+ho8Z/eSS8r8JM9t4I4h3TcE6lwfRUXgaea7wKlp4pcv+ZNoxSIbAW7HrBS37tQ1AS4/T2fV9T76zyf8cw/O70GYA+CP4YEBNBD82TgpRnfO2eFrZ+RI98X78px33WoHQSdRyk8N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4VY9Umx9eYP7drlY5D39fJ6rdyH4+VIgaGa4Yi/QfsQ5rYrRDvrB/lPHuC6Qh X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: iIoBZ+gv7T+qx2JBzQq8bY6I651/jWAsggR5r82k9i+tWtS7zvyktAJZVpE/HZlkORs4Hmnlm3jMG2lhbf7EVs+BgwS0MjE8G0WSIKfmVEadGvUMgXIIt/IYTnewT/gYrUdUYIyqu4NkO85ZB4XI+7NNpDJ1ui0SySuGYp2/RhXggHEnephIY5gj27GpGVd3XrUEnRnaTYLs46JzjSBz85hAB49Uh5QSKiNrKorGOg6bkuTHuwAuRH5wnMJIZk7zL/YHiMWqgCDlzbj2RxOim+oU9uCBeYuZjjz8MW6AtayXhzxcS13ztcXZNil++nlbOdF5Oat7+7pj29brHkDWhiyjhUcB8key5rR0ELV/MnVF9wLoC8UjVAHzDADLfhlKoPBRYACkqzAFjFaiTIzjf/922bDq8Zut+vqq6imPFNaL0lSVjn3XSLDbDC3I5DeUImXoybe9Slmh9ekdvESUtckcU1Aefw3lpimxfPbX9bnaoxDDJOGfCDT51PrQIs/6+Y4l1ajuuz+M4tJ+45miobiikiNjOE5wtvaZBs6eHri4H0izBIdHwvNjH9Wq7b1RpeI6Kkxa6Xw9d10zcxJRD1HZg6JhMjtMpxJxi3eF20WOckiV+ZLKbzSPujUHvAsjX6dqz22DgAiWKOKbQp5ed6HpL7MOwoyRmj+xDnesUCN5YmVrU4n0MyJCjIGaE2XTcASXnDT6iM3bLqrQs3WfdGfYt8J7ETGhlLLjmobuN/dxTUgELc0zZJO/F5p+2oR+82uLPd524O8AbNcqMwc4mQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fb0a7bc-d41e-42ba-0edb-08db6bf8c509 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 10:27:20.6137 (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: b/j+2YwdVGRDIvsBykF3BBhxjA2b6WJS8bDcgyjJOcmwNUJDm/Z1pJtt1gWf7GE1FRqTymDdGTNTbK5j+jf3lw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4398 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-13_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306130092 X-Proofpoint-ORIG-GUID: kWtFvjLyW0VUJd3mLJ0_EM3PHDfc9uYc X-Proofpoint-GUID: kWtFvjLyW0VUJd3mLJ0_EM3PHDfc9uYc Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The struct open_ctree_flags currently holds arguments for open_ctree_fs_info(), it can be confusing when mixed with a local variable named open_ctree_flags as below in the function cmd_inspect_dump_tree(). cmd_inspect_dump_tree() :: struct open_ctree_flags ocf = { 0 }; :: unsigned open_ctree_flags; So rename struct open_ctree_flags to struct open_ctree_args. Signed-off-by: Anand Jain Reviewed-by: Qu Wenruo --- v3: Also rename struct open_ctree_args' variable to oca. btrfs-find-root.c | 8 +++---- check/main.c | 14 +++++------ cmds/filesystem.c | 8 +++---- cmds/inspect-dump-tree.c | 8 +++---- cmds/rescue.c | 16 ++++++------- cmds/restore.c | 12 +++++----- image/main.c | 16 ++++++------- kernel-shared/disk-io.c | 50 ++++++++++++++++++++-------------------- kernel-shared/disk-io.h | 4 ++-- mkfs/main.c | 8 +++---- 10 files changed, 72 insertions(+), 72 deletions(-) diff --git a/btrfs-find-root.c b/btrfs-find-root.c index 398d7f216ee7..e5a60c2023df 100644 --- a/btrfs-find-root.c +++ b/btrfs-find-root.c @@ -335,7 +335,7 @@ int main(int argc, char **argv) struct btrfs_find_root_filter filter = {0}; struct cache_tree result; struct cache_extent *found; - struct open_ctree_flags ocf = { 0 }; + struct open_ctree_args oca = { 0 }; int ret; /* Default to search root tree */ @@ -378,9 +378,9 @@ int main(int argc, char **argv) if (check_argc_min(argc - optind, 1)) return 1; - ocf.filename = argv[optind]; - ocf.flags = OPEN_CTREE_CHUNK_ROOT_ONLY | OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR; - fs_info = open_ctree_fs_info(&ocf); + oca.filename = argv[optind]; + oca.flags = OPEN_CTREE_CHUNK_ROOT_ONLY | OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR; + fs_info = open_ctree_fs_info(&oca); if (!fs_info) { error("open ctree failed"); return 1; diff --git a/check/main.c b/check/main.c index 77bb50a0e21e..2f4fa5ada339 100644 --- a/check/main.c +++ b/check/main.c @@ -9983,7 +9983,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv) { struct cache_tree root_cache; struct btrfs_root *root; - struct open_ctree_flags ocf = { 0 }; + struct open_ctree_args oca = { 0 }; u64 bytenr = 0; u64 subvolid = 0; u64 tree_root_bytenr = 0; @@ -10204,12 +10204,12 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv) if (opt_check_repair) ctree_flags |= OPEN_CTREE_PARTIAL; - ocf.filename = argv[optind]; - ocf.sb_bytenr = bytenr; - ocf.root_tree_bytenr = tree_root_bytenr; - ocf.chunk_tree_bytenr = chunk_root_bytenr; - ocf.flags = ctree_flags; - gfs_info = open_ctree_fs_info(&ocf); + oca.filename = argv[optind]; + oca.sb_bytenr = bytenr; + oca.root_tree_bytenr = tree_root_bytenr; + oca.chunk_tree_bytenr = chunk_root_bytenr; + oca.flags = ctree_flags; + gfs_info = open_ctree_fs_info(&oca); if (!gfs_info) { error("cannot open file system"); ret = -EIO; diff --git a/cmds/filesystem.c b/cmds/filesystem.c index 47fd2377f5f4..79f3e799250a 100644 --- a/cmds/filesystem.c +++ b/cmds/filesystem.c @@ -636,7 +636,7 @@ static int map_seed_devices(struct list_head *all_uuids) fs_uuids = btrfs_scanned_uuids(); list_for_each_entry(cur_fs, all_uuids, list) { - struct open_ctree_flags ocf = { 0 }; + struct open_ctree_args oca = { 0 }; device = list_first_entry(&cur_fs->devices, struct btrfs_device, dev_list); @@ -650,9 +650,9 @@ static int map_seed_devices(struct list_head *all_uuids) /* * open_ctree_* detects seed/sprout mapping */ - ocf.filename = device->name; - ocf.flags = OPEN_CTREE_PARTIAL; - fs_info = open_ctree_fs_info(&ocf); + oca.filename = device->name; + oca.flags = OPEN_CTREE_PARTIAL; + fs_info = open_ctree_fs_info(&oca); if (!fs_info) continue; diff --git a/cmds/inspect-dump-tree.c b/cmds/inspect-dump-tree.c index bfc0fff148dd..4c65f55db014 100644 --- a/cmds/inspect-dump-tree.c +++ b/cmds/inspect-dump-tree.c @@ -317,7 +317,7 @@ static int cmd_inspect_dump_tree(const struct cmd_struct *cmd, struct btrfs_disk_key disk_key; struct btrfs_key found_key; struct cache_tree block_root; /* for multiple --block parameters */ - struct open_ctree_flags ocf = { 0 }; + struct open_ctree_args oca = { 0 }; char uuidbuf[BTRFS_UUID_UNPARSED_SIZE]; int ret = 0; int slot; @@ -492,9 +492,9 @@ static int cmd_inspect_dump_tree(const struct cmd_struct *cmd, pr_verbose(LOG_DEFAULT, "%s\n", PACKAGE_STRING); - ocf.filename = argv[optind]; - ocf.flags = open_ctree_flags; - info = open_ctree_fs_info(&ocf); + oca.filename = argv[optind]; + oca.flags = open_ctree_flags; + info = open_ctree_fs_info(&oca); if (!info) { error("unable to open %s", argv[optind]); goto out; diff --git a/cmds/rescue.c b/cmds/rescue.c index 5551374d4b75..11f351f20ede 100644 --- a/cmds/rescue.c +++ b/cmds/rescue.c @@ -233,7 +233,7 @@ static int cmd_rescue_fix_device_size(const struct cmd_struct *cmd, int argc, char **argv) { struct btrfs_fs_info *fs_info; - struct open_ctree_flags ocf = { 0 }; + struct open_ctree_args oca = { 0 }; char *devname; int ret; @@ -254,9 +254,9 @@ static int cmd_rescue_fix_device_size(const struct cmd_struct *cmd, goto out; } - ocf.filename = devname; - ocf.flags = OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL; - fs_info = open_ctree_fs_info(&ocf); + oca.filename = devname; + oca.flags = OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL; + fs_info = open_ctree_fs_info(&oca); if (!fs_info) { error("could not open btrfs"); ret = -EIO; @@ -368,7 +368,7 @@ static int cmd_rescue_clear_uuid_tree(const struct cmd_struct *cmd, int argc, char **argv) { struct btrfs_fs_info *fs_info; - struct open_ctree_flags ocf = {}; + struct open_ctree_args oca = {}; char *devname; int ret; @@ -387,9 +387,9 @@ static int cmd_rescue_clear_uuid_tree(const struct cmd_struct *cmd, ret = -EBUSY; goto out; } - ocf.filename = devname; - ocf.flags = OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL; - fs_info = open_ctree_fs_info(&ocf); + oca.filename = devname; + oca.flags = OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL; + fs_info = open_ctree_fs_info(&oca); if (!fs_info) { error("could not open btrfs"); ret = -EIO; diff --git a/cmds/restore.c b/cmds/restore.c index 9fe7b4d2d07d..7a3606457771 100644 --- a/cmds/restore.c +++ b/cmds/restore.c @@ -1216,7 +1216,7 @@ static struct btrfs_root *open_fs(const char *dev, u64 root_location, { struct btrfs_fs_info *fs_info = NULL; struct btrfs_root *root = NULL; - struct open_ctree_flags ocf = { 0 }; + struct open_ctree_args oca = { 0 }; u64 bytenr; int i; @@ -1228,12 +1228,12 @@ static struct btrfs_root *open_fs(const char *dev, u64 root_location, * in extent tree. Skip block group item search will allow * restore to be executed on heavily damaged fs. */ - ocf.filename = dev; - ocf.sb_bytenr = bytenr; - ocf.root_tree_bytenr = root_location; - ocf.flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_NO_BLOCK_GROUPS | + oca.filename = dev; + oca.sb_bytenr = bytenr; + oca.root_tree_bytenr = root_location; + oca.flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_NO_BLOCK_GROUPS | OPEN_CTREE_ALLOW_TRANSID_MISMATCH; - fs_info = open_ctree_fs_info(&ocf); + fs_info = open_ctree_fs_info(&oca); if (fs_info) break; pr_stderr(LOG_DEFAULT, "Could not open root, trying backup super\n"); diff --git a/image/main.c b/image/main.c index c175179e1515..42fd2854e9d4 100644 --- a/image/main.c +++ b/image/main.c @@ -2795,12 +2795,12 @@ static int restore_metadump(const char *input, FILE *out, int old_restore, /* NOTE: open with write mode */ if (fixup_offset) { - struct open_ctree_flags ocf = { 0 }; + struct open_ctree_args oca = { 0 }; - ocf.filename = target; - ocf.flags = OPEN_CTREE_WRITES | OPEN_CTREE_RESTORE | + oca.filename = target; + oca.flags = OPEN_CTREE_WRITES | OPEN_CTREE_RESTORE | OPEN_CTREE_PARTIAL | OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS; - info = open_ctree_fs_info(&ocf); + info = open_ctree_fs_info(&oca); if (!info) { error("open ctree failed"); ret = -EIO; @@ -3223,15 +3223,15 @@ int BOX_MAIN(image)(int argc, char *argv[]) /* extended support for multiple devices */ if (!create && multi_devices) { - struct open_ctree_flags ocf = { 0 }; + struct open_ctree_args oca = { 0 }; struct btrfs_fs_info *info; u64 total_devs; int i; - ocf.filename = target; - ocf.flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_RESTORE | + oca.filename = target; + oca.flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_RESTORE | OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS; - info = open_ctree_fs_info(&ocf); + info = open_ctree_fs_info(&oca); if (!info) { error("open ctree failed at %s", target); return 1; diff --git a/kernel-shared/disk-io.c b/kernel-shared/disk-io.c index 442d3af8bc01..4e7cc381471c 100644 --- a/kernel-shared/disk-io.c +++ b/kernel-shared/disk-io.c @@ -1437,7 +1437,7 @@ int btrfs_setup_chunk_tree_and_device_map(struct btrfs_fs_info *fs_info, return 0; } -static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *ocf) +static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_args *oca) { struct btrfs_fs_info *fs_info; struct btrfs_super_block *disk_super; @@ -1446,8 +1446,8 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc int ret; int oflags; unsigned sbflags = SBREAD_DEFAULT; - unsigned flags = ocf->flags; - u64 sb_bytenr = ocf->sb_bytenr; + unsigned flags = oca->flags; + u64 sb_bytenr = oca->sb_bytenr; if (sb_bytenr == 0) sb_bytenr = BTRFS_SUPER_INFO_OFFSET; @@ -1491,7 +1491,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc if (flags & OPEN_CTREE_IGNORE_FSID_MISMATCH) sbflags |= SBREAD_IGNORE_FSID_MISMATCH; - ret = btrfs_scan_fs_devices(fp, ocf->filename, &fs_devices, sb_bytenr, + ret = btrfs_scan_fs_devices(fp, oca->filename, &fs_devices, sb_bytenr, sbflags, (flags & OPEN_CTREE_NO_DEVICES)); if (ret) goto out; @@ -1559,7 +1559,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc if (fcntl(fp, F_GETFL) & O_DIRECT) fs_info->zoned = 1; - ret = btrfs_setup_chunk_tree_and_device_map(fs_info, ocf->chunk_tree_bytenr); + ret = btrfs_setup_chunk_tree_and_device_map(fs_info, oca->chunk_tree_bytenr); if (ret) goto out_chunk; @@ -1591,7 +1591,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, struct open_ctree_flags *oc btrfs_header_chunk_tree_uuid(eb), BTRFS_UUID_SIZE); - ret = btrfs_setup_all_roots(fs_info, ocf->root_tree_bytenr, flags); + ret = btrfs_setup_all_roots(fs_info, oca->root_tree_bytenr, flags); if (ret && !(flags & __OPEN_CTREE_RETURN_CHUNK_ROOT) && !fs_info->ignore_chunk_tree_error) goto out_chunk; @@ -1608,7 +1608,7 @@ out: return NULL; } -struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_flags *ocf) +struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_args *oca) { int fp; int ret; @@ -1616,28 +1616,28 @@ struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_flags *ocf) int oflags = O_RDWR; struct stat st; - ret = stat(ocf->filename, &st); + ret = stat(oca->filename, &st); if (ret < 0) { - error("cannot stat '%s': %m", ocf->filename); + error("cannot stat '%s': %m", oca->filename); return NULL; } if (!(((st.st_mode & S_IFMT) == S_IFREG) || ((st.st_mode & S_IFMT) == S_IFBLK))) { - error("not a regular file or block device: %s", ocf->filename); + error("not a regular file or block device: %s", oca->filename); return NULL; } - if (!(ocf->flags & OPEN_CTREE_WRITES)) + if (!(oca->flags & OPEN_CTREE_WRITES)) oflags = O_RDONLY; - if ((oflags & O_RDWR) && zoned_model(ocf->filename) == ZONED_HOST_MANAGED) + if ((oflags & O_RDWR) && zoned_model(oca->filename) == ZONED_HOST_MANAGED) oflags |= O_DIRECT; - fp = open(ocf->filename, oflags); + fp = open(oca->filename, oflags); if (fp < 0) { - error("cannot open '%s': %m", ocf->filename); + error("cannot open '%s': %m", oca->filename); return NULL; } - info = __open_ctree_fd(fp, ocf); + info = __open_ctree_fd(fp, oca); close(fp); return info; } @@ -1646,14 +1646,14 @@ struct btrfs_root *open_ctree(const char *filename, u64 sb_bytenr, unsigned flags) { struct btrfs_fs_info *info; - struct open_ctree_flags ocf = { 0 }; + struct open_ctree_args oca = { 0 }; /* This flags may not return fs_info with any valid root */ BUG_ON(flags & OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR); - ocf.filename = filename; - ocf.sb_bytenr = sb_bytenr; - ocf.flags = flags; - info = open_ctree_fs_info(&ocf); + oca.filename = filename; + oca.sb_bytenr = sb_bytenr; + oca.flags = flags; + info = open_ctree_fs_info(&oca); if (!info) return NULL; if (flags & __OPEN_CTREE_RETURN_CHUNK_ROOT) @@ -1665,7 +1665,7 @@ struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr, unsigned flags) { struct btrfs_fs_info *info; - struct open_ctree_flags ocf = { 0 }; + struct open_ctree_args oca = { 0 }; /* This flags may not return fs_info with any valid root */ if (flags & OPEN_CTREE_IGNORE_CHUNK_TREE_ERROR) { @@ -1673,10 +1673,10 @@ struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr, (unsigned long long)flags); return NULL; } - ocf.filename = path; - ocf.sb_bytenr = sb_bytenr; - ocf.flags = flags; - info = __open_ctree_fd(fp, &ocf); + oca.filename = path; + oca.sb_bytenr = sb_bytenr; + oca.flags = flags; + info = __open_ctree_fd(fp, &oca); if (!info) return NULL; if (flags & __OPEN_CTREE_RETURN_CHUNK_ROOT) diff --git a/kernel-shared/disk-io.h b/kernel-shared/disk-io.h index 3a31667967cc..424b953e0363 100644 --- a/kernel-shared/disk-io.h +++ b/kernel-shared/disk-io.h @@ -175,7 +175,7 @@ struct btrfs_root *open_ctree(const char *filename, u64 sb_bytenr, unsigned flags); struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr, unsigned flags); -struct open_ctree_flags { +struct open_ctree_args { const char *filename; u64 sb_bytenr; u64 root_tree_bytenr; @@ -183,7 +183,7 @@ struct open_ctree_flags { unsigned flags; }; -struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_flags *ocf); +struct btrfs_fs_info *open_ctree_fs_info(struct open_ctree_args *oca); int close_ctree_fs_info(struct btrfs_fs_info *fs_info); static inline int close_ctree(struct btrfs_root *root) { diff --git a/mkfs/main.c b/mkfs/main.c index 7acd39ec6531..972ed1112ea6 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -990,7 +990,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) struct btrfs_root *root; struct btrfs_fs_info *fs_info; struct btrfs_trans_handle *trans; - struct open_ctree_flags ocf = { 0 }; + struct open_ctree_args oca = { 0 }; int ret = 0; int close_ret; int i; @@ -1569,9 +1569,9 @@ int BOX_MAIN(mkfs)(int argc, char **argv) goto error; } - ocf.filename = file; - ocf.flags = OPEN_CTREE_WRITES | OPEN_CTREE_TEMPORARY_SUPER; - fs_info = open_ctree_fs_info(&ocf); + oca.filename = file; + oca.flags = OPEN_CTREE_WRITES | OPEN_CTREE_TEMPORARY_SUPER; + fs_info = open_ctree_fs_info(&oca); if (!fs_info) { error("open ctree failed"); goto error; From patchwork Tue Jun 13 10:26:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13278325 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 24630C7EE2E for ; Tue, 13 Jun 2023 10:28:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239350AbjFMK2O (ORCPT ); Tue, 13 Jun 2023 06:28:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241044AbjFMK1f (ORCPT ); Tue, 13 Jun 2023 06:27:35 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ED7E1BC7 for ; Tue, 13 Jun 2023 03:27:31 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35D65cbi008791 for ; Tue, 13 Jun 2023 10:27:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=3y1Losli319z2JzUomKwS4fKPVYvDDrivnxCdqSSqHc=; b=qHK+MKs+5baUlC8xyfEn5141xYFxTckuOfB7vLzptHzRugmNbQVnV5znR1s0lTiPvprL bdndQapHAtECryf/2t3oX4ugDt+G1wkCNtB4+S0dTbSBlmMRQN336cFPIrPdiEUwi5el uC0wTOTYQwnuMJ7CSwnkOEz02XWkfdRcXC4IPMDIIHSk0Jv76+kpYbztcjFXwA/Rd0U0 eAPayst8EOVh3cdAbG4PETDJ70SXUtOkpdiCkM7meEMv6Nxet/Qn4kB8+SXjK3uwDxT7 7qbOfFc94kUPRz5LCTosS9NwOYJ8tntpzGIeT+T1eXGMRTiheL94ix+ybjJHc8G8LPA+ cw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fy3cw2d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 13 Jun 2023 10:27:30 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35DA5f39008927 for ; Tue, 13 Jun 2023 10:27:29 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2102.outbound.protection.outlook.com [104.47.58.102]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm47v8c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 13 Jun 2023 10:27:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XmWgDmbykG4sDHmgEq41XKMd0FX1OQGlj6JjfmK5OGn2VzEIa/WNlgiCHD6LhUGPv0SWSyWOzd/U0+jFgkesYOp5DBlZd9dOzcFQr/4LkgmKz8LWlfJQH1x+x3NlQE0yZusb1Y3NxB9l/PlMrXKFGQ0mj6nrHT4eNlRntS7OYtS/ci4FNRhBQV5OShf6PWhcsK8XBfJuiSBOmvbsMuJHuqqVaDpeS4rulnSoFXgn0rD/487tDmY8BT1qmYhHUK4ZmI6sFV0FlaHZ6+OKLC5EufUyaSywSEvS7qqsdnz0UlZsLZgbepn8Xq9Dc2tAoByoNNjhplrqzJgx0jnf32EufQ== 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=3y1Losli319z2JzUomKwS4fKPVYvDDrivnxCdqSSqHc=; b=mHFAt44wt9oITuC1tXkiqMZjdHMLr4jUrz+l4P90mRh6trDWqIlVx4Qn5EqY9ZqJ4qSUcKxmvO4CgBz7RkLrwRKF89GiFriHVYoKXUwYABHQdC+kXH4TLRU7pAhjw3/QhU50X6XycvvvJymAKBsH8kXkqbiV9IES/nbkM/050twIWoGH2g/67UQpPOZ/yvun6rssaGHNA4mWpDYVcbPcJxu2OL9DXGHvFPBS3siG4bxSOQm/i6A3JJvWe6v/7hX9ZdBcj4l6LQyDZE4DrxKogbRfirlynCildptSEmlVoUK/XohKI05wwidY9ZKD6swIN4jGJcKOBVZDUucSlDZE+Q== 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=3y1Losli319z2JzUomKwS4fKPVYvDDrivnxCdqSSqHc=; b=yNi7xl9vkgVfxdltP0EkpJGZH9g0Sz2E1HnhMdRNqdYuiVg7FlDHap2bYUvO403K1SZzd7qpwa7TnpIWYn3YgZh/t8vTyNI7NpGOwABJ5QTD3urkxMuCGv7CoCUiEoEzQSs6Y38OVQo51ReA7PDJ8MHBoan1lIlV15PanNiOxdQ= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by MN2PR10MB4398.namprd10.prod.outlook.com (2603:10b6:208:1dc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.44; Tue, 13 Jun 2023 10:27:28 +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.6477.028; Tue, 13 Jun 2023 10:27:27 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 3/6] btrfs-progs: drop open_ctree_flags in cmd_inspect_dump_tree Date: Tue, 13 Jun 2023 18:26:54 +0800 Message-Id: <672f8622c658d14a2168598c4bb51cae1bbadf7e.1686484067.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR01CA0185.apcprd01.prod.exchangelabs.com (2603:1096:4:189::19) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|MN2PR10MB4398:EE_ X-MS-Office365-Filtering-Correlation-Id: e0214850-ec7b-4b7b-9171-08db6bf8c951 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FppYduoJkbafYC8RPVkBKUH8lbbK08Yb9zG+leQNu/xHA2xdQmQ79LBtiGH9/qRbF6niCbGYHLChJJ+8j9tzs9+mpSoC36ccEMxcIlOgwHor4iX1QK48N+XBxjxuWcM6OOD1WaN/s0w/TR5v4qG0TUrQNWX7LOI3I2ayDBmT/LNI4t2MZ2ZodwIQeBAoptyR9VOk9Dh5HS8YKSQ9SE0gJg+2W0hT97YrpLP67k0zdSYAZ3XMjQsJuik+VBSHRpAD3nIWp0rVuzLVOtxNtAuAVFYOmZP7VRkePII+0VBLuInq1FrzKIs6gCz8y/6DUWb5c/gCvTCrHuClIGORguIwvX81pwZ8c0YW3/jm45IlWObS9ga2KixJUzPW55QAK0Gz2h+v1UBSn+fzOOGuISmrOuDPHOyD58DlFvyNJdf+o96Xw0VsY7nAiOWg4ZEcgvnf1ruUdZifpdLSTKiM9wgs10q2TgeKUAZ3VPahfmnqb4mFegrucMRJzDCY19b9FlVJpdP9NqMsYEpAFyjXzfa3RKinRTb+LeNSodECl1nH5acqk9DdOGb1KgRBF3hKlavy 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)(346002)(136003)(376002)(366004)(39860400002)(396003)(451199021)(38100700002)(5660300002)(478600001)(316002)(6916009)(2616005)(8936002)(8676002)(66946007)(66476007)(41300700001)(66556008)(186003)(83380400001)(6486002)(6666004)(26005)(6512007)(6506007)(44832011)(86362001)(2906002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5lMiKk/LVLeHTSEXiMnClcus2xA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fiXu2xIdVdHynsc10TWTkbvviB+nOfqWZ31YkvSUsbE28JukLHSGPJWcgB5TFqzK+p1RhAsS7s3qfMo+VXQ6encC8SyT9aDmbJu1+ay0HwcBI/I+0Sgt0wFJljEOaxpODOtjp7PXPMn1VmXwpKjSGRIbm+koH0bOTRJFJKQbkl4peBKuemEeyE6VZhr0t9wqZFksAuQmDD9rm4MGJ/LQLkpqolTw9hcP++zakHR8u+xBxaf8rRrlTdpdmopseRBpUQTNG0n4Ht9uiZwBaEus9HQrU9wZ53zKjawv5HmyT6oSAoDIfag== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0214850-ec7b-4b7b-9171-08db6bf8c951 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 10:27:27.9298 (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: II2TdA/g6yRIG0dgwIO1s65CM/dyldLb02cov/FKNnSmOAHqYUgWHj0rYO87Aavu+Sa/ptX3Huv9uAWZtMLLLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4398 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-13_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306130092 X-Proofpoint-GUID: 4MqM3lvItClS0sud-2gJTwyK8wzi1b5B X-Proofpoint-ORIG-GUID: 4MqM3lvItClS0sud-2gJTwyK8wzi1b5B Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Local variable open_ctree_flags carries the flags whose final update is for the locally declared struct variable oca_flags. Just use oca.flags directly. Signed-off-by: Anand Jain Reviewed-by: Qu Wenruo --- cmds/inspect-dump-tree.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cmds/inspect-dump-tree.c b/cmds/inspect-dump-tree.c index 4c65f55db014..1d2a785ac5c3 100644 --- a/cmds/inspect-dump-tree.c +++ b/cmds/inspect-dump-tree.c @@ -328,7 +328,6 @@ static int cmd_inspect_dump_tree(const struct cmd_struct *cmd, bool root_backups = false; int traverse = BTRFS_PRINT_TREE_DEFAULT; int dev_optind; - unsigned open_ctree_flags; u64 block_bytenr; struct btrfs_root *tree_root_scan; u64 tree_id = 0; @@ -346,8 +345,8 @@ static int cmd_inspect_dump_tree(const struct cmd_struct *cmd, * And we want to avoid tree-checker, which can rejects the target tree * block completely, while we may be debugging the problem. */ - open_ctree_flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_NO_BLOCK_GROUPS | - OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS; + oca.flags = OPEN_CTREE_PARTIAL | OPEN_CTREE_NO_BLOCK_GROUPS | + OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS; cache_tree_init(&block_root); optind = 0; while (1) { @@ -400,7 +399,7 @@ static int cmd_inspect_dump_tree(const struct cmd_struct *cmd, * If only showing one block, no need to fill roots * other than chunk root */ - open_ctree_flags |= __OPEN_CTREE_RETURN_CHUNK_ROOT; + oca.flags |= __OPEN_CTREE_RETURN_CHUNK_ROOT; block_bytenr = arg_strtou64(optarg); ret = dump_add_tree_block(&block_root, block_bytenr); if (ret < 0) @@ -437,10 +436,10 @@ static int cmd_inspect_dump_tree(const struct cmd_struct *cmd, traverse = BTRFS_PRINT_TREE_BFS; break; case GETOPT_VAL_NOSCAN: - open_ctree_flags |= OPEN_CTREE_NO_DEVICES; + oca.flags |= OPEN_CTREE_NO_DEVICES; break; case GETOPT_VAL_HIDE_NAMES: - open_ctree_flags |= OPEN_CTREE_HIDE_NAMES; + oca.flags |= OPEN_CTREE_HIDE_NAMES; break; case GETOPT_VAL_CSUM_HEADERS: csum_mode |= BTRFS_PRINT_TREE_CSUM_HEADERS; @@ -493,7 +492,6 @@ static int cmd_inspect_dump_tree(const struct cmd_struct *cmd, pr_verbose(LOG_DEFAULT, "%s\n", PACKAGE_STRING); oca.filename = argv[optind]; - oca.flags = open_ctree_flags; info = open_ctree_fs_info(&oca); if (!info) { error("unable to open %s", argv[optind]); From patchwork Tue Jun 13 10:26:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13278326 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 EB1DBC88CB4 for ; Tue, 13 Jun 2023 10:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238945AbjFMK2X (ORCPT ); Tue, 13 Jun 2023 06:28:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234660AbjFMK1m (ORCPT ); Tue, 13 Jun 2023 06:27:42 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A85213A for ; Tue, 13 Jun 2023 03:27:40 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35D65GA1002074; Tue, 13 Jun 2023 10:27:38 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=9o9fbzjWMJFiuN4IjElCzZt0TKeUAvifWmS/uF6SspE=; b=nKqpg7r+aQHVBF/T+0s9hOQyE9XVscH/LRDWEbehVq8CdFMOPgnzBbr67/BlF4HAGq14 QLVKDoDlp/Crvhu3/uTEqvK6eznf/WPyaUQdCjqJAXcr0ttrr1X+++BmdVvuwabRSwq9 BRy2aoy/7ET85nzDlOu4hoAoJgkCXi18X7raGP58y7UQsLE42FcrO0Vtv0hafvQSIDY4 eLsvMfzGXW9oqlCpIwMwkBxZfD9b4nlpFQr2dTJ4ZMOeF6284QB79p/ZtUPwP3ssrOC0 6dCqB5TTbuHNd14zzPvVhbI0fX8pCkURNyPUwZYM8uKzy07W6mtcIGFPZx7IGH9oRj0k Lw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4gstvtxj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Jun 2023 10:27:37 +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 35D8T7X5014078; Tue, 13 Jun 2023 10:27:36 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm3qjc5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Jun 2023 10:27:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d+R/FrnOZTDzu561QEc1GYMR2cFZ9SInCRW+kbAnDlJs3ZSsOLw/Z14CL+hQ2MTii5EQl7Ga9y7IuZNz3GZrthpv8RoaG+n4zuiR01p39UNZFyVtloi+26sZOZkA7Ax9FIel7yL88IElxPVirNcMspYlG0OZaJSkbG1VTM7dQWZP9WTszaKkkulZhAEriMJkmjQLIydagXl8raCyy3qEYDlzp/VaNW8Wu+Bhd6niP7z938tg6Fule+sFugKME5SH9/1rHHJT6Kkt/OTm4CsBCA4c7vznQPkqGF0pGZkpKxYvXCj+2CqG+LVJ9yzlnmGtRuGPOuMenUMVCx4u7t3gvg== 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=9o9fbzjWMJFiuN4IjElCzZt0TKeUAvifWmS/uF6SspE=; b=hZDliTa6iE/HhoqS50kHlg+E95UEQYQVPaAWMZjMgp7WhtiWzDV9PQXrv8ofix5EQOcbup8T3ff/7Xc5s52jWtpU/ne662LtvGq4O/bvxp8o8oKzq3y0RxjmdTL88yeFtygE5ioGmKhF9Q/X2IZ2/XlJr8EriaHqjBTX8NxQ+5rDesg0SM2fE9PgCdBIMaCqiu9u5Bx+d8gEQhqFBjwkWolitGBU9t/RJ342XqVyHC0022ZksA15y4W9J2wVvPALyXpF33o4GIg+/GquoP41kXuwPAfDyDHKanFjcH0L6IXLI5OLz5dC+ZrW4iojd3l4C6aQDZnpf1z/QvyH8yXSog== 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=9o9fbzjWMJFiuN4IjElCzZt0TKeUAvifWmS/uF6SspE=; b=efQxbvmAFeZ8i+N42mR4UXpBoT35dd7tdMGzH3AKuKTNh5xpM3PVfGKrk19SJSYUU9cc5XBw8jvYZ5Lwyk1A/c+XT5nlZRkA+ShVCdgkvRroHiJPm7HTm6U/tq90xmeHtOl6oDp8s9PzlHdeiAJ4LbmY/hGfNFytuDtp0bCLEM4= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by MN2PR10MB4398.namprd10.prod.outlook.com (2603:10b6:208:1dc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.44; Tue, 13 Jun 2023 10:27:35 +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.6477.028; Tue, 13 Jun 2023 10:27:35 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Qu Wenruo Subject: [PATCH 4/6] btrfs-progs: device_list_add: optimize arguments drop devid Date: Tue, 13 Jun 2023 18:26:55 +0800 Message-Id: <9de0259373eb05a32c575e8765d8733c59badf65.1686484067.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR01CA0176.apcprd01.prod.exchangelabs.com (2603:1096:4:28::32) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|MN2PR10MB4398:EE_ X-MS-Office365-Filtering-Correlation-Id: ab8f720f-5ef7-425f-a00c-08db6bf8cd84 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tHDxqNjeFQCc6mOZf40+i+26ffV4dTNCHMF33XKaj5TUs4EvLjH1EZwRpyJELfZQycjokN9fOSnUsZpTpN6nd8jRGoI3ML6sTaEAxRzMegj1QBZBM/7mOZFVl4572rl952HCLGR7Vw/xgeiDnLNRTZmczPK1dab+XbLyws6r+NKaWRcYZnH2VTV1m8trct+X305+xMeZoFSl/k6FteDGiCysW0WQKrZze0Ix5aziQjXMJ3PgO+NNOpOzhuXDOtlDQsGcNFnCBpIC+ehLEoTwgeM6fZ317+kQ+xHjcVrmrJB0tOhe13hJO39WbeHoG3LUkMXvZZk103yRvNB5/GEteofpveCpv7vTT63bzQ6P7knrqGSENzX6PWQAGVi0mgnxba1N5oNTLcEcDcMH8tcxojqnHrD985zNYQ8erbKdf8KRRK1y8pPlwRwYkv7LajHgj46aemxBE9gXsFU4auVzRSIgP/Ewt+6RFYs+XVUhCZci44kLhRvcF7oqooTMrstvgDH6FAaeeRIOl+ldJlVNymk05Wl0ZIev7twmo3rlIKe7yYta82vb0t6X28cLtXrN 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)(346002)(136003)(376002)(366004)(39860400002)(396003)(451199021)(38100700002)(5660300002)(478600001)(316002)(6916009)(2616005)(8936002)(8676002)(66946007)(4326008)(66476007)(41300700001)(66556008)(186003)(83380400001)(6486002)(6666004)(26005)(6512007)(6506007)(44832011)(86362001)(2906002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gdJFESrzz+TZj/OQtXIn94dojfEcx9b75f7ZLqZcCXnl8Yu+kexXHP+exoFvaBXZrP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Ni2xDWKyuUz3hLB8pkVmexEZ0QRNa0FbP3VLy0KXo7UkhG/y88DXkshDAYjrAvaCdzOmcfGTGby6M0SthjUNl2/BLF3obKPKmS8rprZ3al2DmdBAO7s7QWLBnZ13yvdNl4dGZDr0lLxcjoEWY6cYBQ3OHdYaMaPDRN9p1ZrHIy3yd8ANPfkQT6Q0+1JPpIextPZ/DM70XEaIG1BzHvZ0nlul4RySsAXrIBqr3K20EtDHr2KGUG1QWTxXFDfNo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab8f720f-5ef7-425f-a00c-08db6bf8cd84 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 10:27:34.9791 (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: k9V9VBmZlymb0bO9o8XzoGq8h93Zvzy9fwTq387mFi+mYYN8Tck/8SYCOLXz8ThQJQ8P7fz6mHtAgUUI3xm2Ag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4398 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-13_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxscore=0 adultscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306130092 X-Proofpoint-GUID: 8cQoBzpNOxa5hgsiu3hIeTrgijKVmpL0 X-Proofpoint-ORIG-GUID: 8cQoBzpNOxa5hgsiu3hIeTrgijKVmpL0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Drop the devid argument; instead, it can be fetched from the disk_super argument. Signed-off-by: Anand Jain Reviewed-by: Qu Wenruo --- kernel-shared/volumes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index 95d5930b95d8..81abda3f7d1c 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -334,11 +334,12 @@ static struct btrfs_fs_devices *find_fsid(u8 *fsid, u8 *metadata_uuid) static int device_list_add(const char *path, struct btrfs_super_block *disk_super, - u64 devid, struct btrfs_fs_devices **fs_devices_ret) + struct btrfs_fs_devices **fs_devices_ret) { struct btrfs_device *device; struct btrfs_fs_devices *fs_devices; u64 found_transid = btrfs_super_generation(disk_super); + u64 devid = btrfs_stack_device_id(&disk_super->dev_item); bool metadata_uuid = (btrfs_super_incompat_flags(disk_super) & BTRFS_FEATURE_INCOMPAT_METADATA_UUID); @@ -545,18 +546,17 @@ int btrfs_scan_one_device(int fd, const char *path, { struct btrfs_super_block disk_super; int ret; - u64 devid; ret = btrfs_read_dev_super(fd, &disk_super, super_offset, sbflags); if (ret < 0) return -EIO; - devid = btrfs_stack_device_id(&disk_super.dev_item); + if (btrfs_super_flags(&disk_super) & BTRFS_SUPER_FLAG_METADUMP) *total_devs = 1; else *total_devs = btrfs_super_num_devices(&disk_super); - ret = device_list_add(path, &disk_super, devid, fs_devices_ret); + ret = device_list_add(path, &disk_super, fs_devices_ret); return ret; } From patchwork Tue Jun 13 10:26:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13278327 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 80068C77B7A for ; Tue, 13 Jun 2023 10:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239257AbjFMK20 (ORCPT ); Tue, 13 Jun 2023 06:28:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241193AbjFMK1r (ORCPT ); Tue, 13 Jun 2023 06:27:47 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B92619B for ; Tue, 13 Jun 2023 03:27:46 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35D65OmY007957 for ; Tue, 13 Jun 2023 10:27:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=zOYczwhFiwIt+o5MJ4pkVRAZwB0Q5X4QUrE2xAjDb+E=; b=WL7rbpjhMQLNDq83mGIHHyjRdyywOWiyJD9i88wckphwX/ktMB5EMKUkeWTgZut/K+Em CnslG27Awik0cJtTyfVYwQ5YoCnoXtzKwRWzd/2Ir/FQavuq/fLOoHa4rorIHXQFGdJz 8aBkMvO+bheaI46DwsNHTu0BWmxX5+AD5+G41aqgnVzEuhNlor0UVuUBk+EJrrmVNA2F VbR5fHaeHllhoQBcvPErBYWLy8Rq4s28k3Jrtl4SWIrbiBJK3XJCKZ3y3WgcqyGV56S7 ZMr3OLtaul/PRDAwoC8tZtE35gqz5lHYdEeqyrt6be8qg/+3sRGEz65rVB43g+9Zob1a UA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fy3cw2y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 13 Jun 2023 10:27:45 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35D949W6008378 for ; Tue, 13 Jun 2023 10:27:44 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fma817h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 13 Jun 2023 10:27:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m/XGH211aNPRV/j+l5cSLNYQV979w6u67CgpNUX6i1OUkTaO2sTM6mFi9FELVY7JL4av3GVlHLn7qwZdnNiLAoVEkuGmWuE809mJMYLBNoc9FtzRHSZmf9gd1Cz0bwnnqoL01dP4xjfV5eQ75VF7vIxXcY5KRLeiuT562UJxcklMhpDTo/D+Jkn6Fc9Ih7w8kKU5Fdu5aG7IKK3DodjaJC1QllNpR6bVSLD7S0r57WmudvwCn4m/zKPpWyTOLTiROWdArzy1/Q6LDhj9C9uCF9Aac/VQOodmhNsgIz1391TCRCKS/qnaC14Hr9V005xPKV5ulq45Tbm7rf+03nr1Ug== 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=zOYczwhFiwIt+o5MJ4pkVRAZwB0Q5X4QUrE2xAjDb+E=; b=MOYyhVisCH389OfcgpXmp8j5QEUG/TEsSgoO0rvSJZurvUy3vWuMziIIIk6rNN9YfT298g9sZlPxAOgMHAwl3CWjEP3xPYWRBMQDn1MEj2hyMgs/JM2lNz0x1x8YHyfxnsKIssoAI+C7TnSex0JicomSy9uXJ8nv9J5C96WW2MbFg6PbDj48LH7qniwBQFStOGdhWxNRhOoIBRU0nVWuiyDh5l23RDQyrq4IIwilhXoX3aZ+b629uHzOAhgUOBW7SN4OVOHfIbYZM4OV9XQE94a67I8wRGqO0vEz7s30yGcrc87hrRcyazAPfJ8/9h312w/T4xDEdNtsDZFAIw6nqA== 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=zOYczwhFiwIt+o5MJ4pkVRAZwB0Q5X4QUrE2xAjDb+E=; b=H2dCrGppEzCLTPzQ3aL6lQhL+a3vQ6Suhho+6ZLnwr4k7GYQFqEnAtUdU/C0LeY7lcHNO2duK90R6j113RzdB4uTPrGMaWfQOgvifv0C+6O19i8vDVVCNARF3W8PcwJZfS9oKNVSTvdvurtLCGvfyNhJQnMTJqqnlktgB1FX1tY= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by MN2PR10MB4398.namprd10.prod.outlook.com (2603:10b6:208:1dc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.44; Tue, 13 Jun 2023 10:27:42 +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.6477.028; Tue, 13 Jun 2023 10:27:42 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 5/7] btrfs-progs: factor out btrfs_scan_argv_devices Date: Tue, 13 Jun 2023 18:26:56 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0034.apcprd02.prod.outlook.com (2603:1096:3:18::22) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|MN2PR10MB4398:EE_ X-MS-Office365-Filtering-Correlation-Id: a3da2556-4df7-4633-f2d1-08db6bf8d222 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3TXKmgQJy/DKkFGTAGgkJbDoxw+JCeshkNGxw0gAafzOrSBFqKWANsNLcaH3S8npS4bv6X2sqET5qj90Us3G9NYiFucqZrqaBSfbK545LpuZpOGx0O7wBGAl9Wb37HUJCzC4QvYPAIaaDLwnqOKDsSeyIIxKc3F32gTUWa5Te81YmtNorxnzDCIhcY+9teDIaXIHaRqzG121Twf9YLdG/6cmhZKiB5ysAqpdXVt3U+ei+Lk0VEzzcrQXydShL9ZPDRLHkMhKyCe9rIVgraUbbtXsCKXG/bdUaLdyIGogxDIP1bPvOCxSY6OTuKPPZ4okhstQg1yiO0t8ro07s8sgmJC8ya7b7uPFsgOY2P8/onjuDC3E8U65SaMunCjMe5MKvKMHs+qPA5V70ZO3ji8g71WZ7LB8bL7TgMmgN/l+kHd13l5s0eWnYiW3xBARwqjmbIs4CkSBYCo+bH5rybji+ZW8zmA4R/uDnPq0e2f3JSRa0cTEUFDF6KTYAwA+uNWxkMdSaAFonNo5cV5WvdMSeoBrS01mGCF5fVkc+xw6twOaLTiZVv52Xvgs861n4EXi 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)(346002)(136003)(376002)(366004)(39860400002)(396003)(451199021)(38100700002)(5660300002)(478600001)(316002)(6916009)(2616005)(8936002)(8676002)(66946007)(66476007)(41300700001)(66556008)(186003)(83380400001)(6486002)(6666004)(26005)(6512007)(6506007)(44832011)(86362001)(2906002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x3M/CWomUTqqNCX2Hew1BdBvaXGb95qpazensI9CLKV3C1HkuHYjGxWzflTp+JdifzpCN5qQukbuIsGe6bzv1UJJV+WrieJro2RIKBCu0uD26u3mB+NYwUrZX14kQD9cbYjhPfbZOYg3jt74a/gHCi3YDTmNERGV5HVQBHN4mkCf9BMVIBo3HtPI+bYeVVi7EOfQyjLMqHnufcEbTcjJ2hZRu4k3mi64Z8KpIpnQQvSu+2gHA+/YZSckLskzCSBMwxb9kCnuGowkq1mLff50Xz/KdMLxbQ6LFLiTB6xiC4t42Me1LWb7kmUjGkjhWUsuq6L5tKX8Ej/hqYL5thJEhOJRcrpaF5+MSL+Uya+wrHu4DZNkQqdPxoQqwlptu4qMrwoC1zIzjQwS2X/4yfJPf/hBLmlu79ICwVhDPvr7iQAWNLIna+LLAqjYfXgk63hbaDNjGCpA53g03WGAmUQmz00A9gpt3QxMSiIGjTDFwtjgOUk3v0JZ7g0CdUD0awfK2nfK27cYmH/c1B/dgqrcu12XSJaosV+MBoOjcKQ0s8Bjgx21S6Ujvk/i43ihtcm1EPK3HifWoO0kqdd1TOqD2UYtf0CMjfn/5/ZLjXO5QBUnCIoopgLitGoDaqknkRdkXsO5m5eg3HaDd/7zj/f/mnbHctWfUp/kPUQSXVf4vu510PCREbUxBd4mklSW7EZ4DlzOym6EVjSQKmb8SqQLJ3MDohhmkJRjOTJuqWr56IKmDfHIKSRIJaflN8NsrPjdenR4qPTVE9CTUUi1doERWKiVf9i1urLwQqi3kI9hWGk+M+FVJRjHM9Tno/ihprv4356q+8jsMUvpuVAwdPbsXHjrUIc5eCndi3viSsj3nXrfkyt8hO3iTwh9GTtm8VGQCCXO3qjpqc/ZUZX54BvJn1XSZw+7me+Iipx/ANR8nmuB3T3hcvow0kfKzsDYd3XtedMwPwEs0BAjmJCf/BFQfLm5hw7jYNhYamzyYdQedLCUhychU093b/Be9L2dh5QiH5SGpTMGVQfkSP6HR/QuVDrgPWILjI94XT0TYax0m9Jc21GR3LG/oFXgPldVEOmqSlG4/d5t72CNzLK3+5+B8KW1QtI9LYaNUTZfQfLwVp1LmypMdxq1+4aLx53LTTP2Kri7k5ib4PhaMZYkZmqMLP9NCqCrLf+uPsp7ZaHgis7CdK6BY4AA7M3WCgbnaouIyGrBcSS90D/NBZSrHtNM8zoJkbiuOICLrfdegZpBDU3BgcsI+XIyZCFTDEiEBSXC+FpGlNMBX6gqMr0+VVQbJhRLaOQFlYJs6T0vuwh/yH5TZL9Pbglqfztdimr9Rn7O7aGK7anui6pudcEArChWq0CpO1uXUItl3XTgxESMrJ6cLIp86LTSOYx7bQczb4ANSkrHVH6O8/zcM7vwMM7coL4DnHN7TkMj7+r12GLpyhpM2uapxP9ctna9/QFIEYShCMhUDLD5UVGMvShLjsLsOz2NV97xivkaoOrvrCaS8ugugFd+z8cATaC5IRSsgJLmAXVq4GYQXTATVGWX/QeGASioEuaeD+x6cKAHYuiN/WF1M0wskrjG/Xw5Wsh5irnY X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Y44xIa+DeIBJL935LaGgiwpqmtV4xsENMf0NI2kp0PMYrV8gqOZQ83myj4DZpag8rA+oywjBQknJX5qMHSVj5b6CZ65xatHmjcuR9kk2XoYQavnSUS3sS6N1nss053lNL0klU8aqhETLMVi5pXQcMoh+l/owgV371mkfFL9K0y1nxccOzlBuy/KNu+7hQirzBViU1JPAlh+sBIx9omng0iEgqP9w8xbV0xXmojd/L4INkbB7/HW+bYD/4V7iU2L+sKm9WQDn5Jz9gfi7DhpYZa40E03MJ7OtCfapYHAxByp8oHEKPFsmP3LaFu+hibeVvzkR0ISDtff5hCzBqoqDS/VfYhgCGET8wlL6EFP6IYBpTcPQpLkWL6Ox/RtTO1+rJuJrmR1NxOJDns4ofVmRuvbuYOrqInzXdiHO75fZWtfQca5xRZvdyu3j4PxtH1QKyrdw8gIz0FtiWds2iklB5G3UKH4rDrUHS+56zwJ+To4zb2HrEtMdAqxe5QD3Qp3o6jhzDmbByDnuQzrQZ2ttmPP0ec0U0WxQHhXUe0GqVqU5vWFPYdyi6D3kIb2is91nFAMDpi+lcJocCPerkYDezzz63We1Q4Dv0u3zDP7BO/LXjQkCfxgOEpBC1mZXNRLkd+rGX6EpX1ljUc/xeXD440GTUZMLG7enJ4sYbU0pIRc2ePw2miU/FaxTkdXQn1KP8BlorDL/zmBtD8r4UXHvY4hb25Ts2g444G/VTdFXTWPZi9YuJBq2d4POCIBofFKjRrnLPC3xET1iSj7qyUrrbw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a3da2556-4df7-4633-f2d1-08db6bf8d222 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 10:27:42.7878 (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: dXsMkGoHmgl3/jJciAdeI7ogadF7Rvh79gX7MKyc5hL0PpgcvmnKcV2M0KL9htyjLO6mpW7jQRGFCgbBNYHAHw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4398 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-13_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306130092 X-Proofpoint-GUID: rHLmFGgvk2-avRYMA4WbCTgFfGCZk9Fv X-Proofpoint-ORIG-GUID: rHLmFGgvk2-avRYMA4WbCTgFfGCZk9Fv Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org To prepare for handling command line given devices factor out btrfs_scan_argv_devices(). Signed-off-by: Anand Jain --- v3: Rename args of btrfs_scan_argv_devices() Rename factored out function name from btrfs_scan_sdin_devices() to btrfs_scan_argv_devices() cmds/inspect-dump-tree.c | 37 +++---------------------------------- common/device-scan.c | 40 ++++++++++++++++++++++++++++++++++++++++ common/device-scan.h | 1 + 3 files changed, 44 insertions(+), 34 deletions(-) diff --git a/cmds/inspect-dump-tree.c b/cmds/inspect-dump-tree.c index 1d2a785ac5c3..50b792bbc4e7 100644 --- a/cmds/inspect-dump-tree.c +++ b/cmds/inspect-dump-tree.c @@ -327,7 +327,6 @@ static int cmd_inspect_dump_tree(const struct cmd_struct *cmd, bool roots_only = false; bool root_backups = false; int traverse = BTRFS_PRINT_TREE_DEFAULT; - int dev_optind; u64 block_bytenr; struct btrfs_root *tree_root_scan; u64 tree_id = 0; @@ -455,39 +454,9 @@ static int cmd_inspect_dump_tree(const struct cmd_struct *cmd, if (check_argc_min(argc - optind, 1)) return 1; - dev_optind = optind; - while (dev_optind < argc) { - int fd; - struct btrfs_fs_devices *fs_devices; - u64 num_devices; - - ret = check_arg_type(argv[optind]); - if (ret != BTRFS_ARG_BLKDEV && ret != BTRFS_ARG_REG) { - if (ret < 0) { - errno = -ret; - error("invalid argument %s: %m", argv[dev_optind]); - } else { - error("not a block device or regular file: %s", - argv[dev_optind]); - } - } - fd = open(argv[dev_optind], O_RDONLY); - if (fd < 0) { - error("cannot open %s: %m", argv[dev_optind]); - return -EINVAL; - } - ret = btrfs_scan_one_device(fd, argv[dev_optind], &fs_devices, - &num_devices, - BTRFS_SUPER_INFO_OFFSET, - SBREAD_DEFAULT); - close(fd); - if (ret < 0) { - errno = -ret; - error("device scan %s: %m", argv[dev_optind]); - return ret; - } - dev_optind++; - } + ret = btrfs_scan_argv_devices(optind, argc, argv); + if (ret) + return ret; pr_verbose(LOG_DEFAULT, "%s\n", PACKAGE_STRING); diff --git a/common/device-scan.c b/common/device-scan.c index 515481a6efa9..68b94ecd9d77 100644 --- a/common/device-scan.c +++ b/common/device-scan.c @@ -500,3 +500,43 @@ int btrfs_scan_devices(int verbose) return 0; } +int btrfs_scan_argv_devices(int dev_optind, int dev_argc, char **dev_argv) +{ + int ret; + + while (dev_optind < dev_argc) { + int fd; + u64 num_devices; + struct btrfs_fs_devices *fs_devices; + + ret = check_arg_type(dev_argv[dev_optind]); + if (ret != BTRFS_ARG_BLKDEV && ret != BTRFS_ARG_REG) { + if (ret < 0) { + errno = -ret; + error("invalid argument %s: %m", + dev_argv[dev_optind]); + } else { + error("not a block device or regular file: %s", + dev_argv[dev_optind]); + } + } + fd = open(dev_argv[dev_optind], O_RDONLY); + if (fd < 0) { + error("cannot open %s: %m", dev_argv[dev_optind]); + return -EINVAL; + } + ret = btrfs_scan_one_device(fd, dev_argv[dev_optind], &fs_devices, + &num_devices, + BTRFS_SUPER_INFO_OFFSET, + SBREAD_DEFAULT); + close(fd); + if (ret < 0) { + errno = -ret; + error("device scan %s: %m", dev_argv[dev_optind]); + return ret; + } + dev_optind++; + } + + return 0; +} diff --git a/common/device-scan.h b/common/device-scan.h index f805b489f595..0d0f081134f2 100644 --- a/common/device-scan.h +++ b/common/device-scan.h @@ -58,5 +58,6 @@ int add_seen_fsid(u8 *fsid, struct seen_fsid *seen_fsid_hash[], int fd, DIR *dirstream); void free_seen_fsid(struct seen_fsid *seen_fsid_hash[]); int test_uuid_unique(const char *uuid_str); +int btrfs_scan_argv_devices(int dev_optind, int argc, char **argv); #endif From patchwork Tue Jun 13 10:26:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13278328 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 C5F72C77B7A for ; Tue, 13 Jun 2023 10:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238524AbjFMK23 (ORCPT ); Tue, 13 Jun 2023 06:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237216AbjFMK1z (ORCPT ); Tue, 13 Jun 2023 06:27:55 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CD671B8 for ; Tue, 13 Jun 2023 03:27:54 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35D65Nhx028732 for ; Tue, 13 Jun 2023 10:27:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=ELpCl4ugUYOxIq5QExPAErPb0wC3jYAGgigKOfaVpOc=; b=dO7iOw+dTc5dQFZQyJm7eJ+HRj4O5gWCiWzcpKeuCDv+BV8dFs839AZn1509wnV7kozi 1b73gLdeut00s3ppEVzJxrwa7dbjuSMYgVvMPv4PaNYCtOrXfEkaQ4XR7bgd4QHrJKpQ OcqzV/PDruK9PsEX3qADGCbuiq/9qcpDjCEo9Azp55ER6hWubFIL9d5Urr1FhgKOjXoL Z9uu3ICVIu3/BzdAH48STmbW+NumplkdFl8iA/F9oT75TQTPlS4nuvvhzg31KaCVmvSs HIw41orSR+6aFabe+PHhAT/+0/x0+GTjli3OT9hnl78WKXgyY8D+ydlPX6esVNGtduF+ wg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fkdmubc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 13 Jun 2023 10:27:53 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35D8G4on017727 for ; Tue, 13 Jun 2023 10:27:52 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm3qf34-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 13 Jun 2023 10:27:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TGsD+RNQRTKmjcUw+DrRDK6KwS+IJY1xMfIDJuzN/G7/bzxlDF+1nGvIehniLldAnke8+OgToNq66ena/hDYw8VCV/sZC2Q+B/I8mTBbshqZJpra1AAAePcIDgdU+Eg/g+NwRYMBVcz6pv/9rcSnu3qH4jggyz8ZaDWs6ulrH0f8AN9RJSUH3+R2xgXgTNKgVdi37R0/+2Z/Mr7qCXUDekAB/r2K2949U7vdcAGDayJgDI9kXJIBSP1Ml+PnUBHki0UQMq21LrDswSsgxk9WiZ9Qf7dI096dm1c3KdtElnyzy6iKMT4jACbm+4qci+7tf9KSqCKc8CPvII48UYdO2w== 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=ELpCl4ugUYOxIq5QExPAErPb0wC3jYAGgigKOfaVpOc=; b=Gmhu2IIf4Rpr/LsuOf2B0LcO8PNzQ2YBh4uP8jOAHerWpzigkt2X/Hm5AleXHF7LTZQ2zJdYnX94b1ZhMyHdTexyo4mTcAiL8a03wz7XrC2v1iCknTCR8qNV0Q3KvXBeL7iT7aqU/8MndM5dxvXgJETWnrHepOzIvoEtrGeICGTelPg3OI6Kdh/yXm86Z75jYmMiP7TszLnbx51+PP9XE6Z7H32TB49JAb4odum+TqW2ilvhmYNAfRp0/KBViOPtibnWyfkicJ+idz42PWR81XWwiqOG/y6DEwD6rw/vA1ydNuQ+SHEw574YgLMHR/e5GWVEgdjUsrLq3JI1iQ7xMw== 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=ELpCl4ugUYOxIq5QExPAErPb0wC3jYAGgigKOfaVpOc=; b=c43fw41D6HgxjNpYMbGPfq3riHfqV+bWs4q8Y2wuDC9i9Xl29N+EUy55tSvYXNx8Sy5aLNz9hNoA/8H7h3nHwT/fwcMT+z+NJSLEXna8qf18OzcArk+3ZU7uYXLxAKDu5xmJOy2c9kv8PNm16ffsnxz0ustGbVGX3zvNf/Cc0nM= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by MN2PR10MB4398.namprd10.prod.outlook.com (2603:10b6:208:1dc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.44; Tue, 13 Jun 2023 10:27:50 +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.6477.028; Tue, 13 Jun 2023 10:27:50 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 6/6] btrfs-progs: refactor check_where_mounted with noscan argument Date: Tue, 13 Jun 2023 18:26:57 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0043.apcprd02.prod.outlook.com (2603:1096:3:18::31) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|MN2PR10MB4398:EE_ X-MS-Office365-Filtering-Correlation-Id: 622a954a-d411-4d7d-2de9-08db6bf8d6ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FeGa5p7zrJzH2EVoQRIcF2KXYImZvLkG7T5zudLaax2BF4K6hKXqsZI+bv5OSozIjGhDJhNRywJT2/0I440ofmm7XsP3C7E8owribqJ/JlyqrptSOJOWRlz4kQ6x10WwtxCE5be3/jR/C9+KL8V2QtqB+r5ojnkdbWDEk6mZl15kWA0goetDH7YYLOeJWA0NOfcpV9kdMh/hVjcBA5pMsXfkc2FGwWexuU9WY74lGXDSEdXVU11D8DHmTcJR48k8JR/N9pQhsFr0gud6KbrCmSCUHDYnaVNoVmjhQPs5aNgI2lpqy2SXLiQXcz/+BK9hwUMG+RUeTkL/m2sIHcRqBEDtWdAOfHOlIiYl2HWiH3YalKj9HMyWeWlb1wdNE02JbCqY1m7Y0rAYagce6TTn0azAf1tuTR63ROo9awiOFpAmbpmtOakTkmIcb+H0bVM8hvLaHwp92E7XVMfa1D4lIsMcc8Kdia64VYJ9NNZ2FZa0OD0tf3Z9PIWOqOuUPbPc9+gwpUtpeuZ1cEt603/Ft+bZ6k59WBHUrwbuWkuhmkP6TU3qa44UrBQUSqZfzzNS 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)(346002)(136003)(376002)(366004)(39860400002)(396003)(451199021)(38100700002)(5660300002)(478600001)(316002)(6916009)(2616005)(8936002)(8676002)(66946007)(66476007)(41300700001)(66556008)(186003)(83380400001)(6486002)(26005)(6512007)(6506007)(44832011)(86362001)(2906002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xps2F0vrBU6V5Q99xEkeQlaG1F46rT6BRqQLIynp+IRkS7TfdhRlnvVdVBY3eNeSx/JjN0WfoPmWGcWKCgqLBosTL0DMhfTLkrw0jnKYPaFXg2iAVlwc34jbJa2w+UzzBcV6VTV7jb/b32ndrPj/0zUdjSvuxAAXEGMDd0vCWJF4ZIaGArZaDe8PKifcCzpfAlkfqGl+RRZtNsdqQjhZ+obwV9gbJv+WAZCHvQq8WGXQ2lnsOF32VzfzJAeJ/wv6s0/f7y1afcnF/2FNtHXEHqU9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PHbHOkQb+9gx1g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 622a954a-d411-4d7d-2de9-08db6bf8d6ec X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 10:27:50.5915 (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: YURdqchP9xrrDCZbhesMwejTjRvozWnXh8UOH/Vvbq+VibrjdlaZIMA1tFjjPCPlEFx8taxBxv/Pt9UCa0RNRA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4398 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-13_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306130092 X-Proofpoint-ORIG-GUID: f77-E7ayMKnVuQdWTT0UUOnfstrrFhsv X-Proofpoint-GUID: f77-E7ayMKnVuQdWTT0UUOnfstrrFhsv Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The function check_where_mounted() scans the system for all other btrfs devices, which is necessary for its operation. However, in certain cases, devices remained in the scanned state is undesirable. So introduces the 'noscan' argument to make devices unscanned before return. Signed-off-by: Anand Jain --- common/open-utils.c | 9 ++++++--- common/open-utils.h | 3 ++- common/utils.c | 3 ++- tune/main.c | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/common/open-utils.c b/common/open-utils.c index 01d747d8ac43..111a51d99005 100644 --- a/common/open-utils.c +++ b/common/open-utils.c @@ -53,7 +53,8 @@ static int blk_file_in_dev_list(struct btrfs_fs_devices* fs_devices, } int check_mounted_where(int fd, const char *file, char *where, int size, - struct btrfs_fs_devices **fs_dev_ret, unsigned sbflags) + struct btrfs_fs_devices **fs_dev_ret, unsigned sbflags, + bool noscan) { int ret; u64 total_devs = 1; @@ -108,6 +109,8 @@ int check_mounted_where(int fd, const char *file, char *where, int size, } if (fs_dev_ret) *fs_dev_ret = fs_devices_mnt; + else if (noscan) + btrfs_close_all_devices(); ret = (mnt != NULL); @@ -132,7 +135,7 @@ int check_mounted(const char* file) return -errno; } - ret = check_mounted_where(fd, file, NULL, 0, NULL, SBREAD_DEFAULT); + ret = check_mounted_where(fd, file, NULL, 0, NULL, SBREAD_DEFAULT, false); close(fd); return ret; @@ -168,7 +171,7 @@ int get_btrfs_mount(const char *dev, char *mp, size_t mp_size) goto out; } - ret = check_mounted_where(fd, dev, mp, mp_size, NULL, SBREAD_DEFAULT); + ret = check_mounted_where(fd, dev, mp, mp_size, NULL, SBREAD_DEFAULT, false); if (!ret) { ret = -EINVAL; } else { /* mounted, all good */ diff --git a/common/open-utils.h b/common/open-utils.h index 3924be36e2ea..27000cdbd626 100644 --- a/common/open-utils.h +++ b/common/open-utils.h @@ -23,7 +23,8 @@ struct btrfs_fs_devices; int check_mounted_where(int fd, const char *file, char *where, int size, - struct btrfs_fs_devices **fs_dev_ret, unsigned sbflags); + struct btrfs_fs_devices **fs_dev_ret, unsigned sbflags, + bool noscan); int check_mounted(const char* file); int get_btrfs_mount(const char *dev, char *mp, size_t mp_size); int open_path_or_dev_mnt(const char *path, DIR **dirstream, int verbose); diff --git a/common/utils.c b/common/utils.c index 436ff8c2a827..b62f9f04ad5a 100644 --- a/common/utils.c +++ b/common/utils.c @@ -230,7 +230,8 @@ int get_fs_info(const char *path, struct btrfs_ioctl_fs_info_args *fi_args, goto out; } ret = check_mounted_where(fd, path, mp, sizeof(mp), - &fs_devices_mnt, SBREAD_DEFAULT); + &fs_devices_mnt, SBREAD_DEFAULT, + false); if (!ret) { ret = -EINVAL; goto out; diff --git a/tune/main.c b/tune/main.c index e38c1f6d3729..0ca1e01282c9 100644 --- a/tune/main.c +++ b/tune/main.c @@ -268,7 +268,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) } ret = check_mounted_where(fd, device, NULL, 0, NULL, - SBREAD_IGNORE_FSID_MISMATCH); + SBREAD_IGNORE_FSID_MISMATCH, false); if (ret < 0) { errno = -ret; error("could not check mount status of %s: %m", device);