From patchwork Fri Jul 21 09:45:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321722 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 8028CC0015E for ; Fri, 21 Jul 2023 09:46:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229891AbjGUJqJ (ORCPT ); Fri, 21 Jul 2023 05:46:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbjGUJp4 (ORCPT ); Fri, 21 Jul 2023 05:45:56 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3298B30CB for ; Fri, 21 Jul 2023 02:45:55 -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 36KLMalv025796; Fri, 21 Jul 2023 09:45:51 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=6ONOo55tdf3ee+BxrYEgkRmZAzZhTN+QPS0HdmE5hsw=; b=ulnyvbmNUqnYb8AuRMfi4H2f0vffc/olLsdnxrDBRoCz8/KXRP6HVwWVUN3Z33u5i0j7 eIen5Ck16kf6+FH/lMlFo5+NvXsh3lnq+PwNoUIZY/5JnuOERXd/ZnfBk8eX8MpAwCnR tL7LHfy9R5b8w9G27lLJBOaxCmK3AVYLvdqaIOBvRUd1bniZ5tp+k7zc8GIhxb0elwUM KQJrOvSWEHf7cNeleQl6opFllbdYNSCwbMwEaFQVFzso4dEfSmxSe43p9ggt/2UqqQXE hwEhhpW74B9tOnDCBla7HSjz8D33lu6a07+mGR+Qav6WlsnjulYUaBaGsz43cDxXN0RT EA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run88upb6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:45:51 +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 36L9DoxI000851; Fri, 21 Jul 2023 09:45:51 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2045.outbound.protection.outlook.com [104.47.51.45]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhw9tpjj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:45:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jK34bopjpjzObHmQtgGskgxUsLCccBGULPNikkzfxfyQCD7oF6apYAEJflgJo6/ecTq43ldqFM40pjU1FecZszfJKONxd1CoAIAMzTA8psp/aMBibSfCRiRGR7f5cgf93KIUasr9fq+hCdI92WlM/EojKk5pFzOON/vLFll2ARgZPZ4YGlv0Q75+wa1JMLDfKm751c4Ooi5/4g5Um7Z+eOk6q0MaNGnFaRI/La5X/6whLxxm6XjPQJPSl87fyvp02WydvTWx2kq3YJNpAgHPCqAIRTxU88eRl8ZoHAKGcuswizAtLhLVF0RpH/LPHZcgqz0mgSioJdos7/w0rtduvg== 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=6ONOo55tdf3ee+BxrYEgkRmZAzZhTN+QPS0HdmE5hsw=; b=Pneh7/xaMYizy5VKuUqzZguyFnYyk7eriDqdLjWVCjciShq5ktcQoxNlxv5nRHtArfcrCk7VOhRMplzAG51gurjTjwzasJvLBiCK2a9r1zRw6U+GyxwoT6AQnvVqRH/GAXfgD+wq09IvGgbWaVb5sKK3EZJa9U2yhjCwoBYOwevCcvTW3MsDnZF5IQ3u0FfpsQhetpC1Z5q3B2MG2TfGDel5t3axXk9gqEsqw/ODFi1bwhbFm9DwO97UIIJYKWXKG4JDeOuRZZ1KA3Vkr1VgtUbZx2qhJvtiqS/GArmZgwD4kVkfYqts9/9uukvoC/p2hvkYTIiA5/Nrt1x9UcwDFQ== 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=6ONOo55tdf3ee+BxrYEgkRmZAzZhTN+QPS0HdmE5hsw=; b=p1wOeJVQTiBks9XzRf4bOg65bdp9fkcb0ZcFzqk5M6un5Lvr4LqBffeUs9Y3iKMy1YFHDJgQ76TqzhMgDatOZoG72AsJyVL+nZR8di2x4PRFaw6tqHz08j1zV2sLdr0t4uFvLwqH/mjFau430/r8I8hH3JslceaAZAHe2TNdUqI= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by SA2PR10MB4412.namprd10.prod.outlook.com (2603:10b6:806:117::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:45:49 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:45:49 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 01/23] metadump: Use boolean values true/false instead of 1/0 Date: Fri, 21 Jul 2023 15:15:11 +0530 Message-Id: <20230721094533.1351868-2-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: TYCP286CA0078.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2b3::15) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|SA2PR10MB4412:EE_ X-MS-Office365-Filtering-Correlation-Id: 049a09b7-d0f2-4baa-7192-08db89cf4418 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vRLWkj6n0fWLogehxuEltzcytb/86A/D6j0JfcNcEqRuKbg06MCQy1Pj8HnLQvHCbtY3d20FI1rXH4kX+s3mXxKueLhBKdSuDZc8CTzeqUmRp1NCN5i3QeH8YR5+pCZP/KqxGa+Vao129gcsAOvtFLxUOmgg79Yte4rJcazRWUhN02s6KAm1PRLlxyg7c0BOHDM+EwbAdxLGzjJiX947DL56r2mL6Bf1BtCIRUndXk9PBKrttlfpDi162G5CcA83rfLTua06wTkyeO7CZs2PvMwBdKpNlPkiSvt+rDj75my4m/UitbkdcqkT9A1eaXJZin1S+/e09XQBR1Ijbmrf5vGAIqiflwMnIMZ8sSQiTjA59q/irSPAwVUypPYOYCm43XyW1OIWXECeiAUt2PdPEbATCxlD094WvGBMJlCwmezSB7sa2lRLp/AFj5dr0kRqo4PD60SoVnSaRHjbBVejnRMA2L3cbng0A4lPKP+MD3vAUzp0eAmu6cUkMFSN4u12n5eCn9zoqu94OpJ5FBELPIh/YXn9SMpplx2GBs+XhxpvcElvkRgf69/lHJrl8jX8 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(39860400002)(346002)(136003)(396003)(366004)(451199021)(6486002)(6666004)(6512007)(83380400001)(36756003)(2616005)(86362001)(38100700002)(6506007)(186003)(26005)(1076003)(2906002)(8676002)(8936002)(316002)(66946007)(66476007)(66556008)(4326008)(6916009)(478600001)(5660300002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JxJ9Ybn/rxmUYhq3cYofKo9PktbmFy/d/ZAvRq6k25zrDKf47aif4pZKVEaXYiLptFj6DgMEZx5zcGDpyqq0PJCL34SmvPVa09rHVrqUQNboCb3EF1ON/BfixIX6hcrKybhiqZw0O1nI2H5blKO3h33+mP3Z4PZCM1NO0S6hiL3/L0sO4Ocg/Lly5wCbA/IYyhjIrUuBUczkHukrXD0sfOENxyD9qMg7wAzGWk1tIohMKXhVGsV0969ho8cGRXHJKAVxDr31j7lirSM4ZQrEr9mYUyW/aAp9EOwn4A6x/HcCl23w8DM5Qz5lqlf1CPAunC0Uz+9a2DBfv2aPt8UiAi9psNsDylSFeWw0U+MfK9J/+ahjf1C4vzX1Si4V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g: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 049a09b7-d0f2-4baa-7192-08db89cf4418 X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:45:49.7550 (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: 8D3eZoEwT1oYLquBNd8h54anVCTp+T9TrkkQfj/IGH2jnMPdq03jbWt+2IqJZVAkQWByeLslwa6zmmLTZ7NAig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4412 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 bulkscore=0 mlxscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307210087 X-Proofpoint-GUID: lg6zb-_mIZYMc0qCVbabFN_p8_hfteq0 X-Proofpoint-ORIG-GUID: lg6zb-_mIZYMc0qCVbabFN_p8_hfteq0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R --- db/metadump.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/metadump.c b/db/metadump.c index 27d1df43..6bcfd5bb 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -2421,12 +2421,12 @@ process_inode( case S_IFDIR: rval = process_inode_data(dip, TYP_DIR2); if (dip->di_format == XFS_DINODE_FMT_LOCAL) - need_new_crc = 1; + need_new_crc = true; break; case S_IFLNK: rval = process_inode_data(dip, TYP_SYMLINK); if (dip->di_format == XFS_DINODE_FMT_LOCAL) - need_new_crc = 1; + need_new_crc = true; break; case S_IFREG: rval = process_inode_data(dip, TYP_DATA); @@ -2436,7 +2436,7 @@ process_inode( case S_IFBLK: case S_IFSOCK: process_dev_inode(dip); - need_new_crc = 1; + need_new_crc = true; break; default: break; @@ -2450,7 +2450,7 @@ process_inode( attr_data.remote_val_count = 0; switch (dip->di_aformat) { case XFS_DINODE_FMT_LOCAL: - need_new_crc = 1; + need_new_crc = true; if (obfuscate || zero_stale_data) process_sf_attr(dip); break; @@ -2469,7 +2469,7 @@ process_inode( done: /* Heavy handed but low cost; just do it as a catch-all. */ if (zero_stale_data) - need_new_crc = 1; + need_new_crc = true; if (crc_was_ok && need_new_crc) libxfs_dinode_calc_crc(mp, dip); From patchwork Fri Jul 21 09:45:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321723 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 F2D1DEB64DD for ; Fri, 21 Jul 2023 09:46:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229654AbjGUJqK (ORCPT ); Fri, 21 Jul 2023 05:46:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjGUJqD (ORCPT ); Fri, 21 Jul 2023 05:46:03 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EB94F0 for ; Fri, 21 Jul 2023 02:46:03 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36KLMVvf004927; Fri, 21 Jul 2023 09:46:00 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=Qx1R60DXnIB3N5o6yMynJzdO/XXQYFPlNasasf4Q6TQ=; b=AwujAh3NfPykF5yy3WtLDZOtPVxeYexAuRfEtIY0U7eCsE/cLUWl6EB7IX9lrmxD5eAT Kra27HPpULCDxpuGOt9F5B3atO7tyfSjf+220SSt39YmDIUt4vPli3hbA3zyu9y4k/2E B7xaDsLBNJ/MX6xm015PGyX+gEGSzMXPskwQQwiiQQEZqqPzyb6NH9bp8yJSmFI9hFAm 19wn1XvoUzjJ+vd5X9CLCAPS0pW7Q4aQzNz5I+otimoi8tntpPLK5Mggw+5kodhI2wh+ GM7CwMtHUzwwiaMJk2+oyz6COwp3N39cfGNW4QqWim0U3DYUNBQj1ZHg/xsWrHrQQ44z ow== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run8abmy6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:00 +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 36L8jPEN023834; Fri, 21 Jul 2023 09:45:59 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2104.outbound.protection.outlook.com [104.47.55.104]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhwa27dj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:45:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nz9Y6BArqywlx2hOYR/3L3SLH+i7v0E6IJaadpVh4glLtLXk57nZGtnXU7d8KNd2aKS69P4KHsRX9uefVdBUcppisdQjll3sHwHAn0G2fRiIgdvxC78CKGRM5E+icPdAKYhW/cEdEBB6evMuWbJ6Rl5rHGj3KQn626wy0D4RTovuhJIvn8pI9Pc42KKxPXm+RNAyULPh1sCAADuoyIAo+Kk2pIw1ACrR8cs8qT+wHkaL+BM0JLGj2Ix6KajzM2Oxwzk6Sq/Xa9smDaidrurwGcjE1mhxLSLoF+y7LirIfs68L7zIVrGe9PtMY+UC+5pdSLtg5UK0JXQ3KHZzGYoLPg== 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=Qx1R60DXnIB3N5o6yMynJzdO/XXQYFPlNasasf4Q6TQ=; b=JPJJVW84B1UkWi+rQk18ei1RMkwSwSG007NrmaCzQXuOHmBo6y6vOCmbmhH5VZ8tXSjbm8BwqCYqkql4O476gJRn7Qn+o8l8SqHB0aRJJJkmehX1QGPQ/35ECmqi64WsmD/P0jfiIWlKdetT8HWTNNkgPR5Vjl0t0FgSHHY3ql8d4+87eOC9omzwo/Qe7LrB9LmvuG3Bb74RLqDp1fBJDt28XAn0Pmcd53/nyAoCKW+r5Xn0QAUm7UENtvUb8DaXIF/RQFTzW/1HbFXxHcqlpDTnlOPuyXRWMI3e+DSm/H7vt8y2qph5oi+y2oonlgw0BmCLiIBT+7YdE6gAqLXzjA== 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=Qx1R60DXnIB3N5o6yMynJzdO/XXQYFPlNasasf4Q6TQ=; b=OvRuJJZ/44mt4IxekIYlL18f8SJHSMS7OhnK1mocnTfp/wPPSDq2+DRRrRg1gkF8HVSlghCaiYFb6xL2Ke68z1GrL97aR2KGZUTlNMo6C9EU/r8b0YWmpZklQaEVt5+ZjtxyaGFm2gPA/K8i1DL1w6V5rxBWTElVXOAkcuo73dw= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by SA2PR10MB4412.namprd10.prod.outlook.com (2603:10b6:806:117::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:45:56 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:45:56 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 02/23] mdrestore: Fix logic used to check if target device is large enough Date: Fri, 21 Jul 2023 15:15:12 +0530 Message-Id: <20230721094533.1351868-3-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: TYCPR01CA0179.jpnprd01.prod.outlook.com (2603:1096:400:2b2::14) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|SA2PR10MB4412:EE_ X-MS-Office365-Filtering-Correlation-Id: de8e1afd-e6a1-4add-6c1e-08db89cf4857 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cNkpKg+EgDAHnQRcy7y4xEecLJv0nMM28SsMlQ4bzJAJBZZXyzabm2mRT8Lyjni3NOX83bKvqQmkP2H+u2UxcgYi/gwFIgYzbaXhYNMl4lRe5teGswKoN2WbfWredmgNdCc13v5NsncV9ruEiSg5rl6kxmBm5ycntg1J1Xt97n4SIQjqlr+fOSFQ+vWYouYYW3I8LxdJoZByudVFMIKVe2oXgvOQea60CXsfNFmyTO5pVNFta2eL3mGNdkMr8aDVxh6fnR5QDI+IktAxKYASwcNPa0lVg4xhcxWOk81ooQzKqSlG3AXai95GttQ5eVg5v3T5u+vbULCTX+aw73KduAzBOMP581zbVzUn2iI3jJHITORmbhlbA00Qol4dAbWKp6ahR4dD+lr6geKZhbwuPKrvTeQdb7L1ghVow2jSr1p8uW2mjG4r1R/Bi6XztiJ1+4dVVXVHS3EUVauaeTJya0A5JfUBtnkT8LXnsgiZe4LAWbcYN4GyxRQYE9EGW1SWzr4u4+9fvXA7PNgU4mp2wtuqB005LJFt4HO81Yx21XPAvkvPjPy00ri881ySS2G3 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(39860400002)(346002)(136003)(396003)(366004)(451199021)(6486002)(6666004)(6512007)(83380400001)(36756003)(2616005)(86362001)(38100700002)(6506007)(186003)(26005)(1076003)(4744005)(2906002)(8676002)(8936002)(316002)(66946007)(66476007)(66556008)(4326008)(6916009)(478600001)(5660300002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UOrX7SRNMMsASLUf6FYg4vSwH3++7UZ2uSLvLzg9HdWAgkT8k82hltRFg0FRS59M1uhJUMJXVZFiwwkcUcj0canEYnXxmLf0+yUkhy2NIypOaYK5swOvkNrIVGfCSfRrv/fwvwUZOcIruiyTPBIlJOG9fhp3uWkUEWI+ddYSff1zN0D+pC4mrdEPC6JE1B+E9jl/8eSEpuZeKiJNCP+EadIzy92NpIbOPuY1s59Pyei50Ggg66F+5EOQRDV4HO94IAeaddZgO65lz0x1eIX1ybC3YKMN2vGYxv42k8SIzNAP/SnXzSMrIy6DYx6jkwJxomBMYQ4UZalP642uvpu84enkf6ZwGnIXHsUdaWc5Mp3QKZ4OW4hqoE4x4TpcFDqwcdcrvictg3uoYombSz7IxsRE+x03DvFWNSV36pu/WnWSDnnU2vZ/xVA6p/iIBHH/2B+yAsVSzztvVnqjgSrEORbhQ8qjkEHDjy6LnsNd/1AcTBSmCktAhVsBsGrfEd1KdpdUpwg6FvsaGR4ZVp4lJwVEI6uBypL96TtuXhUe9mHtIA4EWh7dRk6JbYZ5MJXdb7V333F/ZOeCk4pobkqNuokquWAqkIfvsyLPzxM2RJA8jj6P/aIFUMlZX4+LKufyPMcrzNZviF/9HgVrSrSJR4f4BM1peVj0VRiit1r0CbOxexqbB7XBm4wS99aYvdv8eNbWKfhP/+nmub98xSSryy4+PPbceMM3idudgzkKIrIMBcvW3xDgCtthafUHdKOdt3+w6GVfmEb0Tl/33EEPl1lO27vUars4DGQQiRAPF3rFhrq4MrQPiG5SPe+qlql71OaQ6yYywnZLDRFOVBiuV8M7fsyuuy4BvoewSbivFq7i1WZbAE3z9F7MYknJJC/ckk5OXqTFAuwIW8ZTTKPda6CxzfySH7IcaiccXok7q8nfF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R0crMISTEw2csG4Ctwgk5RIcf5RYUDiWSSXO/svRpAKXEcc4d0piuaTDNEOsD59AhisAH/iN7N0QYXcyrFRVf4w6wT+dYHeXs/LTsz2F1NNgdWKvYLnXkW3plb2MEcHGULhvP/NQBNK9NtA/u0po4sGhzRrBhkxRCM5DhWkMix7a/cqypu6GZVpCqeZVX+r6VaA4VHbtSLgLCNvguziKcRXnIVuwItO4fyKIjvPEtkSjntsbPBXfpggnjhhjuN4OtOuSHCtgo8P0nhU3LnU7+M3LLsZW72GdXDUR3KPblfB4NV0fT9ySgAQxYG7ONKg2L1gKoNPN+X8LNirWFzv1uwQj/lE3UxRn07EtGZRWM/1/0+WTWPZLkYv7VfKMcPQ4zw3PM/UWGwUDg3OFcI7JBXQbDNtg5+Kvzq1iQR63O2VD9BWSeNYcacx+ZgUMMoN/UweH6/rJoXY+L676OvOR720rC40Y8JqtyXC0UD8amWLvEuLJA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: de8e1afd-e6a1-4add-6c1e-08db89cf4857 X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:45:56.8652 (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: 3xN4bchZpebtyDWG1P1qeR5Ts3lk2hWfSKpdl++RVIJoMfcFuBBji3wLZGAQT3Mn76Y72x6Bgr8GGhLUFItOgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4412 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 adultscore=0 mlxscore=0 bulkscore=0 spamscore=0 malwarescore=0 mlxlogscore=974 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307210087 X-Proofpoint-GUID: TvZxfy-RDi1DtqSwgQPJTF2CcNHe9EMF X-Proofpoint-ORIG-GUID: TvZxfy-RDi1DtqSwgQPJTF2CcNHe9EMF Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org The device size verification code should be writing XFS_MAX_SECTORSIZE bytes to the end of the device rather than "sizeof(char *) * XFS_MAX_SECTORSIZE" bytes. Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R --- mdrestore/xfs_mdrestore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c index 7c1a66c4..333282ed 100644 --- a/mdrestore/xfs_mdrestore.c +++ b/mdrestore/xfs_mdrestore.c @@ -115,7 +115,7 @@ perform_restore( } else { /* ensure device is sufficiently large enough */ - char *lb[XFS_MAX_SECTORSIZE] = { NULL }; + char lb[XFS_MAX_SECTORSIZE] = { 0 }; off64_t off; off = sb.sb_dblocks * sb.sb_blocksize - sizeof(lb); From patchwork Fri Jul 21 09:45:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321724 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 8FF57C0015E for ; Fri, 21 Jul 2023 09:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229961AbjGUJqM (ORCPT ); Fri, 21 Jul 2023 05:46:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjGUJqL (ORCPT ); Fri, 21 Jul 2023 05:46:11 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D96DF0 for ; Fri, 21 Jul 2023 02:46:09 -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 36KLMaRs025795; Fri, 21 Jul 2023 09:46:07 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=5sF550dpaQoiszjKP4QVc8CaDyyVb7656y+9Wv50MQg=; b=d6qotjzl0HdyQfezd1+zUXAMuTRZtgVC9xsmUv4p1m+DR4MnAG7CvEucrkXISxQyrpeH ms769csXhf6NUD4AGoQKF2I4BxwlSH8qKOyNpYh62QWTGv1hihHCOenMIQK4jDSSHdwZ HTuBeqfMyFtrGEa7fLC1c53z1pINUZGfhwTl7/CiuHeqoSekK2wo2Kyzjp/8cpgFQ73d hDjILuiwk5KlWTDawIEPrz2Z5FHFeu7bF4ERfV2hJEEWKLNJGMDbUnkwV1L0p4KoVSoG n/zNQnmnEXh2AVv7WCaw3OfHrNwQmR8UNXjDywD9X5qjfI7IwRLpm4BBdwrn3v11B+jv aw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run88upbm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:06 +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 36L7oAe4024039; Fri, 21 Jul 2023 09:46:05 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhwa27gs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SRllcx4qIrh0GT/l0DO4d/056xpowgsWoRMe1NbcI8mAgfMp7RiOUnLWdYtTN3LqFcO5nvRN57aFFXCij1gUD4hRqA//Y5aPM3iLtQFApZ4AhqIpdka7Dm0el/T73MiBtz87W0FaiGauCovUk7kwaY162Wx3i5sAns9AQ1B0vCxgjxhug+dfHQoGIKEvhf7S37P4AwgiB6Y+/ojFH7m4DpSuJGtM0RElkWnbyT0l3OvjoZv6p4HXBXlYEO5N/PKQHejx1HI9ZVgoNoZ76bC6BAupWn4O4BXrnMWu3f+v+QyTb6vl35Ib8c8wwXOxOQCxW52+iS/tz/SRHR0BmMMmpw== 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=5sF550dpaQoiszjKP4QVc8CaDyyVb7656y+9Wv50MQg=; b=mr2nidFuAfOq7+okVFd+t9c8cLYB0z39M0oGE7X4VHHtSAe3LisxPnNky75FKzlW3dZGKQqxNBnMZrjWlLSklrE4+fdmGSfY52e/DF+kx1wewMiPgY0llUTaLHk6EUvUtEkZGNs9MgY7j5lULuKl58vgdu/pfwLBRxnVCoAvQNIjYwxDl1tdu6PI3tvckiLEkW2lORSayWJHa+rstBXS9IzH3mgp0QiAaTApTv1XzwE3xPl6+oMBS17iPK9PRlfQqr6F7eHz8FBacTUPpCzoLca4E5el9SFjM74W9PVVyy3syzxE3hIrYAid6H9WI5+nQaJnpgS1hBLklfvrcliKfA== 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=5sF550dpaQoiszjKP4QVc8CaDyyVb7656y+9Wv50MQg=; b=S3jDrw++Bf6dZy6EnWBD7vugWGNiQJ0fe9GiKt6KkEfE4bp+nIpq+pK7KQuJZIXWACIL4sfMzdC6sTTjhe9E86zOF/ZomoUBfxe/nUiOSIOhPuuFhJa54wfb9QRS6u7MxqJEaylglbVkUiEcXVd12x3Kkm6Z/w7mPFGxQLEwlzU= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by SA2PR10MB4412.namprd10.prod.outlook.com (2603:10b6:806:117::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:46:03 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:46:03 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 03/23] metadump: Declare boolean variables with bool type Date: Fri, 21 Jul 2023 15:15:13 +0530 Message-Id: <20230721094533.1351868-4-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: TYCP286CA0237.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c7::15) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|SA2PR10MB4412:EE_ X-MS-Office365-Filtering-Correlation-Id: 8aa2628a-07dc-4c17-1914-08db89cf4c88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z/TvTGkZN3OtGvbs6HUeoF0hrL6PhTTZFzxo+IYlw25rjXplR/V+HNP5E5x9phhY8mRAfui+RHCgko4MHyzyrFOhJy7FqXZ87DsXNpIOSZMaN31OjnLOZ8o5Mwg5OQMaXA2e1eZ2Ef/mCQrEWIZztg7mM7taoHRB/AYusDaIOCe9xwDOLrMXT2H24D+y8PeDob1aV6BmAjvRtInMCaYYuD+ap6CQb1Le6xsCScPorPeAryawA8bR02bP0ZXjMs7Ugq80G1jfj/ZIDquGDIe7KCHMQKXdS8Rg0mDFXXQSEQuh3EWhuhepvLzZo+d9DISo2nvQ9nrptHuGbscwPkiFDRjCVahKXD4DRWoxyHhpOJy04puF7Xs4q7ACGiDPI/teveaQX5VdOuDMOqAnR4d+jsQUoP79gloU01NiP/8BAvx/2+gKlBa6YmBNnXc1S7ulN51U7reKV0lsGrD3iyLlI2esMVT/jEBWtsRkXl95eb6lmZXYCGHCTU6BXOAmsNYodzDxhVVFkn6QEov54VepnIK7mJC3r2zF3Q33mqEoqK/6M8NHXGgTLNE8Cow3H5aw X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(39860400002)(346002)(136003)(396003)(366004)(451199021)(6486002)(6666004)(6512007)(83380400001)(36756003)(2616005)(86362001)(38100700002)(6506007)(186003)(26005)(1076003)(2906002)(8676002)(8936002)(316002)(66946007)(66476007)(66556008)(4326008)(6916009)(478600001)(5660300002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Qwf9QVyrEKs7EBEEpwT6skaFDG7AKXDiv17eBsmZGzvTwF2bu9gagEjaXR7kNCc9eSKEd/l4FHclHVNF4yTsk0dgcd9jzvF+anSPS1WTEuh12XjYGJzYxLUusiv+S3keUsyHxjygDe9vdUKBgUsreDKVa1POunnQL8UXPkVRDhwtaljI/O6+P+oTlerjpQUkTqhNZ5NXdCdm4eHo8l/CFHS1f/oPNg4PERRp7xK1NUFyGvFqkZSbLmwg2Xct9MKgXEwieJ9jkxgP/yNkF5jI15SaVfyrvEnk3UcGfGmm2vcGmMyno15NhMWNJcfHPQcRIu3gpMnqyHI09nc+cUJ4lxfEfeiDkdxyUqjQtUY2uM96HLiULQMgEBzu+M5zC9GwKjxwKV4iz7qZmqPMiqiUK55WV7N+M9gC/I89fUp7+7qRyCypV9fum5b2eCCj057luWRwg62q1PoW+L0qDibhPK5nYXoqxKB4MNXdIJVgMiIYixsxpgWvFGSAtNVVBK9jhtg/1q9N+78y7KbNtrMdi9ScmFsKK/J9f4Xo97hIjvxXU5uAs1ef9xs2NBz6Bf24YG38BVhRChc8ntB1BQO/PE+Xt+saFMjbMIyvfFx8Bwfps2HqeqDzrzaG+yVioLjHDryOskWbIhbbMe0NZ5G4F1tYDwd8lvpdi4Qg/SzDch12WBRwXi9RinUTt7PBY7P0bIfjtYUY3LdEeH1kfUrmFUj2D4KDlUfwXhbJYmC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h1amxjqi52E2nxqL7xxR2oa9qArHpfziJPJoUlK+1uLJ+byC4Z2hX0gI56mtaresLdNxrNwMezFgchxqdKj1kmafnWQCIcjmj9r/29oMEveCHHHbn5YsCt7KGzjacFpyXP2Ww2jNKbnr9lfU2Pij7hjonSulHCiBohQ+9osa6xZzqzERIiMC4YhbC+WEqJTQiUXKeEs0FeJvY3dzecetJCHsT8Es9Xp+jXTKBxwxM9T06a4mI5H/JO+E9ZZX9Ktay0pr+1wr5Bb9j0Uy/ZHRXosuxjkAxNt9JGz8V+v2HAtZgBXsRNvmwU6XIUZLDjEhm0+vnOMcof//oKb70RnkxgstZ4zMw5O8z8YbI8j5NafSlxHn+kj1TPd4osxOrN364hyYnjNYXdm3LlF1icgb0gO1MdGSV/O74BTRXHLmoGc4qVL7nTGHeNqXRePlziufM/vUxTfa4Bq0x9tsA5FIE5SGAz/Cb+QWSLA0PgztOuXmEl8jvHIlc7uzVvZE72S87tkzY9fPHgXeHoTWH5gwGV03J8H5SoDqKLiq+tXzPMlTCXF+xLmKBAAt772TqqNLEpaPRwadt2fzTq1TMNXKtuoBzYGUTc6bm71uav+B6akhi0LyHe7wl1il7oRYacUidSh4mupqoGKUYoPy+WlPW/ox4c= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8aa2628a-07dc-4c17-1914-08db89cf4c88 X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:46:03.9016 (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: sSmchm7+ziOgvzLnIFGB4QIjX505EeaJQi/BshCeVGwgrknCV9PKBkWMGwbLFWEsmxXH9kenqZBHfsbG+aKUeg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4412 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 adultscore=0 mlxscore=0 bulkscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307210087 X-Proofpoint-GUID: 1bS0SgR6aEpT77VZ3X9oo9RML7U5k7Pt X-Proofpoint-ORIG-GUID: 1bS0SgR6aEpT77VZ3X9oo9RML7U5k7Pt Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R --- db/metadump.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/db/metadump.c b/db/metadump.c index 6bcfd5bb..8b33fbfb 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -51,13 +51,13 @@ static int cur_index; static xfs_ino_t cur_ino; -static int show_progress = 0; -static int stop_on_read_error = 0; +static bool show_progress = false; +static bool stop_on_read_error = false; static int max_extent_size = DEFAULT_MAX_EXT_SIZE; -static int obfuscate = 1; -static int zero_stale_data = 1; -static int show_warnings = 0; -static int progress_since_warning = 0; +static bool obfuscate = true; +static bool zero_stale_data = true; +static bool show_warnings = false; +static bool progress_since_warning = false; static bool stdout_metadump; void @@ -100,7 +100,7 @@ print_warning(const char *fmt, ...) fprintf(stderr, "%s%s: %s\n", progress_since_warning ? "\n" : "", progname, buf); - progress_since_warning = 0; + progress_since_warning = false; } static void @@ -121,7 +121,7 @@ print_progress(const char *fmt, ...) f = stdout_metadump ? stderr : stdout; fprintf(f, "\r%-59s", buf); fflush(f); - progress_since_warning = 1; + progress_since_warning = true; } /* @@ -2979,9 +2979,9 @@ metadump_f( char *p; exitcode = 1; - show_progress = 0; - show_warnings = 0; - stop_on_read_error = 0; + show_progress = false; + show_warnings = false; + stop_on_read_error = false; if (mp->m_sb.sb_magicnum != XFS_SB_MAGIC) { print_warning("bad superblock magic number %x, giving up", @@ -3002,13 +3002,13 @@ metadump_f( while ((c = getopt(argc, argv, "aegm:ow")) != EOF) { switch (c) { case 'a': - zero_stale_data = 0; + zero_stale_data = false; break; case 'e': - stop_on_read_error = 1; + stop_on_read_error = true; break; case 'g': - show_progress = 1; + show_progress = true; break; case 'm': max_extent_size = (int)strtol(optarg, &p, 0); @@ -3019,10 +3019,10 @@ metadump_f( } break; case 'o': - obfuscate = 0; + obfuscate = false; break; case 'w': - show_warnings = 1; + show_warnings = true; break; default: print_warning("bad option for metadump command"); From patchwork Fri Jul 21 09:45:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321727 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 D4A3DC001DE for ; Fri, 21 Jul 2023 09:46:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230212AbjGUJqe (ORCPT ); Fri, 21 Jul 2023 05:46:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbjGUJqc (ORCPT ); Fri, 21 Jul 2023 05:46:32 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D90D121 for ; Fri, 21 Jul 2023 02:46:19 -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 36KLNJQB003496; Fri, 21 Jul 2023 09:46:14 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=jaydoIx5euRqH98rEQ8yCOLTTyuuHGOKyMbmUexC760=; b=FiEhg8DKYv1meGqSEPJu2N3AGo5WLltL2ZoB+bSGpiPKDiwjztz7mbUZpRP5aZlPOXf9 vpzf8GfJxmEQLIRSflVj1OFt8PyMCJC5K0BZUEQ5u4P2pvqnjQNvls8r+6jZ9gtVk36M KhUpR8B6NSVZZpAoQwikZUNnEnbk1vmuHRZszDnfVNM74LGxVb9SYXuswoq1qZLkyt2T KbdE1AsMo2DHt7uaOPOcpUebNfWTiWsiaUmgQDVjQxksSuSxvFLvMwAuxiuEIyMEHKU/ ekYfvThDgjVwrYL4oEVpdkRohlOBtHlEfNV1zg5EmbyybbdAxhE9rUhqYw7ooaG3tN8F GQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run8abkup-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:14 +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 36L9SYU2019201; Fri, 21 Jul 2023 09:46:13 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2107.outbound.protection.outlook.com [104.47.55.107]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhwa91bu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R6hPK5BcRcMsXjtTI5X4EFUVS5pXwO2mL5LRsxd+9r8SBhb4o/JVaeCl/1r4uflSPYx7wjJOrE2Hi+ekM1c+QQE2gabTzsAqOCCj0j9EGwyNoXLFNnXp8MeevVTJdvB0lwLz1ynPxnz3KGVEjF76MdwNk/zRZwTEY0gC/z/ZvWy+aaN9wKiFeBpaHTRX7NV/cJ4+XgJ6hDGFh0OQyENZPFi+ZSmDZsr+/L02Mzm7BjKiFwhHcZtPMhMFPYUI6VdGkBz84u6opMhhbdhmT5rKToZSeGr6A2BYcYDH3Z6je3jNGR7/MtsTCdT+7n+CFWoN+szc7wex2BQpc+NBgL6ORg== 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=jaydoIx5euRqH98rEQ8yCOLTTyuuHGOKyMbmUexC760=; b=VJ7zTCrkNBnpmFBSMvjYK99P4ECmINIgX+LKhDUi/QJrdVsVyECkxmJQTNyTdRT0UZm3kHNHubAeFMVTa9EoAgILXZJ46B6YRHv+YhnHjSlBQHVfIPwkdSoYcSEfvJ6bEZDN57K7Dy8bpbFswK+ar7Qn4bUiiHGGSrBSHPLyZsS2RBRhBn9qdFke36O0jVc27UX07kr+Gd9Tyf7XavEX5yzLcr0P0k6Wibkav3cgs2g8U9ECmwm99qXVvrZo+++ymnxmu8dJ6BU6JZrwOqYiQnPk7spgiemFRq7Z0GJDoJYsQFTbmKJFOzOzdheSvQyhT0AbNdt6oErvNHiOZR0xfg== 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=jaydoIx5euRqH98rEQ8yCOLTTyuuHGOKyMbmUexC760=; b=lOWLvXjW2Q2FG9zC/djm56Zv+erN+Lp8m++UrO2fNANFZJnbGaP8gJ+PbXHH6iou2jhkAl7A2OJm37u6T5PZrefkdw4Jqqho0WEWdAmie/N+hvcImzZwdLGwXB8OuKFekFFHhy24QkRB64/q2x0dgFmCUa0ifiku6v+tP5ATWO0= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by SA2PR10MB4412.namprd10.prod.outlook.com (2603:10b6:806:117::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:46:10 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:46:10 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org, Carlos Maiolino Subject: [PATCH V3 04/23] metadump: Define and use struct metadump Date: Fri, 21 Jul 2023 15:15:14 +0530 Message-Id: <20230721094533.1351868-5-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: TYCP286CA0186.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:382::14) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|SA2PR10MB4412:EE_ X-MS-Office365-Filtering-Correlation-Id: 43432ffc-d557-4da4-51ee-08db89cf4fd6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BKqioARz6SZfLdCbgAQkF0tewsBUhYOAqrxZ+4NL9oUp9OrqhV8wvM/bmsNP1dulLwkoQtXVVYhZGBF+tsBBrpk/pCcFNlyP3Of9CzSiO/qpKqCUTQdgepL089TXP9QRG8obZtgSarG9FSGrCh8QwVQu7+w3frOiiVYwxC/YMrR8nYGKARj2tTlvKySM0Id4ziK1Z7F9i7JPjZ89AMsGiO4eMjQcvt4rnckHnzsze6oINNisr4lB0x88LSSAtHOotPGwbzUNKMpY0VGk2+pREFQSsqX6ZBQ7RlhmIO++YFLef6oGewHw9IiMTSD7jDgWT4d7vbBOV5uQTBALVFQ0veqzsfHwTggdW2+sMe0iDciqSrsBD0i2KvW8g8NkLKIsGbZYl+Mh3EGc0B3HLCfkN/e/aUFu8rm2tPGOR4A29k5M6GYMV80mnLHKOIL1O3xdcRQuNMKrzRfdsfotz1kjGNxY/tzCXX5MoFxqo2XrFxfu1btnlSYm/QK70KLYuhetLXq5UA/0XSCbGThchARUAHTnqOBOBSTd1R8E1HJhZQO9BuuxPrc+PzF1kFyAJi4m X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(39860400002)(346002)(136003)(396003)(366004)(451199021)(6486002)(6512007)(83380400001)(36756003)(2616005)(86362001)(38100700002)(6506007)(186003)(26005)(1076003)(30864003)(2906002)(54906003)(8676002)(8936002)(316002)(66946007)(66476007)(66556008)(4326008)(6916009)(478600001)(5660300002)(41300700001)(579004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ta8+0ISEWcBKU2saktrJe7c5xvwpJ6q+8ga2fKfs/5fO9qX8POb2Naw+zyoC344k+GGrrn0BQS6ZipMHyO9lvHAFNYfuALXM1XpRcPIjjB+oCncGdAhWrExmfQI8SQZ4DJKk6yKE5Dte0VCa7PIjXIU+lAhS23aQBf5Z0+jy4vCUg/nX4LvhTpK0v9tYm/YdPzYsMCt5fSeVC9jedYqGrhWg2IxSMwY2UaGgRlKIbH+h//0ES287fgvE20Tx37mRFk1RWwpi+sE1n2SWrAyev6VcP4MIztD/6Dz0lUNL56OJV2fHeoHdiu7WGYbAloHblgo1Iw4T06YjD+FE09cClWc0tz+18m4lzmCTW04cXILMBkzRseu+td/IkElxSn7DMTnXHzFg7Tbd1o/OKmFnuc+thGByWJDlGdBLxrhW99Qt3PDtSqt40IA5/4IQBdQovTmu5gmcxCAikSEUNx61E3eZuK3iBUFHxhlSMcaBKqnILuuuXsrwnivu3lwaEjhWZxo3tIZPY2TeyOefDVLq24UsEvzbPPw8kgUkrvvwv/pwybG6Vbp6ncKfJcLi4Ni8TlprVjOH1bEvbP5keh99DlKIMD7/4amstoxwBom0LftDAaRzz90C9qbYfpQV4AVstaTHUY7IEhz2PQNsjRSc/KowOHmTe+fud31NK1C+p5TvYHX+CiYMaY5YfS0pZl4O2pXUH2+aDoSny4lE38/qINeIE4vtELLHjUETDkMraQECncVQzPifv1eHow9T64dubJDx1BNFsLa32wwJuuOyuYWG/xs9SWcpHcPbSg2mjD8GvChfYd43MGqsPltRP/AUdmMRToGZPJRAuHNI9MIubDv10EipAY2sbnqwBr6EPNt/s9aeH3sercHXDTCmhC+cQGLezSk257rj1aEcuVFHa9NKIhkUwnkbWm4bmUCboy4cwLF0WGE9mjXQWtoQTPmM1LLRzRJC+GUm+vJn4Mr+u+9paGfmxMOC1+fier83J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MWpjHsfFGhCLCJ/3DXcQBIUVLtNFgGNfHtISrGiun1a4rb7zvkk33i+Ba8gnm+A3JOm5fbRfO4XcPdr7LdDd9VZb2fFdMZLsB0MnTelzkf2/lozVatQFFloC26vYZoDrkfcowvwIBZ2wRW7v0gE14wo0vOrQo+NE2RA88JXZmELVUrRD0T+h77eWo5JX/q1moDeKsD2cI6vtjtRFe+FXdTqZU+RaS10ShJBmQU/ZeXzL+XCLuhGEolamJSRJlgmYdun5GSEcBpTyit9DWALb2LgF9VBwhyhjbf5CpluImrepNF9aVpKrlZVKbnPO5r1bNhJwooAZp71w9v605rn2R/s4vdyWnxQVNLLjmQduyFUe4QDN/e//bqfmqCdhXNp1SERG6SHcudLJeC75/o1i0ZudcVdq7Cpfm X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43432ffc-d557-4da4-51ee-08db89cf4fd6 X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:46:10.3309 (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: 57qY6ag2ZZJH8FVe/voPzzopbcaeE6y6Ktz1EEvvhD5AvHfgQTLPvEuU8sVJ7wQa8E9LFwJPA0DFJxg70FKwHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4412 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=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-2306200000 definitions=main-2307210087 X-Proofpoint-ORIG-GUID: 0-6-2WWiOEtGC9kFLbEMpbLS0kOlqDsC X-Proofpoint-GUID: 0-6-2WWiOEtGC9kFLbEMpbLS0kOlqDsC Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This commit collects all state tracking variables in a new "struct metadump" structure. This is done to collect all the global variables in one place rather than having them spread across the file. A new structure member of type "struct metadump_ops *" will be added by a future commit to support the two versions of metadump. Reviewed-by: Carlos Maiolino Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R --- db/metadump.c | 458 +++++++++++++++++++++++++++----------------------- 1 file changed, 244 insertions(+), 214 deletions(-) diff --git a/db/metadump.c b/db/metadump.c index 8b33fbfb..c24947ec 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -40,25 +40,27 @@ static const cmdinfo_t metadump_cmd = N_("[-a] [-e] [-g] [-m max_extent] [-w] [-o] filename"), N_("dump metadata to a file"), metadump_help }; -static FILE *outf; /* metadump file */ - -static xfs_metablock_t *metablock; /* header + index + buffers */ -static __be64 *block_index; -static char *block_buffer; - -static int num_indices; -static int cur_index; - -static xfs_ino_t cur_ino; - -static bool show_progress = false; -static bool stop_on_read_error = false; -static int max_extent_size = DEFAULT_MAX_EXT_SIZE; -static bool obfuscate = true; -static bool zero_stale_data = true; -static bool show_warnings = false; -static bool progress_since_warning = false; -static bool stdout_metadump; +static struct metadump { + int version; + bool show_progress; + bool stop_on_read_error; + int max_extent_size; + bool show_warnings; + bool obfuscate; + bool zero_stale_data; + bool progress_since_warning; + bool dirty_log; + bool stdout_metadump; + xfs_ino_t cur_ino; + /* Metadump file */ + FILE *outf; + /* header + index + buffers */ + struct xfs_metablock *metablock; + __be64 *block_index; + char *block_buffer; + int num_indices; + int cur_index; +} metadump; void metadump_init(void) @@ -98,9 +100,10 @@ print_warning(const char *fmt, ...) va_end(ap); buf[sizeof(buf)-1] = '\0'; - fprintf(stderr, "%s%s: %s\n", progress_since_warning ? "\n" : "", + fprintf(stderr, "%s%s: %s\n", + metadump.progress_since_warning ? "\n" : "", progname, buf); - progress_since_warning = false; + metadump.progress_since_warning = false; } static void @@ -118,10 +121,10 @@ print_progress(const char *fmt, ...) va_end(ap); buf[sizeof(buf)-1] = '\0'; - f = stdout_metadump ? stderr : stdout; + f = metadump.stdout_metadump ? stderr : stdout; fprintf(f, "\r%-59s", buf); fflush(f); - progress_since_warning = true; + metadump.progress_since_warning = true; } /* @@ -136,17 +139,19 @@ print_progress(const char *fmt, ...) static int write_index(void) { + struct xfs_metablock *metablock = metadump.metablock; /* * write index block and following data blocks (streaming) */ - metablock->mb_count = cpu_to_be16(cur_index); - if (fwrite(metablock, (cur_index + 1) << BBSHIFT, 1, outf) != 1) { + metablock->mb_count = cpu_to_be16(metadump.cur_index); + if (fwrite(metablock, (metadump.cur_index + 1) << BBSHIFT, 1, + metadump.outf) != 1) { print_warning("error writing to target file"); return -1; } - memset(block_index, 0, num_indices * sizeof(__be64)); - cur_index = 0; + memset(metadump.block_index, 0, metadump.num_indices * sizeof(__be64)); + metadump.cur_index = 0; return 0; } @@ -163,9 +168,10 @@ write_buf_segment( int ret; for (i = 0; i < len; i++, off++, data += BBSIZE) { - block_index[cur_index] = cpu_to_be64(off); - memcpy(&block_buffer[cur_index << BBSHIFT], data, BBSIZE); - if (++cur_index == num_indices) { + metadump.block_index[metadump.cur_index] = cpu_to_be64(off); + memcpy(&metadump.block_buffer[metadump.cur_index << BBSHIFT], + data, BBSIZE); + if (++metadump.cur_index == metadump.num_indices) { ret = write_index(); if (ret) return -EIO; @@ -388,11 +394,11 @@ scan_btree( if (iocur_top->data == NULL) { print_warning("cannot read %s block %u/%u", typtab[btype].name, agno, agbno); - rval = !stop_on_read_error; + rval = !metadump.stop_on_read_error; goto pop_out; } - if (zero_stale_data) { + if (metadump.zero_stale_data) { zero_btree_block(iocur_top->data, btype); iocur_top->need_crc = 1; } @@ -446,7 +452,7 @@ scanfunc_freesp( numrecs = be16_to_cpu(block->bb_numrecs); if (numrecs > mp->m_alloc_mxr[1]) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid numrecs (%u) in %s block %u/%u", numrecs, typtab[btype].name, agno, agbno); return 1; @@ -455,7 +461,7 @@ scanfunc_freesp( pp = XFS_ALLOC_PTR_ADDR(mp, block, 1, mp->m_alloc_mxr[1]); for (i = 0; i < numrecs; i++) { if (!valid_bno(agno, be32_to_cpu(pp[i]))) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid block number (%u/%u) " "in %s block %u/%u", agno, be32_to_cpu(pp[i]), @@ -482,13 +488,13 @@ copy_free_bno_btree( /* validate root and levels before processing the tree */ if (root == 0 || root > mp->m_sb.sb_agblocks) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid block number (%u) in bnobt " "root in agf %u", root, agno); return 1; } if (levels > mp->m_alloc_maxlevels) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid level (%u) in bnobt root " "in agf %u", levels, agno); return 1; @@ -510,13 +516,13 @@ copy_free_cnt_btree( /* validate root and levels before processing the tree */ if (root == 0 || root > mp->m_sb.sb_agblocks) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid block number (%u) in cntbt " "root in agf %u", root, agno); return 1; } if (levels > mp->m_alloc_maxlevels) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid level (%u) in cntbt root " "in agf %u", levels, agno); return 1; @@ -543,7 +549,7 @@ scanfunc_rmapbt( numrecs = be16_to_cpu(block->bb_numrecs); if (numrecs > mp->m_rmap_mxr[1]) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid numrecs (%u) in %s block %u/%u", numrecs, typtab[btype].name, agno, agbno); return 1; @@ -552,7 +558,7 @@ scanfunc_rmapbt( pp = XFS_RMAP_PTR_ADDR(block, 1, mp->m_rmap_mxr[1]); for (i = 0; i < numrecs; i++) { if (!valid_bno(agno, be32_to_cpu(pp[i]))) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid block number (%u/%u) " "in %s block %u/%u", agno, be32_to_cpu(pp[i]), @@ -582,13 +588,13 @@ copy_rmap_btree( /* validate root and levels before processing the tree */ if (root == 0 || root > mp->m_sb.sb_agblocks) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid block number (%u) in rmapbt " "root in agf %u", root, agno); return 1; } if (levels > mp->m_rmap_maxlevels) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid level (%u) in rmapbt root " "in agf %u", levels, agno); return 1; @@ -615,7 +621,7 @@ scanfunc_refcntbt( numrecs = be16_to_cpu(block->bb_numrecs); if (numrecs > mp->m_refc_mxr[1]) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid numrecs (%u) in %s block %u/%u", numrecs, typtab[btype].name, agno, agbno); return 1; @@ -624,7 +630,7 @@ scanfunc_refcntbt( pp = XFS_REFCOUNT_PTR_ADDR(block, 1, mp->m_refc_mxr[1]); for (i = 0; i < numrecs; i++) { if (!valid_bno(agno, be32_to_cpu(pp[i]))) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid block number (%u/%u) " "in %s block %u/%u", agno, be32_to_cpu(pp[i]), @@ -654,13 +660,13 @@ copy_refcount_btree( /* validate root and levels before processing the tree */ if (root == 0 || root > mp->m_sb.sb_agblocks) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid block number (%u) in refcntbt " "root in agf %u", root, agno); return 1; } if (levels > mp->m_refc_maxlevels) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid level (%u) in refcntbt root " "in agf %u", levels, agno); return 1; @@ -785,7 +791,8 @@ in_lost_found( /* Record the "lost+found" inode if we haven't done so already */ ASSERT(ino != 0); - if (!orphanage_ino && is_orphanage_dir(mp, cur_ino, namelen, name)) + if (!orphanage_ino && is_orphanage_dir(mp, metadump.cur_ino, namelen, + name)) orphanage_ino = ino; /* We don't obfuscate the "lost+found" directory itself */ @@ -795,7 +802,7 @@ in_lost_found( /* Most files aren't in "lost+found" at all */ - if (cur_ino != orphanage_ino) + if (metadump.cur_ino != orphanage_ino) return 0; /* @@ -1219,7 +1226,7 @@ generate_obfuscated_name( print_warning("duplicate name for inode %llu " "in dir inode %llu\n", (unsigned long long) ino, - (unsigned long long) cur_ino); + (unsigned long long) metadump.cur_ino); return; } @@ -1229,7 +1236,7 @@ generate_obfuscated_name( print_warning("unable to record name for inode %llu " "in dir inode %llu\n", (unsigned long long) ino, - (unsigned long long) cur_ino); + (unsigned long long) metadump.cur_ino); } static void @@ -1245,9 +1252,9 @@ process_sf_dir( ino_dir_size = be64_to_cpu(dip->di_size); if (ino_dir_size > XFS_DFORK_DSIZE(dip, mp)) { ino_dir_size = XFS_DFORK_DSIZE(dip, mp); - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid size in dir inode %llu", - (long long)cur_ino); + (long long)metadump.cur_ino); } sfep = xfs_dir2_sf_firstentry(sfp); @@ -1261,9 +1268,9 @@ process_sf_dir( int namelen = sfep->namelen; if (namelen == 0) { - if (show_warnings) + if (metadump.show_warnings) print_warning("zero length entry in dir inode " - "%llu", (long long)cur_ino); + "%llu", (long long)metadump.cur_ino); if (i != sfp->count - 1) break; namelen = ino_dir_size - ((char *)&sfep->name[0] - @@ -1271,16 +1278,17 @@ process_sf_dir( } else if ((char *)sfep - (char *)sfp + libxfs_dir2_sf_entsize(mp, sfp, sfep->namelen) > ino_dir_size) { - if (show_warnings) + if (metadump.show_warnings) print_warning("entry length in dir inode %llu " - "overflows space", (long long)cur_ino); + "overflows space", + (long long)metadump.cur_ino); if (i != sfp->count - 1) break; namelen = ino_dir_size - ((char *)&sfep->name[0] - (char *)sfp); } - if (obfuscate) + if (metadump.obfuscate) generate_obfuscated_name( libxfs_dir2_sf_get_ino(mp, sfp, sfep), namelen, &sfep->name[0]); @@ -1290,7 +1298,8 @@ process_sf_dir( } /* zero stale data in rest of space in data fork, if any */ - if (zero_stale_data && (ino_dir_size < XFS_DFORK_DSIZE(dip, mp))) + if (metadump.zero_stale_data && + (ino_dir_size < XFS_DFORK_DSIZE(dip, mp))) memset(sfep, 0, XFS_DFORK_DSIZE(dip, mp) - ino_dir_size); } @@ -1346,18 +1355,18 @@ process_sf_symlink( len = be64_to_cpu(dip->di_size); if (len > XFS_DFORK_DSIZE(dip, mp)) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid size (%d) in symlink inode %llu", - len, (long long)cur_ino); + len, (long long)metadump.cur_ino); len = XFS_DFORK_DSIZE(dip, mp); } buf = (char *)XFS_DFORK_DPTR(dip); - if (obfuscate) + if (metadump.obfuscate) obfuscate_path_components(buf, len); /* zero stale data in rest of space in data fork, if any */ - if (zero_stale_data && len < XFS_DFORK_DSIZE(dip, mp)) + if (metadump.zero_stale_data && len < XFS_DFORK_DSIZE(dip, mp)) memset(&buf[len], 0, XFS_DFORK_DSIZE(dip, mp) - len); } @@ -1382,9 +1391,9 @@ process_sf_attr( ino_attr_size = be16_to_cpu(asfp->hdr.totsize); if (ino_attr_size > XFS_DFORK_ASIZE(dip, mp)) { ino_attr_size = XFS_DFORK_ASIZE(dip, mp); - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid attr size in inode %llu", - (long long)cur_ino); + (long long)metadump.cur_ino); } asfep = &asfp->list[0]; @@ -1394,19 +1403,20 @@ process_sf_attr( int namelen = asfep->namelen; if (namelen == 0) { - if (show_warnings) + if (metadump.show_warnings) print_warning("zero length attr entry in inode " - "%llu", (long long)cur_ino); + "%llu", (long long)metadump.cur_ino); break; } else if ((char *)asfep - (char *)asfp + xfs_attr_sf_entsize(asfep) > ino_attr_size) { - if (show_warnings) + if (metadump.show_warnings) print_warning("attr entry length in inode %llu " - "overflows space", (long long)cur_ino); + "overflows space", + (long long)metadump.cur_ino); break; } - if (obfuscate) { + if (metadump.obfuscate) { generate_obfuscated_name(0, asfep->namelen, &asfep->nameval[0]); memset(&asfep->nameval[asfep->namelen], 'v', @@ -1418,7 +1428,8 @@ process_sf_attr( } /* zero stale data in rest of space in attr fork, if any */ - if (zero_stale_data && (ino_attr_size < XFS_DFORK_ASIZE(dip, mp))) + if (metadump.zero_stale_data && + (ino_attr_size < XFS_DFORK_ASIZE(dip, mp))) memset(asfep, 0, XFS_DFORK_ASIZE(dip, mp) - ino_attr_size); } @@ -1429,7 +1440,7 @@ process_dir_free_block( struct xfs_dir2_free *free; struct xfs_dir3_icfree_hdr freehdr; - if (!zero_stale_data) + if (!metadump.zero_stale_data) return; free = (struct xfs_dir2_free *)block; @@ -1451,10 +1462,10 @@ process_dir_free_block( break; } default: - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid magic in dir inode %llu " "free block", - (unsigned long long)cur_ino); + (unsigned long long)metadump.cur_ino); break; } } @@ -1466,7 +1477,7 @@ process_dir_leaf_block( struct xfs_dir2_leaf *leaf; struct xfs_dir3_icleaf_hdr leafhdr; - if (!zero_stale_data) + if (!metadump.zero_stale_data) return; /* Yes, this works for dir2 & dir3. Difference is padding. */ @@ -1549,10 +1560,10 @@ process_dir_data_block( } if (be32_to_cpu(datahdr->magic) != wantmagic) { - if (show_warnings) + if (metadump.show_warnings) print_warning( "invalid magic in dir inode %llu block %ld", - (unsigned long long)cur_ino, (long)offset); + (unsigned long long)metadump.cur_ino, (long)offset); return; } @@ -1572,10 +1583,10 @@ process_dir_data_block( if (dir_offset + free_length > end_of_data || !free_length || (free_length & (XFS_DIR2_DATA_ALIGN - 1))) { - if (show_warnings) + if (metadump.show_warnings) print_warning( "invalid length for dir free space in inode %llu", - (long long)cur_ino); + (long long)metadump.cur_ino); return; } if (be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) != @@ -1588,7 +1599,7 @@ process_dir_data_block( * actually at a variable offset, so zeroing &dup->tag * is zeroing the free space in between */ - if (zero_stale_data) { + if (metadump.zero_stale_data) { int zlen = free_length - sizeof(xfs_dir2_data_unused_t); @@ -1606,23 +1617,23 @@ process_dir_data_block( if (dir_offset + length > end_of_data || ptr + length > endptr) { - if (show_warnings) + if (metadump.show_warnings) print_warning( "invalid length for dir entry name in inode %llu", - (long long)cur_ino); + (long long)metadump.cur_ino); return; } if (be16_to_cpu(*libxfs_dir2_data_entry_tag_p(mp, dep)) != dir_offset) return; - if (obfuscate) + if (metadump.obfuscate) generate_obfuscated_name(be64_to_cpu(dep->inumber), dep->namelen, &dep->name[0]); dir_offset += length; ptr += length; /* Zero the unused space after name, up to the tag */ - if (zero_stale_data) { + if (metadump.zero_stale_data) { /* 1 byte for ftype; don't bother with conditional */ int zlen = (char *)libxfs_dir2_data_entry_tag_p(mp, dep) - @@ -1658,7 +1669,7 @@ process_symlink_block( print_warning("cannot read %s block %u/%u (%llu)", typtab[btype].name, agno, agbno, s); - rval = !stop_on_read_error; + rval = !metadump.stop_on_read_error; goto out_pop; } link = iocur_top->data; @@ -1666,10 +1677,10 @@ process_symlink_block( if (xfs_has_crc((mp))) link += sizeof(struct xfs_dsymlink_hdr); - if (obfuscate) + if (metadump.obfuscate) obfuscate_path_components(link, XFS_SYMLINK_BUF_SPACE(mp, mp->m_sb.sb_blocksize)); - if (zero_stale_data) { + if (metadump.zero_stale_data) { size_t linklen, zlen; linklen = strlen(link); @@ -1736,7 +1747,8 @@ process_attr_block( if ((be16_to_cpu(leaf->hdr.info.magic) != XFS_ATTR_LEAF_MAGIC) && (be16_to_cpu(leaf->hdr.info.magic) != XFS_ATTR3_LEAF_MAGIC)) { for (i = 0; i < attr_data.remote_val_count; i++) { - if (obfuscate && attr_data.remote_vals[i] == offset) + if (metadump.obfuscate && + attr_data.remote_vals[i] == offset) /* Macros to handle both attr and attr3 */ memset(block + (bs - XFS_ATTR3_RMT_BUF_SPACE(mp, bs)), @@ -1753,9 +1765,9 @@ process_attr_block( nentries * sizeof(xfs_attr_leaf_entry_t) + xfs_attr3_leaf_hdr_size(leaf) > XFS_ATTR3_RMT_BUF_SPACE(mp, bs)) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid attr count in inode %llu", - (long long)cur_ino); + (long long)metadump.cur_ino); return; } @@ -1770,22 +1782,22 @@ process_attr_block( first_name = xfs_attr3_leaf_name(leaf, i); if (be16_to_cpu(entry->nameidx) > mp->m_sb.sb_blocksize) { - if (show_warnings) + if (metadump.show_warnings) print_warning( "invalid attr nameidx in inode %llu", - (long long)cur_ino); + (long long)metadump.cur_ino); break; } if (entry->flags & XFS_ATTR_LOCAL) { local = xfs_attr3_leaf_name_local(leaf, i); if (local->namelen == 0) { - if (show_warnings) + if (metadump.show_warnings) print_warning( "zero length for attr name in inode %llu", - (long long)cur_ino); + (long long)metadump.cur_ino); break; } - if (obfuscate) { + if (metadump.obfuscate) { generate_obfuscated_name(0, local->namelen, &local->nameval[0]); memset(&local->nameval[local->namelen], 'v', @@ -1797,18 +1809,18 @@ process_attr_block( zlen = xfs_attr_leaf_entsize_local(nlen, vlen) - (sizeof(xfs_attr_leaf_name_local_t) - 1 + nlen + vlen); - if (zero_stale_data) + if (metadump.zero_stale_data) memset(&local->nameval[nlen + vlen], 0, zlen); } else { remote = xfs_attr3_leaf_name_remote(leaf, i); if (remote->namelen == 0 || remote->valueblk == 0) { - if (show_warnings) + if (metadump.show_warnings) print_warning( "invalid attr entry in inode %llu", - (long long)cur_ino); + (long long)metadump.cur_ino); break; } - if (obfuscate) { + if (metadump.obfuscate) { generate_obfuscated_name(0, remote->namelen, &remote->name[0]); add_remote_vals(be32_to_cpu(remote->valueblk), @@ -1819,13 +1831,13 @@ process_attr_block( zlen = xfs_attr_leaf_entsize_remote(nlen) - (sizeof(xfs_attr_leaf_name_remote_t) - 1 + nlen); - if (zero_stale_data) + if (metadump.zero_stale_data) memset(&remote->name[nlen], 0, zlen); } } /* Zero from end of entries array to the first name/val */ - if (zero_stale_data) { + if (metadump.zero_stale_data) { struct xfs_attr_leaf_entry *entries; entries = xfs_attr3_leaf_entryp(leaf); @@ -1858,16 +1870,16 @@ process_single_fsb_objects( print_warning("cannot read %s block %u/%u (%llu)", typtab[btype].name, agno, agbno, s); - rval = !stop_on_read_error; + rval = !metadump.stop_on_read_error; goto out_pop; } - if (!obfuscate && !zero_stale_data) + if (!metadump.obfuscate && !metadump.zero_stale_data) goto write; /* Zero unused part of interior nodes */ - if (zero_stale_data) { + if (metadump.zero_stale_data) { xfs_da_intnode_t *node = iocur_top->data; int magic = be16_to_cpu(node->hdr.info.magic); @@ -1978,12 +1990,12 @@ process_multi_fsb_dir( print_warning("cannot read %s block %u/%u (%llu)", typtab[btype].name, agno, agbno, s); - rval = !stop_on_read_error; + rval = !metadump.stop_on_read_error; goto out_pop; } - if (!obfuscate && !zero_stale_data) + if (!metadump.obfuscate && !metadump.zero_stale_data) goto write; dp = iocur_top->data; @@ -2075,25 +2087,27 @@ process_bmbt_reclist( * one is found, stop processing remaining extents */ if (i > 0 && op + cp > o) { - if (show_warnings) + if (metadump.show_warnings) print_warning("bmap extent %d in %s ino %llu " "starts at %llu, previous extent " "ended at %llu", i, - typtab[btype].name, (long long)cur_ino, + typtab[btype].name, + (long long)metadump.cur_ino, o, op + cp - 1); break; } - if (c > max_extent_size) { + if (c > metadump.max_extent_size) { /* * since we are only processing non-data extents, * large numbers of blocks in a metadata extent is * extremely rare and more than likely to be corrupt. */ - if (show_warnings) + if (metadump.show_warnings) print_warning("suspicious count %u in bmap " "extent %d in %s ino %llu", c, i, - typtab[btype].name, (long long)cur_ino); + typtab[btype].name, + (long long)metadump.cur_ino); break; } @@ -2104,19 +2118,21 @@ process_bmbt_reclist( agbno = XFS_FSB_TO_AGBNO(mp, s); if (!valid_bno(agno, agbno)) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid block number %u/%u " "(%llu) in bmap extent %d in %s ino " "%llu", agno, agbno, s, i, - typtab[btype].name, (long long)cur_ino); + typtab[btype].name, + (long long)metadump.cur_ino); break; } if (!valid_bno(agno, agbno + c - 1)) { - if (show_warnings) + if (metadump.show_warnings) print_warning("bmap extent %i in %s inode %llu " "overflows AG (end is %u/%u)", i, - typtab[btype].name, (long long)cur_ino, + typtab[btype].name, + (long long)metadump.cur_ino, agno, agbno + c - 1); break; } @@ -2152,7 +2168,7 @@ scanfunc_bmap( if (level == 0) { if (nrecs > mp->m_bmap_dmxr[0]) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid numrecs (%u) in %s " "block %u/%u", nrecs, typtab[btype].name, agno, agbno); @@ -2163,7 +2179,7 @@ scanfunc_bmap( } if (nrecs > mp->m_bmap_dmxr[1]) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid numrecs (%u) in %s block %u/%u", nrecs, typtab[btype].name, agno, agbno); return 1; @@ -2178,7 +2194,7 @@ scanfunc_bmap( if (bno == 0 || bno > mp->m_sb.sb_agblocks || ag > mp->m_sb.sb_agcount) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid block number (%u/%u) " "in %s block %u/%u", ag, bno, typtab[btype].name, agno, agbno); @@ -2213,10 +2229,10 @@ process_btinode( nrecs = be16_to_cpu(dib->bb_numrecs); if (level > XFS_BM_MAXLEVELS(mp, whichfork)) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid level (%u) in inode %lld %s " - "root", level, (long long)cur_ino, - typtab[btype].name); + "root", level, (long long)metadump.cur_ino, + typtab[btype].name); return 1; } @@ -2227,16 +2243,16 @@ process_btinode( maxrecs = libxfs_bmdr_maxrecs(XFS_DFORK_SIZE(dip, mp, whichfork), 0); if (nrecs > maxrecs) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid numrecs (%u) in inode %lld %s " - "root", nrecs, (long long)cur_ino, - typtab[btype].name); + "root", nrecs, (long long)metadump.cur_ino, + typtab[btype].name); return 1; } pp = XFS_BMDR_PTR_ADDR(dib, 1, maxrecs); - if (zero_stale_data) { + if (metadump.zero_stale_data) { char *top; /* Unused btree key space */ @@ -2257,11 +2273,11 @@ process_btinode( if (bno == 0 || bno > mp->m_sb.sb_agblocks || ag > mp->m_sb.sb_agcount) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid block number (%u/%u) " - "in inode %llu %s root", ag, - bno, (long long)cur_ino, - typtab[btype].name); + "in inode %llu %s root", ag, bno, + (long long)metadump.cur_ino, + typtab[btype].name); continue; } @@ -2288,14 +2304,16 @@ process_exinode( whichfork); used = nex * sizeof(xfs_bmbt_rec_t); if (nex > max_nex || used > XFS_DFORK_SIZE(dip, mp, whichfork)) { - if (show_warnings) + if (metadump.show_warnings) print_warning("bad number of extents %llu in inode %lld", - (unsigned long long)nex, (long long)cur_ino); + (unsigned long long)nex, + (long long)metadump.cur_ino); return 1; } /* Zero unused data fork past used extents */ - if (zero_stale_data && (used < XFS_DFORK_SIZE(dip, mp, whichfork))) + if (metadump.zero_stale_data && + (used < XFS_DFORK_SIZE(dip, mp, whichfork))) memset(XFS_DFORK_PTR(dip, whichfork) + used, 0, XFS_DFORK_SIZE(dip, mp, whichfork) - used); @@ -2311,7 +2329,7 @@ process_inode_data( { switch (dip->di_format) { case XFS_DINODE_FMT_LOCAL: - if (!(obfuscate || zero_stale_data)) + if (!(metadump.obfuscate || metadump.zero_stale_data)) break; /* @@ -2323,7 +2341,7 @@ process_inode_data( print_warning( "Invalid data fork size (%d) in inode %llu, preserving contents!", XFS_DFORK_DSIZE(dip, mp), - (long long)cur_ino); + (long long)metadump.cur_ino); break; } @@ -2355,9 +2373,9 @@ process_dev_inode( struct xfs_dinode *dip) { if (xfs_dfork_data_extents(dip)) { - if (show_warnings) + if (metadump.show_warnings) print_warning("inode %llu has unexpected extents", - (unsigned long long)cur_ino); + (unsigned long long)metadump.cur_ino); return; } @@ -2369,11 +2387,11 @@ process_dev_inode( if (XFS_DFORK_DSIZE(dip, mp) > XFS_LITINO(mp)) { print_warning( "Invalid data fork size (%d) in inode %llu, preserving contents!", - XFS_DFORK_DSIZE(dip, mp), (long long)cur_ino); + XFS_DFORK_DSIZE(dip, mp), (long long)metadump.cur_ino); return; } - if (zero_stale_data) { + if (metadump.zero_stale_data) { unsigned int size = sizeof(xfs_dev_t); memset(XFS_DFORK_DPTR(dip) + size, 0, @@ -2399,17 +2417,17 @@ process_inode( bool crc_was_ok = false; /* no recalc by default */ bool need_new_crc = false; - cur_ino = XFS_AGINO_TO_INO(mp, agno, agino); + metadump.cur_ino = XFS_AGINO_TO_INO(mp, agno, agino); /* we only care about crc recalculation if we will modify the inode. */ - if (obfuscate || zero_stale_data) { + if (metadump.obfuscate || metadump.zero_stale_data) { crc_was_ok = libxfs_verify_cksum((char *)dip, mp->m_sb.sb_inodesize, offsetof(struct xfs_dinode, di_crc)); } if (free_inode) { - if (zero_stale_data) { + if (metadump.zero_stale_data) { /* Zero all of the inode literal area */ memset(XFS_DFORK_DPTR(dip), 0, XFS_LITINO(mp)); } @@ -2451,7 +2469,8 @@ process_inode( switch (dip->di_aformat) { case XFS_DINODE_FMT_LOCAL: need_new_crc = true; - if (obfuscate || zero_stale_data) + if (metadump.obfuscate || + metadump.zero_stale_data) process_sf_attr(dip); break; @@ -2468,7 +2487,7 @@ process_inode( done: /* Heavy handed but low cost; just do it as a catch-all. */ - if (zero_stale_data) + if (metadump.zero_stale_data) need_new_crc = true; if (crc_was_ok && need_new_crc) @@ -2528,7 +2547,7 @@ copy_inode_chunk( if (agino == 0 || agino == NULLAGINO || !valid_bno(agno, agbno) || !valid_bno(agno, XFS_AGINO_TO_AGBNO(mp, agino + XFS_INODES_PER_CHUNK - 1))) { - if (show_warnings) + if (metadump.show_warnings) print_warning("bad inode number %llu (%u/%u)", XFS_AGINO_TO_INO(mp, agno, agino), agno, agino); return 1; @@ -2544,7 +2563,7 @@ copy_inode_chunk( (xfs_has_align(mp) && mp->m_sb.sb_inoalignmt != 0 && agbno % mp->m_sb.sb_inoalignmt != 0)) { - if (show_warnings) + if (metadump.show_warnings) print_warning("badly aligned inode (start = %llu)", XFS_AGINO_TO_INO(mp, agno, agino)); return 1; @@ -2561,7 +2580,7 @@ copy_inode_chunk( if (iocur_top->data == NULL) { print_warning("cannot read inode block %u/%u", agno, agbno); - rval = !stop_on_read_error; + rval = !metadump.stop_on_read_error; goto pop_out; } @@ -2587,7 +2606,7 @@ next_bp: ioff += inodes_per_buf; } - if (show_progress) + if (metadump.show_progress) print_progress("Copied %u of %u inodes (%u of %u AGs)", inodes_copied, mp->m_sb.sb_icount, agno, mp->m_sb.sb_agcount); @@ -2617,7 +2636,7 @@ scanfunc_ino( if (level == 0) { if (numrecs > igeo->inobt_mxr[0]) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid numrecs %d in %s " "block %u/%u", numrecs, typtab[btype].name, agno, agbno); @@ -2640,7 +2659,7 @@ scanfunc_ino( } if (numrecs > igeo->inobt_mxr[1]) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid numrecs %d in %s block %u/%u", numrecs, typtab[btype].name, agno, agbno); numrecs = igeo->inobt_mxr[1]; @@ -2649,7 +2668,7 @@ scanfunc_ino( pp = XFS_INOBT_PTR_ADDR(mp, block, 1, igeo->inobt_mxr[1]); for (i = 0; i < numrecs; i++) { if (!valid_bno(agno, be32_to_cpu(pp[i]))) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid block number (%u/%u) " "in %s block %u/%u", agno, be32_to_cpu(pp[i]), @@ -2677,13 +2696,13 @@ copy_inodes( /* validate root and levels before processing the tree */ if (root == 0 || root > mp->m_sb.sb_agblocks) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid block number (%u) in inobt " "root in agi %u", root, agno); return 1; } if (levels > M_IGEO(mp)->inobt_maxlevels) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid level (%u) in inobt root " "in agi %u", levels, agno); return 1; @@ -2697,7 +2716,7 @@ copy_inodes( levels = be32_to_cpu(agi->agi_free_level); if (root == 0 || root > mp->m_sb.sb_agblocks) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid block number (%u) in " "finobt root in agi %u", root, agno); @@ -2705,7 +2724,7 @@ copy_inodes( } if (levels > M_IGEO(mp)->inobt_maxlevels) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid level (%u) in finobt " "root in agi %u", levels, agno); return 1; @@ -2736,11 +2755,11 @@ scan_ag( XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL); if (!iocur_top->data) { print_warning("cannot read superblock for ag %u", agno); - if (stop_on_read_error) + if (metadump.stop_on_read_error) goto pop_out; } else { /* Replace any filesystem label with "L's" */ - if (obfuscate) { + if (metadump.obfuscate) { struct xfs_sb *sb = iocur_top->data; memset(sb->sb_fname, 'L', min(strlen(sb->sb_fname), sizeof(sb->sb_fname))); @@ -2758,7 +2777,7 @@ scan_ag( agf = iocur_top->data; if (iocur_top->data == NULL) { print_warning("cannot read agf block for ag %u", agno); - if (stop_on_read_error) + if (metadump.stop_on_read_error) goto pop_out; } else { if (write_buf(iocur_top)) @@ -2773,7 +2792,7 @@ scan_ag( agi = iocur_top->data; if (iocur_top->data == NULL) { print_warning("cannot read agi block for ag %u", agno); - if (stop_on_read_error) + if (metadump.stop_on_read_error) goto pop_out; } else { if (write_buf(iocur_top)) @@ -2787,10 +2806,10 @@ scan_ag( XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL); if (iocur_top->data == NULL) { print_warning("cannot read agfl block for ag %u", agno); - if (stop_on_read_error) + if (metadump.stop_on_read_error) goto pop_out; } else { - if (agf && zero_stale_data) { + if (agf && metadump.zero_stale_data) { /* Zero out unused bits of agfl */ int i; __be32 *agfl_bno; @@ -2813,7 +2832,7 @@ scan_ag( /* copy AG free space btrees */ if (agf) { - if (show_progress) + if (metadump.show_progress) print_progress("Copying free space trees of AG %u", agno); if (!copy_free_bno_btree(agno, agf)) @@ -2859,7 +2878,7 @@ copy_ino( if (agno >= mp->m_sb.sb_agcount || agbno >= mp->m_sb.sb_agblocks || offset >= mp->m_sb.sb_inopblock) { - if (show_warnings) + if (metadump.show_warnings) print_warning("invalid %s inode number (%lld)", typtab[itype].name, (long long)ino); return 1; @@ -2871,12 +2890,12 @@ copy_ino( if (iocur_top->data == NULL) { print_warning("cannot read %s inode %lld", typtab[itype].name, (long long)ino); - rval = !stop_on_read_error; + rval = !metadump.stop_on_read_error; goto pop_out; } off_cur(offset << mp->m_sb.sb_inodelog, mp->m_sb.sb_inodesize); - cur_ino = ino; + metadump.cur_ino = ino; rval = process_inode_data(iocur_top->data, itype); pop_out: pop_cur(); @@ -2912,7 +2931,7 @@ copy_log(void) int logversion; int cycle = XLOG_INIT_CYCLE; - if (show_progress) + if (metadump.show_progress) print_progress("Copying log"); push_cur(); @@ -2921,11 +2940,11 @@ copy_log(void) if (iocur_top->data == NULL) { pop_cur(); print_warning("cannot read log"); - return !stop_on_read_error; + return !metadump.stop_on_read_error; } /* If not obfuscating or zeroing, just copy the log as it is */ - if (!obfuscate && !zero_stale_data) + if (!metadump.obfuscate && !metadump.zero_stale_data) goto done; dirty = xlog_is_dirty(mp, &log, &x, 0); @@ -2933,7 +2952,7 @@ copy_log(void) switch (dirty) { case 0: /* clear out a clean log */ - if (show_progress) + if (metadump.show_progress) print_progress("Zeroing clean log"); logstart = XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart); @@ -2948,7 +2967,7 @@ copy_log(void) break; case 1: /* keep the dirty log */ - if (obfuscate) + if (metadump.obfuscate) print_warning( _("Warning: log recovery of an obfuscated metadata image can leak " "unobfuscated metadata and/or cause image corruption. If possible, " @@ -2956,7 +2975,7 @@ _("Warning: log recovery of an obfuscated metadata image can leak " break; case -1: /* log detection error */ - if (obfuscate) + if (metadump.obfuscate) print_warning( _("Could not discern log; image will contain unobfuscated metadata in log.")); break; @@ -2979,9 +2998,15 @@ metadump_f( char *p; exitcode = 1; - show_progress = false; - show_warnings = false; - stop_on_read_error = false; + + metadump.version = 1; + metadump.show_progress = false; + metadump.stop_on_read_error = false; + metadump.max_extent_size = DEFAULT_MAX_EXT_SIZE; + metadump.show_warnings = false; + metadump.obfuscate = true; + metadump.zero_stale_data = true; + metadump.dirty_log = false; if (mp->m_sb.sb_magicnum != XFS_SB_MAGIC) { print_warning("bad superblock magic number %x, giving up", @@ -3002,27 +3027,29 @@ metadump_f( while ((c = getopt(argc, argv, "aegm:ow")) != EOF) { switch (c) { case 'a': - zero_stale_data = false; + metadump.zero_stale_data = false; break; case 'e': - stop_on_read_error = true; + metadump.stop_on_read_error = true; break; case 'g': - show_progress = true; + metadump.show_progress = true; break; case 'm': - max_extent_size = (int)strtol(optarg, &p, 0); - if (*p != '\0' || max_extent_size <= 0) { + metadump.max_extent_size = + (int)strtol(optarg, &p, 0); + if (*p != '\0' || + metadump.max_extent_size <= 0) { print_warning("bad max extent size %s", optarg); return 0; } break; case 'o': - obfuscate = false; + metadump.obfuscate = false; break; case 'w': - show_warnings = true; + metadump.show_warnings = true; break; default: print_warning("bad option for metadump command"); @@ -3035,21 +3062,6 @@ metadump_f( return 0; } - metablock = (xfs_metablock_t *)calloc(BBSIZE + 1, BBSIZE); - if (metablock == NULL) { - print_warning("memory allocation failure"); - return 0; - } - metablock->mb_blocklog = BBSHIFT; - metablock->mb_magic = cpu_to_be32(XFS_MD_MAGIC); - - /* Set flags about state of metadump */ - metablock->mb_info = XFS_METADUMP_INFO_FLAGS; - if (obfuscate) - metablock->mb_info |= XFS_METADUMP_OBFUSCATED; - if (!zero_stale_data) - metablock->mb_info |= XFS_METADUMP_FULLBLOCKS; - /* If we'll copy the log, see if the log is dirty */ if (mp->m_sb.sb_logstart) { push_cur(); @@ -3060,34 +3072,52 @@ metadump_f( struct xlog log; if (xlog_is_dirty(mp, &log, &x, 0)) - metablock->mb_info |= XFS_METADUMP_DIRTYLOG; + metadump.dirty_log = true; } pop_cur(); } - block_index = (__be64 *)((char *)metablock + sizeof(xfs_metablock_t)); - block_buffer = (char *)metablock + BBSIZE; - num_indices = (BBSIZE - sizeof(xfs_metablock_t)) / sizeof(__be64); + metadump.metablock = (xfs_metablock_t *)calloc(BBSIZE + 1, BBSIZE); + if (metadump.metablock == NULL) { + print_warning("memory allocation failure"); + return -1; + } + metadump.metablock->mb_blocklog = BBSHIFT; + metadump.metablock->mb_magic = cpu_to_be32(XFS_MD_MAGIC); + + /* Set flags about state of metadump */ + metadump.metablock->mb_info = XFS_METADUMP_INFO_FLAGS; + if (metadump.obfuscate) + metadump.metablock->mb_info |= XFS_METADUMP_OBFUSCATED; + if (!metadump.zero_stale_data) + metadump.metablock->mb_info |= XFS_METADUMP_FULLBLOCKS; + if (metadump.dirty_log) + metadump.metablock->mb_info |= XFS_METADUMP_DIRTYLOG; + + metadump.block_index = (__be64 *)((char *)metadump.metablock + + sizeof(xfs_metablock_t)); + metadump.block_buffer = (char *)metadump.metablock + BBSIZE; + metadump.num_indices = (BBSIZE - sizeof(xfs_metablock_t)) / + sizeof(__be64); /* * A metadump block can hold at most num_indices of BBSIZE sectors; * do not try to dump a filesystem with a sector size which does not * fit within num_indices (i.e. within a single metablock). */ - if (mp->m_sb.sb_sectsize > num_indices * BBSIZE) { + if (mp->m_sb.sb_sectsize > metadump.num_indices * BBSIZE) { print_warning("Cannot dump filesystem with sector size %u", mp->m_sb.sb_sectsize); - free(metablock); + free(metadump.metablock); return 0; } - cur_index = 0; start_iocur_sp = iocur_sp; if (strcmp(argv[optind], "-") == 0) { if (isatty(fileno(stdout))) { print_warning("cannot write to a terminal"); - free(metablock); + free(metadump.metablock); return 0; } /* @@ -3111,17 +3141,17 @@ metadump_f( close(outfd); goto out; } - outf = fdopen(outfd, "a"); - if (outf == NULL) { + metadump.outf = fdopen(outfd, "a"); + if (metadump.outf == NULL) { fprintf(stderr, "cannot create dump stream\n"); dup2(outfd, STDOUT_FILENO); close(outfd); goto out; } - stdout_metadump = true; + metadump.stdout_metadump = true; } else { - outf = fopen(argv[optind], "wb"); - if (outf == NULL) { + metadump.outf = fopen(argv[optind], "wb"); + if (metadump.outf == NULL) { print_warning("cannot create dump file"); goto out; } @@ -3148,24 +3178,24 @@ metadump_f( if (!exitcode) exitcode = write_index() < 0; - if (progress_since_warning) - fputc('\n', stdout_metadump ? stderr : stdout); + if (metadump.progress_since_warning) + fputc('\n', metadump.stdout_metadump ? stderr : stdout); - if (stdout_metadump) { - fflush(outf); + if (metadump.stdout_metadump) { + fflush(metadump.outf); fflush(stdout); ret = dup2(outfd, STDOUT_FILENO); if (ret < 0) perror("un-redirecting stdout"); - stdout_metadump = false; + metadump.stdout_metadump = false; } - fclose(outf); + fclose(metadump.outf); /* cleanup iocur stack */ while (iocur_sp > start_iocur_sp) pop_cur(); out: - free(metablock); + free(metadump.metablock); return 0; } From patchwork Fri Jul 21 09:45:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321725 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 2310BEB64DC for ; Fri, 21 Jul 2023 09:46:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbjGUJqc (ORCPT ); Fri, 21 Jul 2023 05:46:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjGUJq3 (ORCPT ); Fri, 21 Jul 2023 05:46:29 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D774F0 for ; Fri, 21 Jul 2023 02:46:25 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36KLMeKY012879; Fri, 21 Jul 2023 09:46:23 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=AOrjB1JhGn+GoPVPYI/JEwYnShJMyRp6zWRqRfOxdzE=; b=LWWlmgsXei9iEXolrWBH9haYg6eQ/zD3N3ka0NKsg8XegcwnUqzEr+DsngETHQsFn2d6 cv6J3BZy3OxBAYY0x+dq6HAKe6UfponPyibAPZRVMMeMkBtndmr6ycKzMKQChT0w9eGH jM664Oucp1oZJ2xm6HPUczuiBowynVz5C7fsnZIdGIDAFijwd7BVi8hce+ixCkWDum3L 42v29LyHI6de3J+ip2H2oJv6i/3oQ9VR4U/qU2aaJzafW/U/9A1JCt73SeKh7Fa/xZXh mVt+0vTv4EsYE5ksvdTmksWC90NVZD7WdD3g9rWJH5F/w4u5xJ4t5time7a2+ccuEXp+ TQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run8a3ne0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:22 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36L85bDh007817; Fri, 21 Jul 2023 09:46:21 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhw9jw7v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jVrZxlj+518gGZ9zctron/ODh25pdmOL/SBxH++zIMxHYuOJ10CiWL+jUyMlYXUMHF7Ntu9dMx7skawcICC1LZ2cfC477z9YhlbRAiNPpFxHmiy+OwGuhgE0MwG5dov1+wtfdemP5IvRYqf477bH19WI4dZUvPuxNU2sVAgUMshejb7OJdbkoA6CnPdoCogmsmmQGizo76tYe/RNdAfzJ5XrKxtRAZsXIDWiTCEyZrD+TfKI/vsWBqIiFVFaaMhlFvj2kpxhs82IGD2+CkYGU4Ti+A3i/u1J746bakmbiTdRBv/obDXyi0TkwKe1qzzCW2T5ek0RGzgkUcd9PPvHfw== 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=AOrjB1JhGn+GoPVPYI/JEwYnShJMyRp6zWRqRfOxdzE=; b=aJmyG1FS1Nob/zqKfMJ4kawsU60vkU4K9ySGciUeR2aRSLU8TC64IuHRvFCbaF0SpAK3bMfK0JLxJBw3Qb29GDloUiqoj4QIBzQf4DmW8o8nN+YXWy19tvsF8mumEwAF9b1wAPPJ2pAb6FClOU1epFTd3BaLHtN2D8XbWAVXSRg9J+gY2DS4GK5FGjz+2rr/cYmlAGT6jFsyPhSaS+gAPHjK2ySYTC+441gA2r0uNqxC0b5JM3+IcWivtD8uP7TtkbtEK4TQ+Z6eF8P6d5mfV65MKiQt8uqLgsWgEIq+7UniNmhCaFzUWzRkVAN21xYaW3FrYQ59f9na+KLSQU1k7g== 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=AOrjB1JhGn+GoPVPYI/JEwYnShJMyRp6zWRqRfOxdzE=; b=z/JPH5U6uawHO9Ewcoc+15e7k9i0M4LkX/lzhvDxxu7DKqIOR9/YYFITaT1Z17J6Bi0RcA6YpcICTdXECmBJMWDUDJkcVWm64n8ROI3VniT685y33WoCm6uAD/hJ11bM7RZsvynkz5KQnIhzvk06VTn0dkKwQykLEbHQGWjf59I= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by SA2PR10MB4412.namprd10.prod.outlook.com (2603:10b6:806:117::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:46:16 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:46:16 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 05/23] metadump: Add initialization and release functions Date: Fri, 21 Jul 2023 15:15:15 +0530 Message-Id: <20230721094533.1351868-6-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: TYAPR01CA0159.jpnprd01.prod.outlook.com (2603:1096:404:7e::27) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|SA2PR10MB4412:EE_ X-MS-Office365-Filtering-Correlation-Id: cd13720d-409c-431b-c081-08db89cf542a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s4bk2tO1TQZsuPL1eatgVLTennEhxGOE6HLTotAeNUosACJ70wi5R9EsAL4Xl8TG58DdPrcZB0Z8kZtBQnksAsfZZfAT2MlJHpC0++pwtAeleuZsg7EnbOCj/EXcuEHMVRYjFWfD9jmNJfcCOI4mNw0LfQM7fggZXgQHk/3zZMKFC+a7anH3kIIh8OiRbekGa6Meul6RJmouDON6o2dcLHq9sa8Utrq24ND5YYxeB/UAoxUa7bdc0NCjJKdtHnUD8xBNU9uB2GzmOvrsxFcMNC5AlyWfzAmVqUKH3+QYwLUcItd75ioGo8p7Y/WxPLwJAsR6doMWJYW3No6upU4UPK5Q2nmRPQJOON4MJPmBY09SGLPGAPquy2A7xFQX4QGxAoSYWuay9SvzVyTkny1LgZYXOvtzgERFJFLq9GUt3RM4vObr73tXZaYTsGk+baiYLs004VvdVC0z1xtBucmzic48gdLnVyv7rTgbwBixmH9UTmMur0MuVAudhjlhOd7L+2Ovv77h66iM9gFP3v7zgWDuAZm8lS69Ulm8xtrUAGXfEU9CpswnQFpoMQESREL+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(39860400002)(346002)(136003)(396003)(366004)(451199021)(6486002)(6512007)(83380400001)(36756003)(2616005)(86362001)(38100700002)(6506007)(186003)(26005)(1076003)(2906002)(8676002)(8936002)(316002)(66946007)(66476007)(66556008)(4326008)(6916009)(478600001)(5660300002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MdSVML6awR5D67uUttVSttUFItf3hDRD+VMfwHpDRduXmOcg6cIAGcmuhg7jmWUjoFi/hKlZdMUEyMXZgj5qnIVESI92BwoGalwc3FDDCtJo78wlyi91+SNlT9GhpAaNEaWhvV1k77WK8g7a8YDZvtKXv1Gk9tLSCDCt5f/UB4hEMSA1wU18E/bkcGKDJ/wm5Hztd2jviLk5VehUsRYPD6USDxfp5JFyG2b/xFqC2h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QHmBcK/75WcoNYIcVg/SKnZxxuYCbjRA+EkSQfULOLbaJ5eA1CyE9Q1DUYnKKg8z/Pf0Q= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd13720d-409c-431b-c081-08db89cf542a X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:46:16.8234 (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: jPUEXp/Hp6lLSnbhKpF40aRSBIC34e6P6OkW9fZST2QtfapoyAOWAJa+M+ZaDVDV2bSW37qwDQdoph8gG3HbKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4412 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 suspectscore=0 mlxscore=0 mlxlogscore=852 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307210087 X-Proofpoint-ORIG-GUID: CWA_DdBrYV-8fcVWaiXmtpWlIPUQLOYJ X-Proofpoint-GUID: CWA_DdBrYV-8fcVWaiXmtpWlIPUQLOYJ Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Move metadump initialization and release functionality into corresponding functions. There are no functional changes made in this commit. Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R --- db/metadump.c | 88 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/db/metadump.c b/db/metadump.c index c24947ec..8bc97a6c 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -2985,6 +2985,54 @@ done: return !write_buf(iocur_top); } +static int +init_metadump(void) +{ + metadump.metablock = (xfs_metablock_t *)calloc(BBSIZE + 1, BBSIZE); + if (metadump.metablock == NULL) { + print_warning("memory allocation failure"); + return -1; + } + metadump.metablock->mb_blocklog = BBSHIFT; + metadump.metablock->mb_magic = cpu_to_be32(XFS_MD_MAGIC); + + /* Set flags about state of metadump */ + metadump.metablock->mb_info = XFS_METADUMP_INFO_FLAGS; + if (metadump.obfuscate) + metadump.metablock->mb_info |= XFS_METADUMP_OBFUSCATED; + if (!metadump.zero_stale_data) + metadump.metablock->mb_info |= XFS_METADUMP_FULLBLOCKS; + if (metadump.dirty_log) + metadump.metablock->mb_info |= XFS_METADUMP_DIRTYLOG; + + metadump.block_index = (__be64 *)((char *)metadump.metablock + + sizeof(xfs_metablock_t)); + metadump.block_buffer = (char *)(metadump.metablock) + BBSIZE; + metadump.num_indices = (BBSIZE - sizeof(xfs_metablock_t)) / sizeof(__be64); + + /* + * A metadump block can hold at most num_indices of BBSIZE sectors; + * do not try to dump a filesystem with a sector size which does not + * fit within num_indices (i.e. within a single metablock). + */ + if (mp->m_sb.sb_sectsize > metadump.num_indices * BBSIZE) { + print_warning("Cannot dump filesystem with sector size %u", + mp->m_sb.sb_sectsize); + free(metadump.metablock); + return -1; + } + + metadump.cur_index = 0; + + return 0; +} + +static void +release_metadump(void) +{ + free(metadump.metablock); +} + static int metadump_f( int argc, @@ -3077,48 +3125,16 @@ metadump_f( pop_cur(); } - metadump.metablock = (xfs_metablock_t *)calloc(BBSIZE + 1, BBSIZE); - if (metadump.metablock == NULL) { - print_warning("memory allocation failure"); - return -1; - } - metadump.metablock->mb_blocklog = BBSHIFT; - metadump.metablock->mb_magic = cpu_to_be32(XFS_MD_MAGIC); - - /* Set flags about state of metadump */ - metadump.metablock->mb_info = XFS_METADUMP_INFO_FLAGS; - if (metadump.obfuscate) - metadump.metablock->mb_info |= XFS_METADUMP_OBFUSCATED; - if (!metadump.zero_stale_data) - metadump.metablock->mb_info |= XFS_METADUMP_FULLBLOCKS; - if (metadump.dirty_log) - metadump.metablock->mb_info |= XFS_METADUMP_DIRTYLOG; - - metadump.block_index = (__be64 *)((char *)metadump.metablock + - sizeof(xfs_metablock_t)); - metadump.block_buffer = (char *)metadump.metablock + BBSIZE; - metadump.num_indices = (BBSIZE - sizeof(xfs_metablock_t)) / - sizeof(__be64); - - /* - * A metadump block can hold at most num_indices of BBSIZE sectors; - * do not try to dump a filesystem with a sector size which does not - * fit within num_indices (i.e. within a single metablock). - */ - if (mp->m_sb.sb_sectsize > metadump.num_indices * BBSIZE) { - print_warning("Cannot dump filesystem with sector size %u", - mp->m_sb.sb_sectsize); - free(metadump.metablock); + ret = init_metadump(); + if (ret) return 0; - } start_iocur_sp = iocur_sp; if (strcmp(argv[optind], "-") == 0) { if (isatty(fileno(stdout))) { print_warning("cannot write to a terminal"); - free(metadump.metablock); - return 0; + goto out; } /* * Redirect stdout to stderr for the duration of the @@ -3195,7 +3211,7 @@ metadump_f( while (iocur_sp > start_iocur_sp) pop_cur(); out: - free(metadump.metablock); + release_metadump(); return 0; } From patchwork Fri Jul 21 09:45:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321726 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 6077BEB64DD for ; Fri, 21 Jul 2023 09:46:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229503AbjGUJqd (ORCPT ); Fri, 21 Jul 2023 05:46:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230237AbjGUJqb (ORCPT ); Fri, 21 Jul 2023 05:46:31 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BFAE2D46 for ; Fri, 21 Jul 2023 02:46:30 -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 36KLMeUX025821; Fri, 21 Jul 2023 09:46:28 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=M1Fykt9drEa1+zTcVi1eSPiP+NLoBkqrG8TxDFiEwz4=; b=ryXo89wfp07I/qBPec/5Rl+vZVPoBxas14LU8Jjcm52tZseSbpURt7/XhUHqwoGUnrcf tA15GNek2gHSv0MUDOGT900/QssoeY+BdqOmJn7LwtupkSvEEF+1RfhJ2cSTJLQxEGYB p/3UwwuEfz7Gn+OFfwYyRVMnYvkX9UgGf7oZFtpp9+rIFXu0VchUxAVtmsdrD561AJhq rVYMS06/cnV35F9EyzjKY5LlXKt1IwkCyP8embgX9D1v5CxqEy+N834q7Jb7AagarWd5 Eckpu5z1wWDp18gLap0DaEzbKrP+cUPxaUqOMin8unXzb9+ik1viOhQA8/zkDhWwIkDl HQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run88upbv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:27 +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 36L8PwtR019176; Fri, 21 Jul 2023 09:46:27 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhwa91gb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BvgNnH78EvwbUqnuUaP7Kk3SyJo3x/1nJw88ArF3uCG9ufQgDJBG/2Wmel0jX9X22XvUuGoWpe+QuXTpNcE6bAZ10q11OiXp6rUUpvl3ys65ZsqLjndSgU3gM0IcnB6ZJAz2a/tQvqRd0V/sIt96ES9Tg4FXX/BOC+J0PjCABjiFf8r4CIX2ahjRL5tZD0QTtOqVan6p/2+AFFtQ7NG/ZUfuLRIdVXpbSulRNEqJsJfdht0QkXNTg19EXV4wSLJRE54Hk6nZnNOdfunJhA4M93ueFIfZEHCEBbekydY6QcTUF9pmsQDOTye2yvqWO4zJ7TbzFBnb3HA4FJGzs2olDg== 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=M1Fykt9drEa1+zTcVi1eSPiP+NLoBkqrG8TxDFiEwz4=; b=dBLAywu3KxQDWpG/G1rvfafkLk0FSr1qccp1jTYxmvdSvXgYaOrLpx6Pmhxvrsm1RuT4pCew3Y7fTUushkWh2O1T2Zyg3GyOvWMHRdD9VMR/y8sU0luc3ecI0frLZGrVec3sNtA0H7zwJMarBCbUszFX8QwBcdNGDuet7k+VIYLAw6je5UHJZIUZ2foiiUr1vt4c1JVP1oVk75oeJY6ckrmxsCT3L/yTl+8kpYjJfZ1QbzofWAshlMS7X4Nq7YG2FiPpZwhNLBnMRzxEtDD8FlMUTnj8IhCL8UAycWvCLbflHcoGQqhZgpRkQHn6KVyUlp1EX1Fl1ezSfW17rmAqwA== 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=M1Fykt9drEa1+zTcVi1eSPiP+NLoBkqrG8TxDFiEwz4=; b=UjJOfOyUUZIo5bGbU3h9LXSLEFTwFQlZkN7t0j+CsXebos9dioeL3eUcJqXrG/U4YuQGEi9AbY+FyylRI926JrYWFHOiLWQqhlnStYquPAr/v4DxXIgTsSv74m0EbdCIFVGxtfrv0V+dLeVZw0Ur/apFfBLxMVFSvgzP9S12/JI= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by SA2PR10MB4412.namprd10.prod.outlook.com (2603:10b6:806:117::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:46:25 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:46:25 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 06/23] metadump: Postpone invocation of init_metadump() Date: Fri, 21 Jul 2023 15:15:16 +0530 Message-Id: <20230721094533.1351868-7-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: SG2PR06CA0239.apcprd06.prod.outlook.com (2603:1096:4:ac::23) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|SA2PR10MB4412:EE_ X-MS-Office365-Filtering-Correlation-Id: 847d5cae-ea3b-4792-3210-08db89cf592d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1TyFCoef91Fu2klcSUThFVsdWtbRG4ylG+aRjMJul1vlzi2vCuOc1wR6OY4s1WQKjh8ZS1yPh0ex4mpb+kzwaISVqIF1b9YzcIdleISNNQqDR4ogt3vGIH0fkjHcO1DGQXMEgaCAt7YCDI0AYftiYrXrjgI1oVUKyT9OM8JJ6ac5ij01vP2Lk+4w2wwSUgn/SX/rTRznxydTuDLJ8V+a+BwYs7m6Vg+eP4pkudkX365B1jWLCwTYVIZqoeaoebWqrs7cGkfz9o2LZF15ONPivB1cFs+SGiYnJOJNm/MvqPzi8M6Q8IYcKTr4ofRYIwUSJvbv8La66gz2NhnGo9rCT+ypFoSYliQ9O/6nwVYv0NsYBpHS9vCvCK4w4QMcV8IBFHsi+QP8TcYDDfxzf/YizjojmmbusRXK5fxmL24D5YobUXeVHUL+epCFSXPPA+cb85rj0hRoUG+tQ9h35nDmwZ6dYZUG+U8PmxriPtq1tW1uuXyjJ3WqIaeyWiI0NACFs8AE7faGHiXfnVkW5GY74t7Whd0O0SiPVILpgMLCeiZw9Sfk5O/3IDEXK/cWMtro X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(39860400002)(346002)(136003)(396003)(366004)(451199021)(6486002)(6666004)(6512007)(83380400001)(36756003)(2616005)(86362001)(38100700002)(6506007)(186003)(26005)(1076003)(2906002)(8676002)(8936002)(316002)(66946007)(66476007)(66556008)(4326008)(6916009)(478600001)(5660300002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yLJ6mZxqvO55aaewKIrJ0vonDQa5gLpNzH6zH+ARuySHyVV1BumqgAm5C2afiPb6KBIkye0exXwvk80qxJLKrRLfqUOZLMcPEc3OUguF56GiD1L7DafcRcuOl7tY7mE28WQdRMmOCc4/B75TvMi1wSH8cu/pV1RC3OYPPI+JXWrFFuUqLD7obZLUpqwqW123Q5AO8bropJLToRAaHimzjlv+VGmf8k+0Po9xOljEoMZTYamOSrrRcLYTNvRJPXSq/QKqe0ktRB+XlBQPTOz/NQuGj+eDi+Wp085esdWNjlZM1zT39ounykZzFIMJIghl0Rcm1gP+Cpd2uxieNx3LVzpN5wfWGz7WfkPbYItJPI8TKMiY0QeZYCveHeckyFYkuDPaR1aqCTLKYrmjVrw0jFmAZNsXBuzAiuOw8fYz52yixgc1k++jqfanNcIPIoUohDQk+M0CqvqbxdgqZQX2WezI5BeHxuAMRwI4OG1cgaKZoCa/zfl2hs6U/7XxGbZyZTmTEn4rzwagjOiP+XqDXQHxhMW/lSUujDPTjU9xyKrvZQIiU0/h7DszVfp5tI77kFU2ngXlJmPOjVaSrMdTYVnntE/sSZWCZsf0e88OaFRdtDA0nvEUuRTy4ujJE9SEhcXpM8FoHfgBoRIFxA4t86uPLdKMAdClFVC7JNFtVNUipTl4wI1KLBHI8xTWYpgE8TBJ92Xgh9vhEzDLcrhuz+dES0aWlZVcMxRKyDFep6JKsclT5BeZQWmRfjH4s1cc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xuQQth/HPU6rxX7AWoNgaDpjTGZGVs0qJSqiVzHQKsaUhMb9QEOhDd23goX6B0fiRrgHW3JVY8u0SINCZqBAf/CrSzST6ewdJq8RlBMlzXkqIPouLBBLsWxKL35V5MNR/5xXyUvJrLBhnaO3+LtFQjqhNapRUQ5SxB84cYu4E/1mXh9CpPey2e34TIbvrZz+F8S/onfun4qRR+rto8V2tdm4kLZg4XEsMzXQi4RJdm8eck8YfpArhZuR0Vm9SPISjlzKB2nrMQesQB35kCFY53Fq9gBoTN6IgCjU315PWpue74DXM2ETUk8kOqyxYFlcMdd6E28WkndY+ph7jytlMPoD6F12adyCEsm3EpuWeWgetBDwEzATIZfhC3aOMk+lMxhWBxn5PYZq6at+9naxaICDRUKnyThfzTOZ8y4fdQbp9RST+WwADbjPlJUYdqLuCLrfiHMPj0Wt6lrSREOOz5JqX0AaVIx4gbkJwlRvQyRLPDRvF6NGTOpygLHnZyoi0oSL2VkpugTizRZ9WzT3PPZ+e4JC2ugIW6t3Tx/v4JKlIg3XFijXQ8Xf0LlYpqdYXz4N3CbatyVp5VLM35UmQri8+uvREiCtZffZmHzRtmCXHLKejvkmFiRE82bbLi7g3dJYa8A27nqNX6Fgy8W9A= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 847d5cae-ea3b-4792-3210-08db89cf592d X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:46:25.3127 (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: lU0UzqWFjdYitanR7adztVlb6q65qbAiwhLuKRRUj76OW1ZbxmWGNkS0WCuKHzpONyFKZIsPPKKBz1Ik8NwOWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4412 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=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-2306200000 definitions=main-2307210087 X-Proofpoint-GUID: 0JQcrXQ1nuspuJZesWndr4mJ7LByFdlS X-Proofpoint-ORIG-GUID: 0JQcrXQ1nuspuJZesWndr4mJ7LByFdlS Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org The metadump v2 initialization function (introduced in a later commit) writes the header structure into the metadump file. This will require the program to open the metadump file before the initialization function has been invoked. Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R --- db/metadump.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/db/metadump.c b/db/metadump.c index 8bc97a6c..aa30483b 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -3125,10 +3125,6 @@ metadump_f( pop_cur(); } - ret = init_metadump(); - if (ret) - return 0; - start_iocur_sp = iocur_sp; if (strcmp(argv[optind], "-") == 0) { @@ -3173,6 +3169,10 @@ metadump_f( } } + ret = init_metadump(); + if (ret) + goto out; + exitcode = 0; for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) { @@ -3210,8 +3210,9 @@ metadump_f( /* cleanup iocur stack */ while (iocur_sp > start_iocur_sp) pop_cur(); -out: + release_metadump(); +out: return 0; } From patchwork Fri Jul 21 09:45:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321728 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 EACF0EB64DC for ; Fri, 21 Jul 2023 09:46:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230287AbjGUJqk (ORCPT ); Fri, 21 Jul 2023 05:46:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230237AbjGUJqj (ORCPT ); Fri, 21 Jul 2023 05:46:39 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3264F0 for ; Fri, 21 Jul 2023 02:46:38 -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 36KLMVhh002002; Fri, 21 Jul 2023 09:46:36 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=gPFiyvYDKJuasOfkr+VvVb83W7GBnnHtVP9oyYOqt60=; b=vQoB5r+T5EzRJKV//BjxVsXy5eGuSkzrVPuMXacCYqHQv25dKSSoveZ5B1z7tz0Cux9t xZkT0C1WgP5z1lIIBaUvcPNXpzYPDrlj16iEdBeBE85ULCyOp3AC97r5jiLWtnYQTJxY F/4XFkA4jd9nuasUmlB3zObVMcwmVJFZo0GlRmOxg0qn0IassWgBdHjMa8PWW2AttSer jY+vALH5ejAICgFs8TrbbWxeKm4Quyf9nn1yk58bS7NLE7KLuLM2o5Rz5o3lU0VivOfn VZktAfPMT5WpoWUmtYWwy4U8iytm6jAYVnsJxFYJMIJoZGBnskxYlLbJKHbiIc78VxZq wg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run773km3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:36 +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 36L8ZK1S023806; Fri, 21 Jul 2023 09:46:35 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2102.outbound.protection.outlook.com [104.47.55.102]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhwa27t5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PF8pCNoihvMBkQQPIts6R2Xi8eSGbeFZLYcvVDFU2jhnGWLsozVdFhbTG1CDJwp4th/usHvQdDmlXrf7QAVse+Zsz+Em2woTzXit7HHQmWBmz02r7XFQYP+qHxMk4FgaLCYfCdE0gDYonrdNZoH2M3V7rO4ci0b6o2yIZanWSS0ctN+caglV/sK0KaWN/LKSxWOPosA0U3cac4lL0E04N52O2g88oQCPu7tlD/I7/tmIjB31Ji2JtAqq44Wqko0EvMHBbPtdroNbQVmjoLAitvOA3UUQy9HPr7szylHZCl2HOyq/2ME9REdixP2X5jpZf92+TYpOzswBM0NiYgLNiw== 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=gPFiyvYDKJuasOfkr+VvVb83W7GBnnHtVP9oyYOqt60=; b=Vdu70mb7rXQEWzWTDNnXyqYxwAZs0jl03E9L2+KSAkWkZ24W1gQTjqWW32Xm4ndNKMEcY+LGJ02LNLCdTjxdL30L1PDijBkqLagLMMOOmbvNK8w+TSYhGbgSOiNyHFPzIFJ/DEioeYA3n/vhC5uKS6KZpbxpfwhFKEsEkIBnjuPltgzYaYcrWYuHF1Cl5O0yLI/WiW8rTIagu5IKabSghZpqln+WaeekUCbDI1vA337ZtMzEs+1E1EPy89YrGx9YaXVqGcrgnIUPCHk6Ez6LCtU1Obwzt8uAEyc9gCkMxgJQxXLvVIPxI8EEn2zTw9c+n9dgHeUXhPOmwnuVzVHgLw== 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=gPFiyvYDKJuasOfkr+VvVb83W7GBnnHtVP9oyYOqt60=; b=cWrrOTOy4sAKVsmH73qHCt8Mh/wzI1+eYW/JLN2domXKKMOVQvZ09I/KZH22ofs5tTtrQ/7V1bgUoxHwZnXMBOPnoZsfKFR8oLVLyBeBDJM5zvBO5/BswsjpIjESjmJKkWHHzAPZwiP9AxVWnVjvzXdOasHRxUpJtFxu6kQ+X+4= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by SA2PR10MB4412.namprd10.prod.outlook.com (2603:10b6:806:117::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:46:32 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:46:32 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 07/23] metadump: Introduce struct metadump_ops Date: Fri, 21 Jul 2023 15:15:17 +0530 Message-Id: <20230721094533.1351868-8-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: SG2PR04CA0193.apcprd04.prod.outlook.com (2603:1096:4:14::31) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|SA2PR10MB4412:EE_ X-MS-Office365-Filtering-Correlation-Id: 40987638-0e5b-4f30-eb07-08db89cf5dae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OjeNpBvVXW8T6dvv9ZnXdIAVarU5/jmOC1oQXGkz5kSMQYuuf8dY8r+FWyG9BuAl6GpKq621h6/F0meafpaP8sk444RaY1lZttgBARB8GW+td1tShBfSH+vn266U4ySDDa8Xn9dlYFRELz9cgmE/E/o097l4DfowvMOkFKdX/pLApVL6DXSrY8RgKUyRwDF43dVQ1xe201aBs0so+QTtIYEfko4F6r2AkrtFIQIyH30d02YcPn9/3hdNjf5jvyhSoFSmRfcf7iG8ZWW3JaXsruCRPMK6bGxfMhylI7pABq7aCGE0gMs9rwWipoYfXEw7+GvwFkEQCvbSXoccfa1oP7LT8RoU1HqiesnZ+4ZKEGHCb0nCxEtxMyOmQwJuZt8HdOafqD3x0vEVgP+9vN//cCKv8+OTHV0q2KbLyfO/0mUu+wiWWFaw6XPlVNKaltT3BON3Lk957iRzKXWWRPO6LuCZDnzAQ2GzrLOGmjvodcc2KAiUdGubXd1by53YZBJ7QdWs8ro0hiC8hDMtF7I+fzCZqioIKjbkGnZZYG0YP8gJUxbNyo5cQfP18wmcoQ+a X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(39860400002)(346002)(136003)(396003)(366004)(451199021)(6486002)(6666004)(6512007)(83380400001)(36756003)(2616005)(86362001)(38100700002)(6506007)(186003)(26005)(1076003)(2906002)(8676002)(8936002)(316002)(66946007)(66476007)(66556008)(4326008)(6916009)(478600001)(5660300002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sSlDaSKGX5FgphM6v3irKc7YcL8C+B+wfCRdPOMaR+0urCk/POovcmsJYZNHjRxJ6dQqmUfuSMX90gIahSJ3L6e4RjIuktZ3sSw0BBoHaxZHxY2XzoJqKidA+KsM3wwkeLPREGyEWUhIVJbYWSX6zRQ2+rzW93ync9t/0rAn9emKiA7E4YgUqRZyzlu7DXJTnehgyCxRk2ybMaBIjLGITOrARYY3VtxtK26Nl3wnk/Pmm7UH3XGvy1N64Gw75EGvO7GGFfxgMERe0e/paq+GCwGxoTtE743Y+FoJRr3gkPwpM3rgrtrGtnds1T0DmyIqIBcFV6Bq4HuRqBaBC0JOqP0LXpmcLTTXK88bCTIY834w73oV1a9akXXm2GjDeqA3Iq2M0nP65akiPkZfRPwDjnwHw5YZyu1HA7tzoBNpxthJco5SW/Ku1mJvkD/ErFod+a37ePN8a/nKKj7iyqILwa6ZkwA17tjhkgokj6U7lLi/AaD92xiUbPYXex2XcerM0yG44+CdDyEmcui2OVSkk8hKk+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Mh8f4Qeg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 5uDq1Wthr3LGfLlJ6/lLDjX1WGxovU1v6LZbcwOGXtRBBFgiJ56Wn5KcBNypuX/wZ8CcGL0hTdR7KjsF4EAbTIXQ/ICuwCtfThe9IqVnJ6yjt754Dz/gEJnxNnnPB2IZAexrUQBqVvQDxIKhx1O5JMHQM4dhpKMzE48NGMCX6q5Bkt8nSmczPxhwvZAY5X3NgpzvuVWxQUOO/kU1V711Kzyo3TDoeSa0yXxgN6DMpPr9jD24cZTzT1bPS7MoyBxmYcfShfZcexKAdNZqbgClEp6tdcuuMvbNtK5avSsJQ5rP6AVMrFQTZ7pQNcjUU+QUCz2+kMi8jjj72x+etEEE8F1Kohdb0p68ry4SVNvAES05jS7HQz7hUeZBO9v5yX2dqz0uSJeiEdGvUxell3gsimhqkSmSMAe8p4utqFo4m5bltx7w8GLCATNMoT9UOMpc2aXh30EA07V7T4wBkN492NT8v4s0LXdB1CpxP+MhugW7wtb97a1KdOeFgPRtCUomZwl0/LZUd0I3akdRp9oJQcuIEf55eDh0sTi0xlK7KNZm3qDYvDWeazPPUdv4RVw4jj54wQ7g9cwAbZLhZaCwS3umpUIrGsbhfSJ7V8zqTtaID2MqZzau/qCB3kkIZquUmVLzf46aykVMzp97REKcPRc5x30ZoJy0hhvK5L7zU+cB+Yx8wYHrE4gOg0F45NmEtoUmLZTV//z5ft02O0LhT81rVz+nYz3gxZkEqHzA2m42o+edaGBwWdxIQ2d1as5gIqlbqBnkq6LgatcrXVAqdPX20yvBMVaCSSsZUSLo+oU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40987638-0e5b-4f30-eb07-08db89cf5dae X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:46:32.8695 (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: iaqzlmZ2SXVRwVg5zyQHWLAmsxVRQNr9WrbDl9GrwpRnds5BTLkMsECxXg8T1xf5sfKdFUygnM5w+s0PmsNxzQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4412 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 adultscore=0 mlxscore=0 bulkscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307210087 X-Proofpoint-GUID: 6wyYr1LqP35YiLgMnMEsG9quG6EzBZuV X-Proofpoint-ORIG-GUID: 6wyYr1LqP35YiLgMnMEsG9quG6EzBZuV Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org We will need two sets of functions to implement two versions of metadump. This commit adds the definition for 'struct metadump_ops' to hold pointers to version specific metadump functions. Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R --- db/metadump.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/db/metadump.c b/db/metadump.c index aa30483b..a138453f 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -40,6 +40,30 @@ static const cmdinfo_t metadump_cmd = N_("[-a] [-e] [-g] [-m max_extent] [-w] [-o] filename"), N_("dump metadata to a file"), metadump_help }; +struct metadump_ops { + /* + * Initialize Metadump. This may perform actions such as + * 1. Allocating memory for structures required for dumping the + * metadata. + * 2. Writing a header to the beginning of the metadump file. + */ + int (*init)(void); + /* + * Write metadata to the metadump file along with the required ancillary + * data. @off and @len are in units of 512 byte blocks. + */ + int (*write)(enum typnm type, const char *data, xfs_daddr_t off, + int len); + /* + * Flush any in-memory remanents of metadata to the metadump file. + */ + int (*finish_dump)(void); + /* + * Free resources allocated during metadump process. + */ + void (*release)(void); +}; + static struct metadump { int version; bool show_progress; @@ -54,6 +78,7 @@ static struct metadump { xfs_ino_t cur_ino; /* Metadump file */ FILE *outf; + struct metadump_ops *mdops; /* header + index + buffers */ struct xfs_metablock *metablock; __be64 *block_index; From patchwork Fri Jul 21 09:45:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321729 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 596A3EB64DC for ; Fri, 21 Jul 2023 09:46:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230404AbjGUJqu (ORCPT ); Fri, 21 Jul 2023 05:46:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230237AbjGUJqt (ORCPT ); Fri, 21 Jul 2023 05:46:49 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30838F0 for ; Fri, 21 Jul 2023 02:46:48 -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 36KLMXD6006769; Fri, 21 Jul 2023 09:46:45 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=r6e7J2/jI0qDysiNTwNPel04H4atctawZMY6LKbo2BQ=; b=kQHSCU8CdOjGY7LMihGoFs8qGLVgUD+P4mpzKDluHCNVL1Azk+9FIi8xBLSJKVDF0kVo bomX9dnJImRh8y41Slj6DBYQ/u/2Chh2VqVbPS7Kq7YjllJuvPedOh5BdbnlOt5Sc6gg IVCaSfF56AwdY3Ose6OidRmKi/V5DGizd7pB/JffouC1B2iS+PydmY3xGy0/NkrOukG0 3dIkH6fi2NvIFCw7F1INIa5eSkL/ioOopt9Czuwtik2v7R1mAmxbw9iQaeMlWnN0bcQP f8Kbsc7qkpenmoVpAEn5ZHGE9usaOkRa6C7ryOHTPelxO4q8IoSSAoynBVlSEp7Fau5b 0A== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run78bdsg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:44 +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 36L7kuiD038226; Fri, 21 Jul 2023 09:46:43 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhw9sqng-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZigT4AemdKScyL5HcTPZyeoP0mH63H/MIHSq2AmuuJS7eYCliifiBpCfXRjc+mrHqalXLsvw4qpzN2pLITsLEuetA5lgXCQqlN2M1jPE9SlHf6kbtm1/RPWD66cEZfNRZ7wrF4ZCgUkeNNPH/Q8Jhlt50922GxDZu8KARNtPuqPG2mo60Vp3V6pHcnn8gMDP76Tl9A94s7EP1BWLrGF85pRh7LFWBbPtFcOu7h5IouxtnCiRX9ugkhmmEMNTh2XUsuYvGJKb+oaMCkWmxonuOr5VNBdPV+yD0xoWDLv3ws4NzBujuaqHKlMrBcfqBeU0NZJOz9RQ6cEYY6Yl7UJoRw== 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=r6e7J2/jI0qDysiNTwNPel04H4atctawZMY6LKbo2BQ=; b=d1/uUh8bolGoDw9aGb5dRsjGd3kUdXHf0Q3taYeu9HFWzmsH5WONdNembpPyag7xobg5Z9lGatvtH/bLuiDyKLnTy7RL4ezrT4o5aly3eXe9ov9MiYtUy/2HVYEVWo5VJn/06ocjeZ1Z86hBvb2/BC6sLOTjIdvfudam5wyVKFvYnHwZ0LOV7g377+58tnT4Pe/qA0O73rZrnRcGuRMfwJLc94aBzJY3MT1iBt7pNXYuMD/+uQIAnqhgB7iKQeAOI8kGVjNeQXvVj9NvnRmPj27fw0gAlFbWgBTUXoP+GbXIUbxbvMew18mTO0X/UJhs79xqccx8Yi/wfspIempUCw== 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=r6e7J2/jI0qDysiNTwNPel04H4atctawZMY6LKbo2BQ=; b=s6AD6kGWx/zCHunpURGMCwRQB2tomK4mzQs7wVcg+jEAXfwO30l7vjgvemUHUFdnQEPkHFtWQBQ3xXgxHbyHTpo+oUVDVNeDymEKDCwV9h2LwS9OXWh0VqCv3oonVw6dCECWZU/oOH7fmEaLG/s4sJmcu9t/BlSclNmSTuGgR94= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by PH7PR10MB6602.namprd10.prod.outlook.com (2603:10b6:510:206::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Fri, 21 Jul 2023 09:46:41 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:46:41 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 08/23] metadump: Introduce metadump v1 operations Date: Fri, 21 Jul 2023 15:15:18 +0530 Message-Id: <20230721094533.1351868-9-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: SG2PR02CA0123.apcprd02.prod.outlook.com (2603:1096:4:188::22) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|PH7PR10MB6602:EE_ X-MS-Office365-Filtering-Correlation-Id: 72c6eb25-9e51-4448-fa5a-08db89cf62ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yYmAa0tOAqRJAqaBu7FB9BL4z5/7Bncc0j2ZEtkQWRPKJRzzq4bhqWJlnRQwh5/RfnDFnHVMqWlInit3A0yI1bHGKWLLolU6+0vA7MgbUemW+0XO5TJg4PTGbdyisj7smTdBn/dScWTI+2wCi6ZOeVH08v7n3585p8hcU4lwOJi1JCSQ60TlXa7ntUbf8DWA41V2eytVO/sa/BN5HBAeQrBUY4e5ciCVT/MaaJIVKjcila9bxPP/IGDwaLjzeXhoHRwENC1SyCnkzdDrxpUCAcBovc1hx1xMhIWswTA2tRa0DprILiWKD4vRHbWRsmOYPzGL5guwyiGUEtiEfpMlWssJRPX3b19jYJx2TKMV8rM1+v3zK5m+Kr/boiD/cAdqxuB29VFc+3UYXRnLExXNPorfVOS8S/9ROlfkq1g5DV5+aV29BcMif07rTXrqy0eX6eI8rk2xMM5qAQO91dfNwbHAyIR570N52QiqC2Ob/taAmBUq/ZA+k0c4d95UoGWW5EujQ1So9TeTtj3sjlpn2R9vtNOMtEcnaBOKAKFpKXQNR5Y+14cdjFCn61GKGMS0 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(396003)(346002)(366004)(39860400002)(136003)(451199021)(2906002)(83380400001)(2616005)(36756003)(86362001)(38100700002)(1076003)(4326008)(6916009)(316002)(66946007)(66476007)(66556008)(26005)(186003)(41300700001)(6506007)(478600001)(6666004)(6486002)(6512007)(8936002)(8676002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dYN2/LbwzbUy2UrnoOluOHHjcmltc9lzxie4Uq+3P1pN0Asp+mNEn8EO0sgL3onfO0C2zqX9QU8hWybEH4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d5yZ12qzCJY8MtY3pVNb9AzBA8n10DHUv9ZFUANSoUJFCg3JHyZqp0BqGjeLLuh1YAMnLyq64Rl2555gicWTKPLYITtZVPj+zGf3LJGZolIEAmUdzzKMNl6wBr8hXggt9j5lOaJJM6UqfLIkyx6xXygQz+Z+sE0PXYuPNc9VF445kQDVzw2tmoS7V6sk+WZ3cJTJ7wDHny4izQpuvs8/8UnW5VpM65uePxQqMmIr6XwwEcP1znTTUgBEJKRaaWbz/GYuV8RdwBoF0rBQE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72c6eb25-9e51-4448-fa5a-08db89cf62ae X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:46:41.2541 (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: vbrRgAsttQW3GMTIN9Hh2f+HqlRqg+jQUdgLIw19j27XBadWCfdI5PWF+uPafBTqfixhzFGWXcvv89g5gw//GQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6602 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307210087 X-Proofpoint-ORIG-GUID: xWe26J9vMo37UNB_7FgstVgf7AyE0X1q X-Proofpoint-GUID: xWe26J9vMo37UNB_7FgstVgf7AyE0X1q Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This commit moves functionality associated with writing metadump to disk into a new function. It also renames metadump initialization, write and release functions to reflect the fact that they work with v1 metadump files. The metadump initialization, write and release functions are now invoked via metadump_ops->init(), metadump_ops->write() and metadump_ops->release() respectively. Signed-off-by: Chandan Babu R --- db/metadump.c | 124 +++++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/db/metadump.c b/db/metadump.c index a138453f..c26a49ad 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -152,59 +152,6 @@ print_progress(const char *fmt, ...) metadump.progress_since_warning = true; } -/* - * A complete dump file will have a "zero" entry in the last index block, - * even if the dump is exactly aligned, the last index will be full of - * zeros. If the last index entry is non-zero, the dump is incomplete. - * Correspondingly, the last chunk will have a count < num_indices. - * - * Return 0 for success, -1 for failure. - */ - -static int -write_index(void) -{ - struct xfs_metablock *metablock = metadump.metablock; - /* - * write index block and following data blocks (streaming) - */ - metablock->mb_count = cpu_to_be16(metadump.cur_index); - if (fwrite(metablock, (metadump.cur_index + 1) << BBSHIFT, 1, - metadump.outf) != 1) { - print_warning("error writing to target file"); - return -1; - } - - memset(metadump.block_index, 0, metadump.num_indices * sizeof(__be64)); - metadump.cur_index = 0; - return 0; -} - -/* - * Return 0 for success, -errno for failure. - */ -static int -write_buf_segment( - char *data, - int64_t off, - int len) -{ - int i; - int ret; - - for (i = 0; i < len; i++, off++, data += BBSIZE) { - metadump.block_index[metadump.cur_index] = cpu_to_be64(off); - memcpy(&metadump.block_buffer[metadump.cur_index << BBSHIFT], - data, BBSIZE); - if (++metadump.cur_index == metadump.num_indices) { - ret = write_index(); - if (ret) - return -EIO; - } - } - return 0; -} - /* * we want to preserve the state of the metadata in the dump - whether it is * intact or corrupt, so even if the buffer has a verifier attached to it we @@ -241,15 +188,17 @@ write_buf( /* handle discontiguous buffers */ if (!buf->bbmap) { - ret = write_buf_segment(buf->data, buf->bb, buf->blen); + ret = metadump.mdops->write(buf->typ->typnm, buf->data, buf->bb, + buf->blen); if (ret) return ret; } else { int len = 0; for (i = 0; i < buf->bbmap->nmaps; i++) { - ret = write_buf_segment(buf->data + BBTOB(len), - buf->bbmap->b[i].bm_bn, - buf->bbmap->b[i].bm_len); + ret = metadump.mdops->write(buf->typ->typnm, + buf->data + BBTOB(len), + buf->bbmap->b[i].bm_bn, + buf->bbmap->b[i].bm_len); if (ret) return ret; len += buf->bbmap->b[i].bm_len; @@ -3011,7 +2960,7 @@ done: } static int -init_metadump(void) +init_metadump_v1(void) { metadump.metablock = (xfs_metablock_t *)calloc(BBSIZE + 1, BBSIZE); if (metadump.metablock == NULL) { @@ -3052,12 +3001,61 @@ init_metadump(void) return 0; } +static int +finish_dump_metadump_v1(void) +{ + /* + * write index block and following data blocks (streaming) + */ + metadump.metablock->mb_count = cpu_to_be16(metadump.cur_index); + if (fwrite(metadump.metablock, (metadump.cur_index + 1) << BBSHIFT, 1, + metadump.outf) != 1) { + print_warning("error writing to target file"); + return -1; + } + + memset(metadump.block_index, 0, metadump.num_indices * sizeof(__be64)); + metadump.cur_index = 0; + return 0; +} + +static int +write_metadump_v1( + enum typnm type, + const char *data, + xfs_daddr_t off, + int len) +{ + int i; + int ret; + + for (i = 0; i < len; i++, off++, data += BBSIZE) { + metadump.block_index[metadump.cur_index] = cpu_to_be64(off); + memcpy(&metadump.block_buffer[metadump.cur_index << BBSHIFT], + data, BBSIZE); + if (++metadump.cur_index == metadump.num_indices) { + ret = finish_dump_metadump_v1(); + if (ret) + return -EIO; + } + } + + return 0; +} + static void -release_metadump(void) +release_metadump_v1(void) { free(metadump.metablock); } +static struct metadump_ops metadump1_ops = { + .init = init_metadump_v1, + .write = write_metadump_v1, + .finish_dump = finish_dump_metadump_v1, + .release = release_metadump_v1, +}; + static int metadump_f( int argc, @@ -3194,7 +3192,9 @@ metadump_f( } } - ret = init_metadump(); + metadump.mdops = &metadump1_ops; + + ret = metadump.mdops->init(); if (ret) goto out; @@ -3217,7 +3217,7 @@ metadump_f( /* write the remaining index */ if (!exitcode) - exitcode = write_index() < 0; + exitcode = metadump.mdops->finish_dump() < 0; if (metadump.progress_since_warning) fputc('\n', metadump.stdout_metadump ? stderr : stdout); @@ -3236,7 +3236,7 @@ metadump_f( while (iocur_sp > start_iocur_sp) pop_cur(); - release_metadump(); + metadump.mdops->release(); out: return 0; From patchwork Fri Jul 21 09:45:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321730 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 6FF81EB64DD for ; Fri, 21 Jul 2023 09:46:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230441AbjGUJq5 (ORCPT ); Fri, 21 Jul 2023 05:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230237AbjGUJqz (ORCPT ); Fri, 21 Jul 2023 05:46:55 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEECDF0 for ; Fri, 21 Jul 2023 02:46:54 -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 36KLMXZA002054; Fri, 21 Jul 2023 09:46:52 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=WxQ3rU/98LcQN8BGtfGwuT/w/tKOVbV7UOfxEVvh8xs=; b=p1iY4AHEImJLJlhLnEnDtPNuUixY13jh9LzBS+BqoPxPDNOyYaiwZgwWrpASb8G0z7mt 4RqmUIgiFoKGyK0WG34ogOoomyKab0ddboH6KSWT9t1iIg+wgMB3Mr+C7huC3TlPcoB+ l350NFTsqMIbfEqbYZ2ZPLRj9zsj9u686yCY4dSbkbyKILUbv1oOqg2Bxwr4tuk5IKM0 PBXcZw09BfDlXDer1OF55Qdx1MZ39zW7i9W0fNlPtSWVQ4y0jVX7lml59uzPXERGJGBx O1cVM+IY1jMFOV3orvpao1+YUzWkPKgbyKLT1uY9Tg3sG+D7bwtM8+wS8N/eOB0hmKRE HQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run773kmg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:52 +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 36L90J8T019258; Fri, 21 Jul 2023 09:46:51 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2108.outbound.protection.outlook.com [104.47.58.108]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhwa91qs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:46:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZxDBKZYwllejsJrATZmjt4KiPBHpCsCwxbv0JOb4GM9ebzmqSY98r+UwLV2pc3t11NrWXjTGT/zvTAHSaJV20UAce2HAOpXtceZBT07JMfPzgoP9spUrmwEfint6ov+KwmdH2pNksyWWNjZDHDpRmotdbxrjJFaS7UfFMobAz23t9rAMTO6VQ5SR/gwOVASQvxSTlspcqkE3f+o1Ho26iAtDT+5RfFWr2zkUYLpQILsqo6EX8i4bERRKyyeEQmZ7f2JM6giCZ6qK3e99uCcm3W0znJAY4UUC2fL9eChycS2nGodwzsHM2Q+OpXCXhAxJ9xvs8FwiVxf1JLC8IoE5uQ== 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=WxQ3rU/98LcQN8BGtfGwuT/w/tKOVbV7UOfxEVvh8xs=; b=QP10tdnbjoRCXLGIIkjPYBdZAaWOTZ5Y7ojEHdQ6l3kb15hULx4Uu8A05u4CzKi3BQ4dp4jMwjN2t7L9lli1Z/eyXXORlpdp1nAfITYHTa1KUG6xof2QthjQzfAwmNsJtSLO1v3OC6W8+5aCAKJr4f2LvymhRodq3TgLTQlDKFQt+lhmUw6gpfLVCjhLe+dSUEezOi0BWJTjLU/1DFxc+2/RkUJrOIyH7YsEStcwZ0hcPQp5g1vnmNMUI+ed41zoYx6v2JpqzPm60adKWeHiF6wX6Uh169akj/yWHCSVzLmaxE77Er6sC7lbW+TCvo1jTO8e5KqLDa7YWImFVn7USw== 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=WxQ3rU/98LcQN8BGtfGwuT/w/tKOVbV7UOfxEVvh8xs=; b=xi3VKW5VDN3gJ3xvqJdO/2UiZba7Z85UOGNvnO2XEconIqtLbrpKvQnIHBA2IrmRZVokw90ppcdCave3RHjI3+Knzvl+5j1Ne/bkxmYIODPYyXPkPErIU51NwY6NB4P+x3vKDZ6fHd0hSrPDsiyVxJkOv/sPiLzE5fGmAQt8oxg= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by PH7PR10MB6602.namprd10.prod.outlook.com (2603:10b6:510:206::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Fri, 21 Jul 2023 09:46:49 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:46:49 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 09/23] metadump: Rename XFS_MD_MAGIC to XFS_MD_MAGIC_V1 Date: Fri, 21 Jul 2023 15:15:19 +0530 Message-Id: <20230721094533.1351868-10-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: SG2PR01CA0167.apcprd01.prod.exchangelabs.com (2603:1096:4:28::23) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|PH7PR10MB6602:EE_ X-MS-Office365-Filtering-Correlation-Id: cc4739c2-dd7e-4909-6bf4-08db89cf67b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N4/Zaoq65vH+Uc7N9iqvqFaksj531gNwc0iZM8MJgloLTNr+2VZNLxOxgUN7yI/9eXylnLOX8vf13iFZvPwfmGmnWXqpZV+I7Ux9WwZY1XdEh6xp8gm/SPSM2WTzz9dPR9pHni7R81CTxvcabdWqVOsF8OqYUpLSkKiz7aNb74LzrVuWX2/yWustv0pSQjWbGB09MbW1/JEuhOoF4vga0fcwSnH7uJrgdXxPsA8O6FMkk1qKAwgeBjAk0UAXo55p3MgG6XHVwTljAOzOrCavDAyeXXcQNB72jnpcOP+lOfjNcEC2EaHLjvINUAgMTnBOqWqoIK5lOgfwye+pZIYCo5x+U5cPmZEOlOOG82ZC1al470iKbP1hxsjd6eeanRzPtVKFMh+6ETGSQbRNyOUhcwDyCbq3HKuBSXvZ/OKHeksiwYMlbBWkn48K703u4SzEsj31W4U78zu3s/M5zE5DhK37JWP4LvOHt+L3mjicOPOmGvv2XFLFKPSYNdEtO4JbIy3wnbZfqTsSH00hyfsU4lnQ6uf2ztFnZficLlA8WJ75mMHfD5Yn6DK1aaDl0Eag X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(396003)(346002)(366004)(39860400002)(136003)(451199021)(2906002)(83380400001)(2616005)(36756003)(86362001)(38100700002)(1076003)(4326008)(6916009)(316002)(66946007)(66476007)(66556008)(26005)(186003)(41300700001)(6506007)(478600001)(6666004)(6486002)(6512007)(8936002)(8676002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3OQpBK+t7kaysAixE4jBUUp84ENoFRGIdNrqqZg/hU8cdh62C2dDTHYwj1CC3Hf+/V3ZuD3g+YB7f2Je+aukIE9iu+TBgH30Slyig06oLcNY0wiZ4E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mEN+MJuU4lPPG3Fgo0bIhE9XgQga6DXUS+DXDgVqHOWBJufO7S15zM0woWaObqtyW80nzXw7gWcYx15e3Lbfj67AO1gUmEAv8t3i4WQvBuCAVreSvf/tgxe8lJZSl78qtW1JHuuGU7kCCpIHx4YeizX9KeNqyDuuPXX4lfz2RHvwLC3+av9LPDf9fCRW55QVoWnUweceEmep53cnlrnWbora85JBfnSy8fdN1cexTCpAiOLoWJikHpzJc44lbwXLl47NexK/kkzX8EblWSxStjHM14c/ksXddOZh1728SxUSy6g4GhaN31hhs7ok2uf5MIyqZjAbLVCVyyJs4k7h2PA0S6evTcLKcaurojx9HzZJnqzj/iTFlNkPkhp/pptbYFIcboHfEu6tqaVc0uL6RHgoAjonrxIKnXY2fEykNiDd5ZNEMYaBKIj4Rfg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Cd/tYOjgFrJ4eXrQHBDExrvb1S6FEBr2HgpuecMhvtrKXKCOFlNrE+nifjFTYAmyrGQTL7d5owGqsN3S51fxXzGL8OhJTLfUDgl7obkO3AFuHoLSH4MdpkjmHL4dirWbUFBqd05BLRnz7/RIoSVUsMHbJQpX7ML2EaQFgpPVP98KHo2I8eGjHfChaT6eSzXkfCGN08/You2QAdGYgTmQ25tDL14Nq5NXlkz1+saCacmxb0p+6AgzRnaQkqwFoMJEqn6XnXaDZVqxnpJ5cfc9YpgHOuo3cU9t85O9WuCQkvv1OoZJtKiMgQTQJkXp8IxxgDWXTFjApWgTfPR+LYSKDBvMYPIioa/FWj43B7w+rgQbXfQDTm8I7dKM3IoOTcn74woBs8daBj3xiC7CuQwxopyQL23wyGv+woLBLWB6P8JVFr4aeLjvmpdb38KToTRtaN99r4syWLMCsuSiOSrJTkwSV7KqimCYl14NNIX0z78VWILFW/Mpw4iqOChV1xbqiSwP2F3ob1e8vtoOe8SmzFYKGCiEaP5TUv+5y8RODSlQvDukn5TIKQZAJoYBr4w+T0ea3iFj3cI4RGxuxc/T6tlh/gcMFJOwAsSheSAjNrXCU3raifuRga6Bzie421vNlxmyJdf3BjyW8XkknDmoSz3pJ0DXa0i2pyhsZWIKYP1jPSUujchBGXmtcej3rS08VCnJpxUeyD3d3CjKTQ5YuvH4i38zThBxaAAUXsvqEbWCAakVlLCY6s5PMcSlGNhAxRknMID7AnX4+zYWjwW/NeS8DwNgb7n8C9QGNPMyFYM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc4739c2-dd7e-4909-6bf4-08db89cf67b1 X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:46:49.6809 (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: GcQuiXdnvBlyRj2C/ZKlZ4OAGAf/7Xxl7xmNZb+2p1d+1BV4Texa8oLZRNNpPcaeIXX/v/jFx9kdKGTpgdAS9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6602 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=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-2306200000 definitions=main-2307210087 X-Proofpoint-GUID: gQOe457GaCMEmuueqmv2nElvk--OMAke X-Proofpoint-ORIG-GUID: gQOe457GaCMEmuueqmv2nElvk--OMAke Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R --- db/metadump.c | 2 +- include/xfs_metadump.h | 2 +- mdrestore/xfs_mdrestore.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/metadump.c b/db/metadump.c index c26a49ad..7f4f0f07 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -2968,7 +2968,7 @@ init_metadump_v1(void) return -1; } metadump.metablock->mb_blocklog = BBSHIFT; - metadump.metablock->mb_magic = cpu_to_be32(XFS_MD_MAGIC); + metadump.metablock->mb_magic = cpu_to_be32(XFS_MD_MAGIC_V1); /* Set flags about state of metadump */ metadump.metablock->mb_info = XFS_METADUMP_INFO_FLAGS; diff --git a/include/xfs_metadump.h b/include/xfs_metadump.h index fbd99023..a4dca25c 100644 --- a/include/xfs_metadump.h +++ b/include/xfs_metadump.h @@ -7,7 +7,7 @@ #ifndef _XFS_METADUMP_H_ #define _XFS_METADUMP_H_ -#define XFS_MD_MAGIC 0x5846534d /* 'XFSM' */ +#define XFS_MD_MAGIC_V1 0x5846534d /* 'XFSM' */ typedef struct xfs_metablock { __be32 mb_magic; diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c index 333282ed..481dd00c 100644 --- a/mdrestore/xfs_mdrestore.c +++ b/mdrestore/xfs_mdrestore.c @@ -240,7 +240,7 @@ main( if (fread(&mb, sizeof(mb), 1, src_f) != 1) fatal("error reading from metadump file\n"); - if (mb.mb_magic != cpu_to_be32(XFS_MD_MAGIC)) + if (mb.mb_magic != cpu_to_be32(XFS_MD_MAGIC_V1)) fatal("specified file is not a metadata dump\n"); if (show_info) { From patchwork Fri Jul 21 09:45:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321745 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 2A073EB64DD for ; Fri, 21 Jul 2023 09:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231448AbjGUJrH (ORCPT ); Fri, 21 Jul 2023 05:47:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230237AbjGUJrE (ORCPT ); Fri, 21 Jul 2023 05:47:04 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B308F0 for ; Fri, 21 Jul 2023 02:47:03 -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 36KLMVfY001950; Fri, 21 Jul 2023 09:47:01 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=5KL2dSRBJcX6W/k04xfgLvJGNrMRIWN2CaQHACXy2V0=; b=jUEzpWt0Ir9+EZfa8NzqP6LCEEC2tIl8XrlDSdavu7UxPtUCL3T4Ydn3bOCK2w791czS Y8NGsxuxwjPyLzU/pr95tJ09K2gVrS53zLlayPbInktXqma8ga3/O7WOiUnun52Cc9CI tyVGln31+I1xVQKpXQMNltiQL8gXg40xJvDNOFt4loTLC1tXtiIxdzsGJ4yrQcR1lTnN rP1HEDdC03uNpEBFGQVHn5BcM+f8smHUIYMPLH0bXwhdJMVUUPXHCTASad7ctyUiIWaG QEtEmUDjaU2TGh2eaNG8M/TWPFshuFU6TXUhVvyDgEvIWAnagfMLKrDAJN+bob7o3fSo 8A== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run773kmx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:47:01 +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 36L9BbeL038227; Fri, 21 Jul 2023 09:47:00 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2105.outbound.protection.outlook.com [104.47.58.105]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhw9sqwq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:47:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fHPlAbUzCB8CfLukXUe8F9S91ukghlNQUjfGAx8XJxxR6jCKzAEEGvdkuUuSe9ogy04wKgVYMa7oMyKnztplAnSSdjibZXChTdIf2zsF2CkIoX60KVTsK0MLhvX3K9uZFClAGTekfJrycTOLEdlM/DAbV7rnmHEH2QARpLbJdenHbSrQHZrvxlEV7G2rhXAr+c5Nj0dqXZp7P+v3wtEtxw90h6zt7aT0MhnZUpYHxpNCSsO60zfyGzhojhfWADJLGOwjL+7HiKCcDRfJWNO45lw5Da7JkPCmsi4UlBJMzEb1cd/FHV5WOgOBmgaNoZsuf7qrhHaxOOhPipHD1zYJvw== 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=5KL2dSRBJcX6W/k04xfgLvJGNrMRIWN2CaQHACXy2V0=; b=MKjAztVbboiY+PlCplnLPGlEGBFpLTEkw9+1t8ZO5eaQIrIKqtoe/S0H9QcOJGavm+8K/OQyOtuBT9CPd9evo3OaenwHL/4bf1MbvlDo5VJjSaX9UV6k4DozvPUePhFgyoWJr0qq2EOnYoQKlAlxV9HiEgUyyILFNEfFUT3ToXXffA0s8DjwgJVdPMbebS+uI5CiD3446mPRp/P0cJyVvEbUNDmvoNXNbze286WGlKD3YM6Q1RcxAZXbO494C1CAYcEDhwCyrUgb/QsYZUy8qRjopetyOEiIe8MKuIVqke203ekeKMQm+K31m5U9Js9JUh8CVMkUGUZD8HqMkSDecQ== 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=5KL2dSRBJcX6W/k04xfgLvJGNrMRIWN2CaQHACXy2V0=; b=Enfj7DcMsKFonvP+0iXC84mAam5KwHIljVDaI+arCGsBwlGEO/X1jYkUPPLo70jhcSklALb9KzwFtUexawzK5ibTtTz/0yNvVOy7ksl333eIysNeKhzWoVdEj290GKnGZdQMLhBS/3btL5Zbwtik7lx12qVsGrydoQ0S2FGz5IM= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by PH7PR10MB6602.namprd10.prod.outlook.com (2603:10b6:510:206::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Fri, 21 Jul 2023 09:46:58 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:46:58 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 10/23] metadump: Define metadump v2 ondisk format structures and macros Date: Fri, 21 Jul 2023 15:15:20 +0530 Message-Id: <20230721094533.1351868-11-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: SG2PR03CA0088.apcprd03.prod.outlook.com (2603:1096:4:7c::16) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|PH7PR10MB6602:EE_ X-MS-Office365-Filtering-Correlation-Id: 4665f266-f9af-48a0-4ba4-08db89cf6d07 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: drJVkqM6izNoc8mZi/RXbqoNvlughtQQzX/IMIPPBbO/Af03eyeMl51SaiOWfx/iGPZLS+aEI1OUmA0O+3L80d0+ckD2xf5kM/DohuXUNK9o9RgdMpE6dE5hd3rZQaTl0eQDAxDjnDlZHeegpLf2o1Odt/edYOfYnos72dZT+mS69XnTMVWimhFP18rygnp3egL9+qvMivMDLo3vbdaD/+i40EqptQuM++SV2NljM1WLj+3+OotZS0O3j9NZuQYzNaVCuZj0G8LFXdDkqSVxUMMGmLkmYU/2dE5uM5DdTxoaWRuc66ij+Ov5lUGr3mPvDTa08+ZJkvezwdHODPUmNclo+Jnt89DmcCAbztXJYbepv9XOeaNjFkmPip/y7Q6AuSVNCzrmCqEqi44/Zt4+zbI7ZvDcz3pTAkRxlrR9GfeuzivIP3g3yE4bT8dKAcUjajtX41oFiNdvl0NsATDeUL2H/FlJ+DD69zBa/IrQZ5RG6pTnOIeDd/T4XBgX/HUYPBi+joxP5N9J53zFYiB+yaP2rt8jt8T2+AqJUbIoGQ0mR0xTjW2styw8D4HdNfGr X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(396003)(346002)(366004)(39860400002)(136003)(451199021)(2906002)(83380400001)(66899021)(2616005)(36756003)(86362001)(38100700002)(1076003)(4326008)(6916009)(316002)(66946007)(66476007)(66556008)(26005)(186003)(41300700001)(6506007)(478600001)(6666004)(6486002)(6512007)(8936002)(8676002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Iyzi70HddpRUq6mce5Hckfa5ExvEQIM8rMiuWnd+EDgc0GWPgUkLjdjy9FuFUdq+sL8+0ItiiyPL09ICKdemnD1WVhIYBxqDsgczBgp5ygbTIgWL1tPwuQZYnq5HNl9XPLq2USZPWkaI+zcwnnb24PfkXhZxbQwfxumR9s1Y4WwmdE7Nz6WfUN41Gb4UUAkdVCtG8sGT+9rgk2ZVtpRWLstO9wkpG4bfcqyJ4PTEfbhURrvg8bSHvKm4pW9W/BwsSN+SyZYvhvJKWcvcdVJZ2TR9/MfZf4shGrxvL1N89uoDAn58L6f0RwVv85ZZHVVbPMEwNq385KDjRtZfOFfPmxye+d8ujJJqByOYvfBoS8ssoPXxgIOlIHnRXtw9/+zPVll4OSeU13gU0BeDJxg6R4dQE8duL7QOebg16qsONW3IcNf8z5GzXrpmGFCp6fbSmi+ShbfAAF+qFLnVRV1BmXOpGmhk6gd/cYXk7HYJvWIZVEo6VZvtvGWMKQjy1ujCcM8ZDzruV43m3cb9kT1wp9xLcyMNRPr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/CA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: gFiv1rTi0HmVZvgRw9Jl4aJO9pACgIYNIjyD0397TpCnzmpR6UgGyKFfy3P0QLPEDuMUYGA9gjzbVKsoPQAhL528ckZKrkRjzVmawL/SIawIX13dlAI80tojG7zlu1UD1zkt7J4UdkfiZJFB3TBPq6sGvWSkiXgbdKfBrURTATCF/2Zh36UsfuXU/Hn/7lrNtLYDX5VIVan9XDtfADQA7a3Sy4/aV5aZSnpi/L6BK/ADQPOwGti6SQmxTAFMJFBF0+tlnssNvwqpaKq/4jWo8opnxc1vbBDp5ortHDvnCBSC24aYhmt6m8y/M7wyYxNM5CuPHxAbcyGQCUzwIqViCnFEcjr2OJBp5D3+Zp4gJYIS6Gh5AAzPslUhV1dFv4Oi5RbOYbhE/mUetiNIVVppTnad6xBwwo99UTmzyRWGq42Sc3d0WiWyyZeZakU4J/7f0DvUUAbwGum2E7asx9J/M57dO6Vli7j8eo4eWziQsRQGPd5Ralgu8bNdsAQXJU/GZCP2kp38/ZBcn2dg6y8R59nmJ3M9B9jHlUA+ACjMtRG8f1GPja7GsOcwXrjsb5oEKVgl/rvXrzLEERO6xOUJk63EaDVA0U5qnoWjAhc+MUYGdTHX/EQLu837R4gTN2t7GzFth0gkvZY1qwQuCytsY2o7U0VFoO+/JdQ6B5WiwoYtIBHy1WtfVb346ChMaV7WPuFZesGAxa1incDIJ5RdRR0M79wZ1P8Nuss4CB9mHVSeOUospDgIphd46YuN52qoJJE4/aL3hnsc7ByNvOsQuLIKk1hVb9oV7hgupD48s1A= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4665f266-f9af-48a0-4ba4-08db89cf6d07 X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:46:58.6651 (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: bSsoBdBeckCtoN9spZFI7XaoOYwosgs/naa9MHmRaXaZVEWeCjqD2bdYLGToGaC3ae+pAZflFpSQNe0l+znttQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6602 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307210087 X-Proofpoint-GUID: L_juNGb4gfcQuF-Ce50U4Ohi8DpUZFcV X-Proofpoint-ORIG-GUID: L_juNGb4gfcQuF-Ce50U4Ohi8DpUZFcV Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org The corresponding metadump file's disk layout is as shown below, |------------------------------| | struct xfs_metadump_header | |------------------------------| | struct xfs_meta_extent 0 | | Extent 0's data | | struct xfs_meta_extent 1 | | Extent 1's data | | ... | | struct xfs_meta_extent (n-1) | | Extent (n-1)'s data | |------------------------------| The "struct xfs_metadump_header" is followed by alternating series of "struct xfs_meta_extent" and the extent itself. Signed-off-by: Chandan Babu R Reviewed-by: Darrick J. Wong --- include/xfs_metadump.h | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/include/xfs_metadump.h b/include/xfs_metadump.h index a4dca25c..50175ef0 100644 --- a/include/xfs_metadump.h +++ b/include/xfs_metadump.h @@ -8,7 +8,9 @@ #define _XFS_METADUMP_H_ #define XFS_MD_MAGIC_V1 0x5846534d /* 'XFSM' */ +#define XFS_MD_MAGIC_V2 0x584D4432 /* 'XMD2' */ +/* Metadump v1 */ typedef struct xfs_metablock { __be32 mb_magic; __be16 mb_count; @@ -23,4 +25,70 @@ typedef struct xfs_metablock { #define XFS_METADUMP_FULLBLOCKS (1 << 2) #define XFS_METADUMP_DIRTYLOG (1 << 3) +/* + * Metadump v2 + * + * The following diagram depicts the ondisk layout of the metadump v2 format. + * + * |------------------------------| + * | struct xfs_metadump_header | + * |------------------------------| + * | struct xfs_meta_extent 0 | + * | Extent 0's data | + * | struct xfs_meta_extent 1 | + * | Extent 1's data | + * | ... | + * | struct xfs_meta_extent (n-1) | + * | Extent (n-1)'s data | + * |------------------------------| + * + * The "struct xfs_metadump_header" is followed by alternating series of "struct + * xfs_meta_extent" and the extent itself. + */ +struct xfs_metadump_header { + __be32 xmh_magic; + __be32 xmh_version; + __be32 xmh_compat_flags; + __be32 xmh_incompat_flags; + __be64 xmh_reserved; +} __packed; + +/* + * User-supplied directory entry and extended attribute names have been + * obscured, and extended attribute values are zeroed to protect privacy. + */ +#define XFS_MD2_INCOMPAT_OBFUSCATED (1 << 0) + +/* Full blocks have been dumped. */ +#define XFS_MD2_INCOMPAT_FULLBLOCKS (1 << 1) + +/* Log was dirty. */ +#define XFS_MD2_INCOMPAT_DIRTYLOG (1 << 2) + +/* Dump contains external log contents. */ +#define XFS_MD2_INCOMPAT_EXTERNALLOG (1 << 3) + +struct xfs_meta_extent { + /* + * Lowest 54 bits are used to store 512 byte addresses. + * Next 2 bits is used for indicating the device. + * 00 - Data device + * 01 - External log + */ + __be64 xme_addr; + /* In units of 512 byte blocks */ + __be32 xme_len; +} __packed; + +#define XME_ADDR_DEVICE_SHIFT 54 + +#define XME_ADDR_DADDR_MASK ((1ULL << XME_ADDR_DEVICE_SHIFT) - 1) + +/* Extent was copied from the data device */ +#define XME_ADDR_DATA_DEVICE (0ULL << XME_ADDR_DEVICE_SHIFT) +/* Extent was copied from the log device */ +#define XME_ADDR_LOG_DEVICE (1ULL << XME_ADDR_DEVICE_SHIFT) + +#define XME_ADDR_DEVICE_MASK (3ULL << XME_ADDR_DEVICE_SHIFT) + #endif /* _XFS_METADUMP_H_ */ From patchwork Fri Jul 21 09:45:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321746 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 790B5C001DE for ; Fri, 21 Jul 2023 09:47:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231808AbjGUJrW (ORCPT ); Fri, 21 Jul 2023 05:47:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231715AbjGUJrM (ORCPT ); Fri, 21 Jul 2023 05:47:12 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7628F2D4A for ; Fri, 21 Jul 2023 02:47:11 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36KLMVl8004926; Fri, 21 Jul 2023 09:47:09 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=By86vlQ/X4kg1XvfAL8vVwvDmHQQ5vV/ZDYs0A1YsnE=; b=S72EBufJzujJiZE5i4buHFCwT+Z4XU+da5xp5RmlrsDLkc7D/Np9FnUtsWdM8dLrOn1S h2Pyi2v0OzCrx0ZZX+vPqZpFHIEhFAXREt1NQdPfZkpK7rleK9o9Vllo6XGb/SalVp1G AWtDd1sRg8Nlad6+Ct1chbJdsX/K5KWvyUyYKtBYwAgVBkPs3d83Ni9DwORE1qu5jhlq HYfY4UwrM5hhzvhxRsG0xKCek6vDWW2IJVTl1aRdRmtpp63hh9M0miOwUBfSJh26LtPr H9IvdwwV4gmAwM6reJ0a/LTolNXX292iB0C2lzEryfl2Qteo9IJBmbp99HVqtY2aqFbA IA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run8abn13-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:47:09 +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 36L9fVQB038185; Fri, 21 Jul 2023 09:47:08 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2103.outbound.protection.outlook.com [104.47.58.103]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhw9sr0w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:47:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FyXp1dlJWw06BjYEywWamvaqmfbxvsvb2G64XtkalFm2a/n+sQM/8fH/E6KRG1hPJjK+2+PqxyvNpwrny0YaadXKWoNvmxviudZ89aepchFBcMIdhHZW4rASPlhW9bnAKyZs0G2nYS1XmrWaNhiiXqoPIRraBFPiI9lqprL9HMX/ERqWsM/cqc50U1KuF8YUntcmBB7sTXX+KeEy9Qsy6O7NVdR65FDPzBc00C7M3HTsnEnrfbYlelNTctam+F4V2WW8JwItiwzD56XNS9jFs5eMEukJavxAA/dIQsa3RPKyIXgRq7Uk5x3ilp7gnicy8BWsVKn+ym7mvsU8kOSoeA== 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=By86vlQ/X4kg1XvfAL8vVwvDmHQQ5vV/ZDYs0A1YsnE=; b=mNLmYMC7DWzeya70qlcsx1rM9ccrxYcEWt2DHRGdbztSIY6xm2f7W/972Rqhny9H9uKBvPdHDQoW57Tgp+qgRM8UGeiHWpEWD8yveCu/PIlnVoVs8W4mBSZgNIPRpaTnf6Mfid0Oua6X6kocOt88sNjWiIcVKaUPLvwN2MOTvPRN7lfCGcqvtFaFhetRBmzgNupNPFdMoPafxENaDT74pCiygurqIMepFbAtlu9gjjFsqNjHkipSCUCV44EsDlEoIQM81i2Fwi/GDUb2PyFpD1WWq0E8N84i8X4yXblTpM/mfvk8XnNYnz27TcktvyIaZCYc6/gedwYNdo+H5Ad37g== 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=By86vlQ/X4kg1XvfAL8vVwvDmHQQ5vV/ZDYs0A1YsnE=; b=DcZDuvxO0MVPjFBFM3OUa4XRs6imA/CtOE19+SuMYsxdz8y6PEpTxh7AHkV4CaQcwUgadDYDreo8+qH9FmXMWUS9pGM1G7cWQ8ti34arQOYU8+MyBfbpvXH5/mLFASiyPA65gb1hn7JQ/a6recj+QmHJZ6uYBDrGLMgRCINAcUQ= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by PH7PR10MB6602.namprd10.prod.outlook.com (2603:10b6:510:206::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Fri, 21 Jul 2023 09:47:06 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:47:06 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 11/23] metadump: Define metadump ops for v2 format Date: Fri, 21 Jul 2023 15:15:21 +0530 Message-Id: <20230721094533.1351868-12-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: SG2PR04CA0178.apcprd04.prod.outlook.com (2603:1096:4:14::16) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|PH7PR10MB6602:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f7be2da-9806-49e3-75d7-08db89cf71bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +Hzvt7Wod6SzV5KbiY29DnfvHQdWhbL9RTWiI3JkzRAj35Yki+IX4oVVQV4s0GgVhUlpFNEsNn4fPnOitSpEZ3aFz8jptWGzLl6cVPBcU6uH1qAvMSoqFw54ryk0tutcCKVu7glZd7s4cGWZqPIzmc6h5BhyCzjPirvRxnHhaIZPYa9Nt27Jc8r5p/uyzDL3C5Fri3ilQyRbU/M5kVVu3qe3MUOzdIF7OdF4zBX00TbyEn4k7Yv5agVATDDjI5Mak0BfbSul8rTdhWSR/YS/cM05X91kcZZ+Qu4teut5yUvsdsToJVs338jN7/hCBGPh92rWqjK8Lvl0DOLeYEY9BudVb26YA0e8KjNBCaubYLrSvpHSdNs7UvZKDdPpBTDefcCrrC6yRJTCYNSRPKFvRUzcuueDCw9keGf+pK7Z0YpEF1f1qLx4+3SUgv9kXjsLwPMWZ7C7BvvPpj6JLXwaiMxd3PFwUtTmFe61+3RTpDuEBx41XuHuYJHZ9hbTfhqFiQxN4q3Tg85HgvVkSNGRZ9D9T7sguksZUNGRb+OhXeUPbKR/lGNIrkgwXhETfPob X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(396003)(346002)(366004)(39860400002)(136003)(451199021)(2906002)(83380400001)(2616005)(36756003)(86362001)(38100700002)(1076003)(4326008)(6916009)(316002)(66946007)(66476007)(66556008)(26005)(186003)(41300700001)(6506007)(478600001)(6666004)(6486002)(6512007)(8936002)(8676002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bT8QcudpK6+UukuDK+K5/G7hReYKTL4VRbjwfFTvsD80Ld88ZULsOKkXslX81DndpFUBvtkETxWWlgXa0La2aWOzOGl+TUnreUi7/018PfioUlSB/g2rZ4tboQDcVo9w3FUFd6ZA4yNUxjUBHeK18OKHMa2XwXHcWeU/7Ctvl9IKADrtyduhP/pKub0HuYvYSUKqVA1pEFy3A6EtYkLK0+PHMQCi3d62Co9fVBX+DIW8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zT3TggwD93SKXGb8o2Dh4/1XYzNZhtmycjNkSSMcu3TeabmcigxIQvym4o2Li6Yx/NwLDv9ON/dtxiFMoGnUmvidQJqz3tbFfIJz/gR6CgorblxsGI0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f7be2da-9806-49e3-75d7-08db89cf71bd X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:06.3291 (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: YrJZihxc4CiwxG/yvujmguT8H5kFD33ECSkQQor1peSmON8nDp3c6pgiF93X9oVK5CRiVvof3euIwbKEvDMS3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6602 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307210087 X-Proofpoint-GUID: F-acLtlBqaDv8nDRw2EovlvxP2eVbWdi X-Proofpoint-ORIG-GUID: F-acLtlBqaDv8nDRw2EovlvxP2eVbWdi Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This commit adds functionality to dump metadata from an XFS filesystem in newly introduced v2 format. Signed-off-by: Chandan Babu R --- db/metadump.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/db/metadump.c b/db/metadump.c index 7f4f0f07..9b4ed70d 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -3056,6 +3056,70 @@ static struct metadump_ops metadump1_ops = { .release = release_metadump_v1, }; +static int +init_metadump_v2(void) +{ + struct xfs_metadump_header xmh = {0}; + uint32_t compat_flags = 0; + + xmh.xmh_magic = cpu_to_be32(XFS_MD_MAGIC_V2); + xmh.xmh_version = cpu_to_be32(2); + + if (metadump.obfuscate) + compat_flags |= XFS_MD2_INCOMPAT_OBFUSCATED; + if (!metadump.zero_stale_data) + compat_flags |= XFS_MD2_INCOMPAT_FULLBLOCKS; + if (metadump.dirty_log) + compat_flags |= XFS_MD2_INCOMPAT_DIRTYLOG; + + xmh.xmh_compat_flags = cpu_to_be32(compat_flags); + + if (fwrite(&xmh, sizeof(xmh), 1, metadump.outf) != 1) { + print_warning("error writing to target file"); + return -1; + } + + return 0; +} + +static int +write_metadump_v2( + enum typnm type, + const char *data, + xfs_daddr_t off, + int len) +{ + struct xfs_meta_extent xme; + uint64_t addr; + + addr = off; + if (type == TYP_LOG && + mp->m_logdev_targp->bt_bdev != mp->m_ddev_targp->bt_bdev) + addr |= XME_ADDR_LOG_DEVICE; + else + addr |= XME_ADDR_DATA_DEVICE; + + xme.xme_addr = cpu_to_be64(addr); + xme.xme_len = cpu_to_be32(len); + + if (fwrite(&xme, sizeof(xme), 1, metadump.outf) != 1) { + print_warning("error writing to target file"); + return -EIO; + } + + if (fwrite(data, len << BBSHIFT, 1, metadump.outf) != 1) { + print_warning("error writing to target file"); + return -EIO; + } + + return 0; +} + +static struct metadump_ops metadump2_ops = { + .init = init_metadump_v2, + .write = write_metadump_v2, +}; + static int metadump_f( int argc, @@ -3192,7 +3256,10 @@ metadump_f( } } - metadump.mdops = &metadump1_ops; + if (metadump.version == 1) + metadump.mdops = &metadump1_ops; + else + metadump.mdops = &metadump2_ops; ret = metadump.mdops->init(); if (ret) @@ -3216,7 +3283,7 @@ metadump_f( exitcode = !copy_log(); /* write the remaining index */ - if (!exitcode) + if (!exitcode && metadump.mdops->finish_dump) exitcode = metadump.mdops->finish_dump() < 0; if (metadump.progress_since_warning) @@ -3236,7 +3303,8 @@ metadump_f( while (iocur_sp > start_iocur_sp) pop_cur(); - metadump.mdops->release(); + if (metadump.mdops->release) + metadump.mdops->release(); out: return 0; From patchwork Fri Jul 21 09:45:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321747 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 00489C001DE for ; Fri, 21 Jul 2023 09:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231129AbjGUJsR (ORCPT ); Fri, 21 Jul 2023 05:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231846AbjGUJrr (ORCPT ); Fri, 21 Jul 2023 05:47:47 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 434E335A3 for ; Fri, 21 Jul 2023 02:47:20 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36KLMktZ016224; Fri, 21 Jul 2023 09:47:17 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=aS7aNBYCuCoCy9DN+ETg4jVMG9CziEaLI/hvKubgldo=; b=URN+IaPMKMtD1/dGmngv3UHHfmGG+Cc3w8x/25ASdfVnjyJKNV3hwrjOz+NJc+2Kt3xt cYAZF4axdzq6HnZAO8A3UcFJZWXlrY26dphQXAeoGE66290+t4s5kt6PNgTLCNrr98kH 9thqCbgUl/eS5R0u1uJ1oXYepgO7nmvH0znKNauDZuuYcTQXZTUYZReC/Z40kqm9EQU+ +JgGXKw0oxE5OERYcv4+g0FjFsntrsWE9usJt76+QGr7X9IcV3gYyv/XMztIGcayegu3 UsexKHtHiGExyfVgSzMJ384wwATm8+hOJtdfIDY5XWDP6DaHB0KQB6Vua/zsCKDqOFAT GA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run783j85-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:47:17 +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 36L9fVQI038185; Fri, 21 Jul 2023 09:47:16 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2105.outbound.protection.outlook.com [104.47.58.105]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhw9sr58-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:47:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dRM5sNwTCQSAzvFHO0vtS6QfljGw0w9eYl9k2C/+HM4NtSeSY7l3PJ5pV2dWNEBIc/ZoePXGFWYeKq95oAUMzPkvblwzEPHUn9oxIvbjk0b8pS4f8I9KwuylaGknIMuwGvmZdnjp3XFbhDxCJ0gsA247jmIuCcse0LElthsYjnWHLa2KrtBX96Ih6ke7iVAHqYSHn1xZk6d6i5WGD8XBiL8jVjd4GYuRgBPQOpQLNxmWMpJWJ3LVOUlGgTL2rZG8+B2eIJ/wNr9du6JnAOqJMdJU6jz7olSfUyAPJzPzjadC4VnFI+8xZZoBdfIjazlx6W7/gwGJfHJBywfbW8UVew== 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=aS7aNBYCuCoCy9DN+ETg4jVMG9CziEaLI/hvKubgldo=; b=RvqHgAJ4wNFvJb3Ua3hAhGvl/jTC8igLg0v8o3BMLz/H6WLJsQw0C0VCRWl1IHQuiZFzeWpIe0PmirnfpZH6OcAISEhsA8q62xF5VRs69xaZhYMVU+R0vjcvd6rCYMqhs5973Va+dEbZuaYJPk/LfBLlDaxzkbd7Kwxu6h/zW5O+7iHZn9mIgXYJglAU4kBc+ck4f17hQgnpS4e9gNRan0hU11r0+cXRt5S25sOEAY3GNduNFjh7PAqxcQjmozSVYn8jUwdow6Af/IBGaVwH9Bh3dBgnSCp/stgpugD7l9AGPVp2QJmA0AjR9f59dXFu+YUqEVOTIekFoWpp+XdzAw== 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=aS7aNBYCuCoCy9DN+ETg4jVMG9CziEaLI/hvKubgldo=; b=lk/jbhh1pJfqjetddpII+3hAyTjV6PDb4BoNsaMwqFSfVBeYQA2BQnMUYpYFNdc6KmhYvWNer6WWzqSYNS0ZHMbftDtKWoHc+qygD3qyx9T9wh10W5zNLGxOhaw8RTrTYn0FmoQN4DF/re9+K+A8eOggEHEgi2bTjTOoiWVZncg= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by PH7PR10MB6602.namprd10.prod.outlook.com (2603:10b6:510:206::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Fri, 21 Jul 2023 09:47:14 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:47:14 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 12/23] xfs_db: Add support to read from external log device Date: Fri, 21 Jul 2023 15:15:22 +0530 Message-Id: <20230721094533.1351868-13-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: SG2P153CA0034.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::21) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|PH7PR10MB6602:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b7e2419-b376-4115-5e66-08db89cf76b6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kyoaXYFSm+zES/SwlUbmU47u+WjI0X9WqgJp9yQQa26Yx/KuUTkTV2qA/SZs4kFOW0BcUzNp4XNrVUselFkBCzgkCyEycDD7uz4I48L2PvLJswMTBSiNrN1z19ctF1ZCKi2RGOFjITn2gI2TRRjf70DMXnynpUlL+n1O8QvRXtnLn5p4WfWZcrI940Nz1/IafiNFujtmo8DQ0Tpp+Mj3SWt5HclvPDupZ7EKAZtvjBNAm+FhYNlOc47Li3uzMBuZ9QAPpIeNasfk7hdNfK52aqW65iQEW/TMSiv7UiSU4mzlGO01vuk9Sz64+a1Tloll8s0LfDvCzbwQ1FwYcsTbVcaeLNad9TROj8uVdzWI1CX8TTGL4QvjPwI33Da3GywbdMrmlWed3PwSnAZXZVYvz4TjTrOlbowWf/S/d8paXpyQwn0atkctSQEG8hHF/Jou8TsKZI9LwyC8X5N+zegnzcBUEvk/v4cPYq6TodV7IfRDmR+CUO4W5LEbhzDgn3TuSyxSEIWQa5ZRmIAEUhNmMCfG16YYmW1Jfk8T9qR+ZaQgskv9poZ+x2GyMlMb6HQl X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(396003)(346002)(366004)(39860400002)(136003)(451199021)(2906002)(83380400001)(2616005)(36756003)(86362001)(38100700002)(1076003)(4326008)(6916009)(316002)(66946007)(66476007)(66556008)(26005)(186003)(41300700001)(6506007)(478600001)(6666004)(6486002)(6512007)(8936002)(8676002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NSM/aF6E3eCkGU1jYDBnjeQmnOWU6nCeqcB0BxWvj4Bu8UteNDCxNFNUxsJ54eaqxnoy+zLlR9PTAnNuzXkpgvDUHhF93+CoH8DJk3Dy15NiidYTZDIsj6QninH6xk/x3Ow9NLFg9tPEalMsriO40wqT/6mzc6HyfANc09N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4QpR0pKEXnrxtE5wl+VbipPv49eQgfVnJc09fPfnN3GBhdG7eRrsBzUs4RDtcM/EMG6tF+0H9+pc6aM4LkldCi4Sz7e3jjbMWA+rnewwbW8T9ipst9navBncrB+h/DFl0CSt1UlQBgze4c79tsu+ISWE/Lme1VE7LWWOk3RFo4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b7e2419-b376-4115-5e66-08db89cf76b6 X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:14.8603 (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: TZEqVDi0W0AB9fu8UbsQSGNnFdB1GWSNBuUYMcjQbOJP0P62yAtkqVWj1ZjgtaPzfGW5p6dcQCGVCZxBXf0z7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6602 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307210087 X-Proofpoint-GUID: j817lKNbrJ4J9yqulf0Ho0P4wFKsAuxe X-Proofpoint-ORIG-GUID: j817lKNbrJ4J9yqulf0Ho0P4wFKsAuxe Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This commit introduces a new function set_log_cur() allowing xfs_db to read from an external log device. This is required by a future commit which will add the ability to dump metadata from external log devices. Signed-off-by: Chandan Babu R --- db/io.c | 56 +++++++++++++++++++++++++++++++++++++++++++------------- db/io.h | 2 ++ 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/db/io.c b/db/io.c index 3d257236..5ccfe3b5 100644 --- a/db/io.c +++ b/db/io.c @@ -508,18 +508,19 @@ write_cur(void) } -void -set_cur( - const typ_t *type, - xfs_daddr_t blknum, - int len, - int ring_flag, - bbmap_t *bbmap) +static void +__set_cur( + struct xfs_buftarg *btargp, + const typ_t *type, + xfs_daddr_t blknum, + int len, + int ring_flag, + bbmap_t *bbmap) { - struct xfs_buf *bp; - xfs_ino_t dirino; - xfs_ino_t ino; - uint16_t mode; + struct xfs_buf *bp; + xfs_ino_t dirino; + xfs_ino_t ino; + uint16_t mode; const struct xfs_buf_ops *ops = type ? type->bops : NULL; int error; @@ -548,11 +549,11 @@ set_cur( if (!iocur_top->bbmap) return; memcpy(iocur_top->bbmap, bbmap, sizeof(struct bbmap)); - error = -libxfs_buf_read_map(mp->m_ddev_targp, bbmap->b, + error = -libxfs_buf_read_map(btargp, bbmap->b, bbmap->nmaps, LIBXFS_READBUF_SALVAGE, &bp, ops); } else { - error = -libxfs_buf_read(mp->m_ddev_targp, blknum, len, + error = -libxfs_buf_read(btargp, blknum, len, LIBXFS_READBUF_SALVAGE, &bp, ops); iocur_top->bbmap = NULL; } @@ -589,6 +590,35 @@ set_cur( ring_add(); } +void +set_cur( + const typ_t *type, + xfs_daddr_t blknum, + int len, + int ring_flag, + bbmap_t *bbmap) +{ + __set_cur(mp->m_ddev_targp, type, blknum, len, ring_flag, bbmap); +} + +void +set_log_cur( + const typ_t *type, + xfs_daddr_t blknum, + int len, + int ring_flag, + bbmap_t *bbmap) +{ + if (mp->m_logdev_targp->bt_bdev == mp->m_ddev_targp->bt_bdev) { + fprintf(stderr, "no external log specified\n"); + exitcode = 1; + return; + } + + __set_cur(mp->m_logdev_targp, type, blknum, len, ring_flag, bbmap); +} + + void set_iocur_type( const typ_t *type) diff --git a/db/io.h b/db/io.h index c29a7488..bd86c31f 100644 --- a/db/io.h +++ b/db/io.h @@ -49,6 +49,8 @@ extern void push_cur_and_set_type(void); extern void write_cur(void); extern void set_cur(const struct typ *type, xfs_daddr_t blknum, int len, int ring_add, bbmap_t *bbmap); +extern void set_log_cur(const struct typ *type, xfs_daddr_t blknum, + int len, int ring_add, bbmap_t *bbmap); extern void ring_add(void); extern void set_iocur_type(const struct typ *type); extern void xfs_dummy_verify(struct xfs_buf *bp); From patchwork Fri Jul 21 09:45:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321748 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 A2D30C00528 for ; Fri, 21 Jul 2023 09:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231874AbjGUJs1 (ORCPT ); Fri, 21 Jul 2023 05:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232022AbjGUJsI (ORCPT ); Fri, 21 Jul 2023 05:48:08 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 570B73C13 for ; Fri, 21 Jul 2023 02:47:32 -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 36KLMWdD002011; Fri, 21 Jul 2023 09:47:27 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=H66qGbjV70ou8FWBBgOpLIkBPi9qfcwQl+qUFzfsv6Q=; b=F9bcRnnYU8yaPYEiqKZFs+JdSWr047uKbVf3vSIhc71hFOjZsYh81W+CR5k4j2EW2TB9 Xs6/8uIooNifV+o5drviEJ0ffdb2NZF+7ZXiYGjwDlGrVs5Ks8FRRIPUT4Yk8aVzMQ5A 7duSTvR6GlFQz93YCAnB5e9/GyQ/6clhI3tSpihYhGboGF0XH5Yo43Q4hn6HQXvkuR2k sUQRyHGX5pUy8DhHCWe3BIAxu0bUJlWWgCZ7CMyuzIx+C5kfsrYbmfRwt/2SaMiitg8s Aaxcwyub6rVzwXmnLWBGtbc1ngdx8hlmOHzbxWnrZuvkt1eorBcYtqd4+Vc+U21HMO3D Nw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run773knk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:47:27 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36L807nt007843; Fri, 21 Jul 2023 09:47:26 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2107.outbound.protection.outlook.com [104.47.58.107]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhw9jx34-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:47:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FMLrfi84IIl0eZFul8uUciXmrZxeJz+UZubG4uiiYKOTt3IZwcPP1wL33TAdBQO3abTjA7l+esAbOLZU5iW8r21GrRVvBc4eSpND3PISXDj27HRC3ggV5t658C53KNzdNhROyCnsYvMjOEXfTM0jQGn9bGPOObPqAJu/pRDJtNnAPfX1LEyuR8du7ouPJTDuhMVArWh4l+Vx35OmPz6Ch0IDSUT0RyU6DA6PLK/9/ov7IB7MUK194OBWmeMDoDog1BiAh+iyYrFYfFyZIAQrdNMbcw22UjZ2XZh30yn6/cHBOQvth3wZV49Ej1lhLvq/v8PqmuJpBQeuh0FA0c/W6A== 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=H66qGbjV70ou8FWBBgOpLIkBPi9qfcwQl+qUFzfsv6Q=; b=Zha4ZLArmyJxCxY9j9nwZcePGF8N/8zbPLpPAAkD1dFap7gnHWfzLvE52QNn6E/zZvBUvML5Whv3I47A206DIlygbZU5kdacHs56gh2fbO0i4a2BRcJsF4H0472E+AlBIFdYSoPoitrHfR7Cj6HV/8eLNZOmt9kfjPSBuzkRdedioDCDvSw9N4KColxsUfxVVMRhu9OC1+J/yoFndHKVEXyN5tfApJ8Xa7vav9hlZkwjuI4UHRG8jn+Ql+MZsq/E2cBXcDpAzDHJd2Bt8po8aUo9zcKLl53iSYRmmLL/msjMwObGFOxxgvnfKWMHXwuQYlgzYMhTcmuddDt5IiAoOw== 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=H66qGbjV70ou8FWBBgOpLIkBPi9qfcwQl+qUFzfsv6Q=; b=xk1jTrMn013Bn9k8xkzEXzsIdbgN2tVfPJ5DxnqxvZSTW4L1SmcOq3KEG/91GQnD3JR1MKTbABb1LgKfs7e9DIC3QNL4SA4loMVxIOvdMeuaccbk639/85WPFUy84UT4C8VUyurS8w3krMhOKUZDtFKYKfHj2ANeK+YERXiduT4= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by PH7PR10MB6602.namprd10.prod.outlook.com (2603:10b6:510:206::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Fri, 21 Jul 2023 09:47:23 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:47:23 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 13/23] metadump: Add support for passing version option Date: Fri, 21 Jul 2023 15:15:23 +0530 Message-Id: <20230721094533.1351868-14-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: SI1PR02CA0009.apcprd02.prod.outlook.com (2603:1096:4:1f7::10) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|PH7PR10MB6602:EE_ X-MS-Office365-Filtering-Correlation-Id: cca85cb1-686c-46ff-dbe9-08db89cf7c09 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I6ZxLwVWHzWIahhly0ftlg/xeva4YEyGnutRIr9iGcFtedApoAzoFYoiM6BtxgfMCGcXCjOi81ZbDO0B6VGCUpDk+wAZ/y7ASkbtxtM0w808UmJQtcvxzrMyiXIm5Z5V1USyAfwM5txJq0bVXqtq0F8MyAm/Th0UgeP7wkP7IDRFOUS7NSyc/ZqIrDAe9PIcp+GpU73TbwLG3zmA10sJF+MY74nrZNpuYyeg1o1W6lan4pY0/DjlvDEBkFmMob6sqFh0kMtJ718cW4FLSNZjFnFYobR/OcZEWSb0bjW3OW1VHWSHrcpeJBBatfp5Nz/hfq0A+w54shESQA0yDed3do5qPziSYfe/uMQc+Y5VQIlnCBsDVNtK5ybIz+qgQybVsfqFFRps9N1JcqTiNty7oVboNs2C0vDo5ykbB29bhuSp0KaBlIzL5NECXelaT0dBTy8PFdjem/q6n9r5PBuzDu0eKuYY2hMFOz/bo0z+wcOPR5koBJruCcRzLZz9iOCIT4xhv0nNDRarirxqV8W9cuZCjkDM2KM5Hu/yvDef67WGMFVgeTCeo5tCVR1II8FG X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(396003)(346002)(366004)(39860400002)(136003)(451199021)(2906002)(83380400001)(2616005)(36756003)(86362001)(38100700002)(1076003)(4326008)(6916009)(316002)(66946007)(66476007)(66556008)(26005)(186003)(41300700001)(6506007)(478600001)(6486002)(6512007)(8936002)(8676002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RjqOeWqQG/c8w1JoLIhliv+9AvO/BeYBxSftNPZemD5wQwDU0gzXtwX54WA8AmHreEBfV0wp2S8vlpqO1mDeMzyYEJjY7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QS53eJRTBxlCB7lNFXw8OwpBKBqwqV+fGI8E9VYnpUV1TKQ2R6+ufzZJ8wIBRQMKs5uwz/UOR6rWrAHk+JjCqXZAB+UVDTNooJOPEVaOvUkeXO0j094xtuiuaeYaalZ8IWjX7xmORBPvyjZdxqhHoCwGsn2Tg/5cfp0TFRzA5mkZBMDW3oRqOQXNSDRO9nGPcK6Qriq+Pt4l16Tk4BCNR1IFK615dfmERhrdqXdO8C0Rn3PBcHN8qoXxbAfyHEGqI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cca85cb1-686c-46ff-dbe9-08db89cf7c09 X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:23.8054 (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: ronyVvD1Ssgawj+WAPvodWjOGIjVTaVCJ0UBM0X054F+37nspW+PZwrmX3J61Vjvv3kg0a2aS5bVum9u25Hr9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6602 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307210087 X-Proofpoint-GUID: YI8exbB85HriFxF4IA3eC6G3zL-00bLk X-Proofpoint-ORIG-GUID: YI8exbB85HriFxF4IA3eC6G3zL-00bLk Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org The new option allows the user to explicitly specify the version of metadump to use. However, we will default to using the v1 format. Signed-off-by: Chandan Babu R --- db/metadump.c | 81 +++++++++++++++++++++++++++++++++++------ db/xfs_metadump.sh | 3 +- man/man8/xfs_metadump.8 | 14 +++++++ 3 files changed, 86 insertions(+), 12 deletions(-) diff --git a/db/metadump.c b/db/metadump.c index 9b4ed70d..9fe9fe65 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -37,7 +37,7 @@ static void metadump_help(void); static const cmdinfo_t metadump_cmd = { "metadump", NULL, metadump_f, 0, -1, 0, - N_("[-a] [-e] [-g] [-m max_extent] [-w] [-o] filename"), + N_("[-a] [-e] [-g] [-m max_extent] [-w] [-o] [-v 1|2] filename"), N_("dump metadata to a file"), metadump_help }; struct metadump_ops { @@ -74,6 +74,7 @@ static struct metadump { bool zero_stale_data; bool progress_since_warning; bool dirty_log; + bool external_log; bool stdout_metadump; xfs_ino_t cur_ino; /* Metadump file */ @@ -107,6 +108,7 @@ metadump_help(void) " -g -- Display dump progress\n" " -m -- Specify max extent size in blocks to copy (default = %d blocks)\n" " -o -- Don't obfuscate names and extended attributes\n" +" -v -- Metadump version to be used\n" " -w -- Show warnings of bad metadata information\n" "\n"), DEFAULT_MAX_EXT_SIZE); } @@ -2909,8 +2911,20 @@ copy_log(void) print_progress("Copying log"); push_cur(); - set_cur(&typtab[TYP_LOG], XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart), - mp->m_sb.sb_logblocks * blkbb, DB_RING_IGN, NULL); + if (metadump.external_log) { + ASSERT(mp->m_sb.sb_logstart == 0); + set_log_cur(&typtab[TYP_LOG], + XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart), + mp->m_sb.sb_logblocks * blkbb, DB_RING_IGN, + NULL); + } else { + ASSERT(mp->m_sb.sb_logstart != 0); + set_cur(&typtab[TYP_LOG], + XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart), + mp->m_sb.sb_logblocks * blkbb, DB_RING_IGN, + NULL); + } + if (iocur_top->data == NULL) { pop_cur(); print_warning("cannot read log"); @@ -3071,6 +3085,8 @@ init_metadump_v2(void) compat_flags |= XFS_MD2_INCOMPAT_FULLBLOCKS; if (metadump.dirty_log) compat_flags |= XFS_MD2_INCOMPAT_DIRTYLOG; + if (metadump.external_log) + compat_flags |= XFS_MD2_INCOMPAT_EXTERNALLOG; xmh.xmh_compat_flags = cpu_to_be32(compat_flags); @@ -3131,6 +3147,7 @@ metadump_f( int outfd = -1; int ret; char *p; + bool version_opt_set = false; exitcode = 1; @@ -3142,6 +3159,7 @@ metadump_f( metadump.obfuscate = true; metadump.zero_stale_data = true; metadump.dirty_log = false; + metadump.external_log = false; if (mp->m_sb.sb_magicnum != XFS_SB_MAGIC) { print_warning("bad superblock magic number %x, giving up", @@ -3159,7 +3177,7 @@ metadump_f( return 0; } - while ((c = getopt(argc, argv, "aegm:ow")) != EOF) { + while ((c = getopt(argc, argv, "aegm:ov:w")) != EOF) { switch (c) { case 'a': metadump.zero_stale_data = false; @@ -3183,6 +3201,17 @@ metadump_f( case 'o': metadump.obfuscate = false; break; + case 'v': + metadump.version = (int)strtol(optarg, &p, 0); + if (*p != '\0' || + (metadump.version != 1 && + metadump.version != 2)) { + print_warning("bad metadump version: %s", + optarg); + return 0; + } + version_opt_set = true; + break; case 'w': metadump.show_warnings = true; break; @@ -3197,12 +3226,42 @@ metadump_f( return 0; } - /* If we'll copy the log, see if the log is dirty */ - if (mp->m_sb.sb_logstart) { + if (mp->m_logdev_targp->bt_bdev != mp->m_ddev_targp->bt_bdev) + metadump.external_log = true; + + if (metadump.external_log && !version_opt_set) + metadump.version = 2; + + if (metadump.version == 2 && mp->m_sb.sb_logstart == 0 && + !metadump.external_log) { + print_warning("external log device not loaded, use -l"); + return -ENODEV; + } + + /* + * If we'll copy the log, see if the log is dirty. + * + * Metadump v1 does not support dumping the contents of an external + * log. Hence we skip the dirty log check. + */ + if (!(metadump.version == 1 && metadump.external_log)) { push_cur(); - set_cur(&typtab[TYP_LOG], - XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart), - mp->m_sb.sb_logblocks * blkbb, DB_RING_IGN, NULL); + if (metadump.external_log) { + ASSERT(mp->m_sb.sb_logstart == 0); + set_log_cur(&typtab[TYP_LOG], + XFS_FSB_TO_DADDR(mp, + mp->m_sb.sb_logstart), + mp->m_sb.sb_logblocks * blkbb, + DB_RING_IGN, NULL); + } else { + ASSERT(mp->m_sb.sb_logstart != 0); + set_cur(&typtab[TYP_LOG], + XFS_FSB_TO_DADDR(mp, + mp->m_sb.sb_logstart), + mp->m_sb.sb_logblocks * blkbb, + DB_RING_IGN, NULL); + } + if (iocur_top->data) { /* best effort */ struct xlog log; @@ -3278,8 +3337,8 @@ metadump_f( if (!exitcode) exitcode = !copy_sb_inodes(); - /* copy log if it's internal */ - if ((mp->m_sb.sb_logstart != 0) && !exitcode) + /* copy log */ + if (!exitcode && !(metadump.version == 1 && metadump.external_log)) exitcode = !copy_log(); /* write the remaining index */ diff --git a/db/xfs_metadump.sh b/db/xfs_metadump.sh index 9852a5bc..9e8f86e5 100755 --- a/db/xfs_metadump.sh +++ b/db/xfs_metadump.sh @@ -8,7 +8,7 @@ OPTS=" " DBOPTS=" " USAGE="Usage: xfs_metadump [-aefFogwV] [-m max_extents] [-l logdev] source target" -while getopts "aefgl:m:owFV" c +while getopts "aefgl:m:owFv:V" c do case $c in a) OPTS=$OPTS"-a ";; @@ -20,6 +20,7 @@ do f) DBOPTS=$DBOPTS" -f";; l) DBOPTS=$DBOPTS" -l "$OPTARG" ";; F) DBOPTS=$DBOPTS" -F";; + v) OPTS=$OPTS"-v "$OPTARG" ";; V) xfs_db -p xfs_metadump -V status=$? exit $status diff --git a/man/man8/xfs_metadump.8 b/man/man8/xfs_metadump.8 index c0e79d77..1732012c 100644 --- a/man/man8/xfs_metadump.8 +++ b/man/man8/xfs_metadump.8 @@ -11,6 +11,9 @@ xfs_metadump \- copy XFS filesystem metadata to a file ] [ .B \-l .I logdev +] [ +.B \-v +.I version ] .I source .I target @@ -74,6 +77,12 @@ metadata such as filenames is not considered sensitive. If obfuscation is required on a metadump with a dirty log, please inform the recipient of the metadump image about this situation. .PP +The contents of an external log device can be dumped only when using the v2 +format. +Metadump in v2 format can be generated by passing the "-v 2" option. +Metadump in v2 format is generated by default if the filesystem has an +external log and the metadump version to use is not explicitly mentioned. +.PP .B xfs_metadump should not be used for any purposes other than for debugging and reporting filesystem problems. The most common usage scenario for this tool is when @@ -134,6 +143,11 @@ this value. The default size is 2097151 blocks. .B \-o Disables obfuscation of file names and extended attributes. .TP +.B \-v +The format of the metadump file to be produced. +Valid values are 1 and 2. +The default metadump format is 1. +.TP .B \-w Prints warnings of inconsistent metadata encountered to stderr. Bad metadata is still copied. From patchwork Fri Jul 21 09:45:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Babu R X-Patchwork-Id: 13321749 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 20AB8EB64DC for ; Fri, 21 Jul 2023 09:49:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231800AbjGUJtA (ORCPT ); Fri, 21 Jul 2023 05:49:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231887AbjGUJsb (ORCPT ); Fri, 21 Jul 2023 05:48:31 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9432830F3 for ; Fri, 21 Jul 2023 02:47:55 -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 36KLMZ7f006783; Fri, 21 Jul 2023 09:47:35 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=Eo2H4ZdqcZj1h9U9KJV5dXdRK4RG40qHiLn0E+r57ns=; b=b9+tiBD7+UdwsjhKIjgfR3gvihJ4KQosWar0kywW6A5brYjmo36JND3UNiowMahzjmXi PaBvTXcA1Xu75Jjf+ybDys19CpxgwBpPVypTxyBsqXIxiNU/cpWRmXm7LgoTExOAeG4+ uE0qdRI1DMOFR319nTWZQ8C2uANKLrCb0n/RTkPRqV/HKhzLM9eetcRKUNXO2ZelBM0H kuihienU4t6XpEYF0D3hXZKV4SyvtwCfPSz2Y01dxoJMWvK9LsztRxuyuj72iH/YnpLP Fmrrut3SZaA6+KIpnEFMcvfGx4jWnucsuC3+lwzyH3XPHeyntkjexke0q2LiDAG+SdKI 0Q== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run78bdth-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:47:34 +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 36L9KtJn019174; Fri, 21 Jul 2023 09:47:33 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2109.outbound.protection.outlook.com [104.47.58.109]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhwa927p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jul 2023 09:47:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aP1NWqdVorwg+esOdjnz9IXOhPKcnfVlVCPy1ekigjoQ9E5V7Hq3lKIbexc72REI4Bwwr9f0978WhrkEFUBm+xL8I6pXeFRuapCJqL9j2VyxQ4wmdnt7W/Hu4ExTn8tG5NuYWLVdyxN6ISsm2HyMp+fKU4z68Z0koJnAk9I4S7WR35UKLI7o5lZwm674Ld/2Al7oEpLWIUdYAnthUynvbp/jSXkix4OXmaoc7Sh2bXL0u4e2JDk93uV3ePD3Wd/ajEjRC/4wjnJuGhttVUE36UpxTNgguVw+9bLKVtpQjxgCS+/fv03onIRBabN0hGaD4mJoDHhUTwiSkctPxCDSXA== 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=Eo2H4ZdqcZj1h9U9KJV5dXdRK4RG40qHiLn0E+r57ns=; b=YNdTKE6/IDXJFJVj6xaSDxcJLU90zEgOEUYzUnKb6OV6Nu/FJ8jYiUIieDEBi88zR+gocaHAIAFwdF25JISp1wOw+D9bc8gpfFewZKOfpXAH54v4ZWkhXlxJ2j+LY9oa88/tcATN4GTuUiAvBDt5ZRp7vxrNfPrbu4MTs7eER27hFAfnSUPVvy/B5IYNiLxL0ME7Fieh/e+uZEfZM+J//KOkLb74c1z9zwnzQvASOcnXnp49V4x+9j/VAVfdmYKFASZhXU7jDTDxPK39UEUgnX0lczG/aeuS+4g54pXwJdueV7wdtALbdTQIGVX4Zps35x1ooIRjOxSK7St6fWhVeg== 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=Eo2H4ZdqcZj1h9U9KJV5dXdRK4RG40qHiLn0E+r57ns=; b=fyx161oNbi0bvYTyjkFm+tSNHpEomtOiNv766jMnTttfdjIobcwEK5Qr7EdP0dRXwPxF8vUhwUsP/BeOBffXLVUhXfRdqjnoi3FEDW9AcNHZXAvcCcCGu+jZC/wXWpTIrnPSPRiMFZt8GwJDZrQO2Qkaz/IMZpLAPlueQqK8wsY= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by PH7PR10MB6602.namprd10.prod.outlook.com (2603:10b6:510:206::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Fri, 21 Jul 2023 09:47:31 +0000 Received: from SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0]) by SA1PR10MB5867.namprd10.prod.outlook.com ([fe80::707c:5a02:87a1:38e0%3]) with mapi id 15.20.6609.024; Fri, 21 Jul 2023 09:47:31 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 14/23] mdrestore: Declare boolean variables with bool type Date: Fri, 21 Jul 2023 15:15:24 +0530 Message-Id: <20230721094533.1351868-15-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230721094533.1351868-1-chandan.babu@oracle.com> References: <20230721094533.1351868-1-chandan.babu@oracle.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|PH7PR10MB6602:EE_ X-MS-Office365-Filtering-Correlation-Id: 82b690aa-d6f8-4cb3-17dd-08db89cf80d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qaVVbbNShGgsSUnFpRjI6QGLoOoRYTvETwCkbDwOoShaZv2lWqpfJKgS8zxbm0GXVGrZ1ZFasGnwfvHlW58VYavjCVhHtLxP8grjUaLUkmJB6xkzk5nCJ4/1c7gd2/aRjB6njcivlxsQ8kmcJ8WB9qtztLGzFP5vJj9HSIpfjBAEZHt0GG/4SwPaAPv+ZjhCY0AQW0U7V91EW1NN2q6BKudUaeTlvix6YzCjNs9k0Oapu3lSk7DhYaZYpEwFjQU6SSmVMgDUO73AXUJg69eXjyAQIUlslUgAMfauCOxfGej3bPSqZXXKTRl1TIHATjGUVAc5DRs/Z0Dltbo3NfzYsIO25p01yPej4xiedrG6yvWtc+INVe2eoR9WKYCHmiK7lT20HO+3QoGDL9E0CZpSHT7G3EE7IG6fSu7MY9oAVMfMm1EnDxSk0ZrwDOGBrdsXR7cqqxlp+yicNm1QJz6R3v1y/t4/k7+zsI1nJueRZzP3OtZVpqt2jmLFJVf8QOymYWo0w/ksHzzDoGRcMl8raJkbRmP5a+9apsbGmZDXsIS4YhbZm4ZXFJLF2BVOejNe X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR10MB5867.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(396003)(346002)(366004)(39860400002)(136003)(451199021)(2906002)(83380400001)(2616005)(36756003)(86362001)(38100700002)(1076003)(4326008)(6916009)(316002)(66946007)(66476007)(66556008)(26005)(186003)(41300700001)(6506007)(478600001)(6666004)(6486002)(6512007)(8936002)(8676002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TYAm25LMhuy/zUAs0y2Q2g4CH0jD7hfZTN7WOsuLa7jhYInGsD03z34lR9r9UBgb6D8UVWX7PgZTi9HP64xigd9zd4ax9S9hgdxQQI0y80QYkDxbzhn1SjUwEznJh24tymjJ9ksVX1jF1BjrlfsAH6Lu/EVEoLdIS8zmrYQSGSWo8wqPcE3dZCiEptkmPgA/UrDA7uic1PPElRXNpLOI9eWFtGSxpxtkGoIU7dRlvkchpm5/zCDcjLuRv8xSkKoeX8VqWcnXcdVdRDapGeebGY3FcD37mZbRf0pI2TzkC8rmQfirK/FpvyZ2Vkw0CC9EY6KrOMQFCOxpFygynXVZuYi9Uziw8YKFTI2KZzv5xTZImjatfzb0qBJIkRPnswApsTk/z4J98iuuHFBpzA3FyKBPe7b/RdK+3yVXtxgKIuE9uIcvJrWnxAyIGebFdf4xNAKLgeoUp6c5rJS8Rnj85VwTuoa1lvaXBgFW8s1wA2svj2tPbqT8N8wvmx389DLqRIEdyEuK5VEnL8KoWmkIJLKanUiKBOnKiK53jQ+FvLhtClLFLlRYLKMO0QyWjPokSqmzS0ATBEpTZRW8RWxD3FOMeSySeo2dLIqMqUEC265+zijl2sF70IQ+r0rUe5GmLUZAX8nPZ9mq99PqUFi4WJbfxpmqMKwXebADlnMspLsnqNmhRBFzvdOtseFjctuz8AwjT2AnXAUbnrqgQ9dovCV1eUW5Tr69DtmSV4E06qpPTMDf/X55vZoNSPfsAtEFHJzdBIdRJrL6YZJt2m9bxlaVYSjN7Pq09ZdDGJXUJuZ2r48i3OwCoqE45YcfRyJUzx2m61xx06o7k4IHybVKoUibSwiztMdzX5lx+C+Xms6NY9kU9gvY7Gnfrdf40/yXpyMZ7OXMaoraSOsiNKyLCrSRG/7M2CEwBK2LtCF3BwFXbTth3njjQTpfOSqArKnI7PCbpxw8MVTflyOt+Mk1Nht9qURind70nmYusE4UK8b02+rhOhi+kHcpMtW1fTjgM41llr0tPiUYhiTNi8mO8E4opt65O6JjrCyEG0ocsu5faNjklZWn93IYUvVU+zWZvOKL/9NvGivDSToboXPtbWCZE0qaqLoY9ILe2nhQQvv84ZyW2arLjdbLqGRJzlXY2KQgR1Bn8z+0QbokJCMrz1l7/QzDbu3TqNOeF8E2cOprjjK/GKrG9WZ+zm3eKphFBQUNnlppXev2AxXg8DJCjmCctub9CJqKK6BPaLoWPK8fIW8BpwOepHOQpJ75wzyuHawpPWpNt18sQGeU6x8eO0UrwFjscMFZ1b4O0kgI1PEDNiB1te/uFPxjW/vsHTUcEhbrNRgO1EL/SBOCBDrMG7o8Yx06hNOf11QvwRdYlT5sTly/4HuqeZgXgVqRuEHAVWEqsjolk0z4eN28Y3WO0IiB/NBPEmY6C0bpeFM44ZsHfQX7mGCX/IiiAqWelIY6pRWUKSrAFETwlRLFyww3I0A5EgzirNYHw4GQkGqed9parjwap7/F/1o28+AVD9wJFJKpIPQAboF1vrfhVMOy93xLarruDZl9FXumiH5Wkpmb9yTrPalu3tcHkeyoY6qrDvmN9hRr1QxCdbmSvmt93g== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: SOpnyGxdOeeituf47yDnzP8GJoGH1h6uG8TZwzm2/p56tTRyoO71ULU940VaB5bXLYva2Oz7GXGiFRlF8HmFUgbdyA+qyKncWRccLRvsK6SKVzpZF1I9j2dfNHIyqbV1llTMyNkxa6/+PBOs7SIZxYTzoAw0umhgXVrfsIhSc0/IJAD16d3zz3umk+WlvvUds3Aso+a4tPmLlkAROQCM0PJkWRWOTKusiDDKRSCZIK1CLpzm/LUhSc19wflsu0iLA9TgCkfOb0wcjOS/nf9YMJI4edYncGldtpaGu331js64Hi8JgaaWbgMJsEC6WltReS/VcK/TyT1XDZ2vNuig/XG512/bkVpNjFayX79cDT9P1h79WNlFapArLM4GensJzY9IgIxBZd7YbirnkRWOGJltnkWMNPZ7+CiDrtpAqEdBG5hJZ7NM+PNERXEuqNAAurdQAz/4Y1pChnfmV5Bug2NPlL9GG8ZyVEbQpA6VY87dM5AXgSvhghM6LobRj8zZUY60n94wOXIRW5pAflRydf6DCmEtXm8sF6NgBlG7avQfz80bOeYPJFJVVNjERg7J2Xvbw9bFMkJzwf1M9QLr5YbYNfb/eLt/pDTcmTfi1diDobLlcs+j0k8eAgzuSk6tEgldL1VCpBtcJl57fMfqFJtKjsitD+S850mUvu5PojR4ex5gexsDI77Mf8qen+dIR4PrZR+pbJ8EsAJHxjBxzOw283yPP7H5IIurgtfp20SIVf/JzFKKMnY2IGYLIY9ty91MU64hcVJCq5rIaMG8CmoQUoiAf3+ntR1vIm3nQlE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82b690aa-d6f8-4cb3-17dd-08db89cf80d3 X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:31.8238 (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: ZCzfCx6d3SAgJNAg6PiiwSGltNOtHvzdaghccmNaW+q7MVtogwoiYSUt8lt+jX+Gqe5780H5Vt2iAfliACJpXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6602 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-21_06,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=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-2306200000 definitions=main-2307210087 X-Proofpoint-ORIG-GUID: DV0W9a-mbOqEhRKRIYkh427eYVT_3lFe X-Proofpoint-GUID: DV0W9a-mbOqEhRKRIYkh427eYVT_3lFe Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R --- mdrestore/xfs_mdrestore.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c index 481dd00c..ca28c48e 100644 --- a/mdrestore/xfs_mdrestore.c +++ b/mdrestore/xfs_mdrestore.c @@ -7,9 +7,9 @@ #include "libxfs.h" #include "xfs_metadump.h" -static int show_progress = 0; -static int show_info = 0; -static int progress_since_warning = 0; +static bool show_progress = false; +static bool show_info = false; +static bool progress_since_warning = false; static void fatal(const char *msg, ...) @@ -35,7 +35,7 @@ print_progress(const char *fmt, ...) printf("\r%-59s", buf); fflush(stdout); - progress_since_warning = 1; + progress_since_warning = true; } /* @@ -202,10 +202,10 @@ main( while ((c = getopt(argc, argv, "giV")) != EOF) { switch (c) { case 'g': - show_progress = 1; + show_progress = true; break; case 'i': - show_info = 1; + show_info = true; break; case 'V': printf("%s version %s\n", progname, VERSION);