From patchwork Mon Jul 24 04:35:27 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: 13323440 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 AD4BAEB64DD for ; Mon, 24 Jul 2023 04:39:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229572AbjGXEj0 (ORCPT ); Mon, 24 Jul 2023 00:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjGXEjZ (ORCPT ); Mon, 24 Jul 2023 00:39:25 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9DB3122 for ; Sun, 23 Jul 2023 21:39:24 -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 36NMan1J018630; Mon, 24 Jul 2023 04:39: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=SIU9hbnyPKO4rmv2bFc88tWCvlQ563t9f31OOptKbTQ=; b=GWgkis5XrjfsXezZFabaSfzqTYA4qqKuT10Wpqwib+nv07uQ0MBo2o6QpcNuhurZc7HH +pyXi2LZYmIU7ofuMRNaFYYDTuAqydWSlXALFocCus4EOJUf3FvF/utShT+jyi3hP441 tHFiY8exnLdsnjc7jfnDtU5qEszp7Hf+hCa8m8iRIMYkHcMTNXPtOrlSz2pnx2+UtifL 9tBSNtBRX77Wvg4M7sIgQIWxma15iTQoCK6QNWGHy3rzL0m/byGpTAqpbssePZ06eQ+8 41wGkgG/W6XvZAcIm1byp0c8Ie36lOSlGO2tucZSngt3oStLJgI74amQe8/ZJgUDx6id Sw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s07nuhsp4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jul 2023 04:39:22 +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 36O0r7T6000494; Mon, 24 Jul 2023 04:39:11 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3s05j3eaym-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jul 2023 04:39:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JJXessMCLMVA+s19MWFuHOgR5spSRW65OXRNyWFv4Cuc2K8R7Cei/4cT1x9oU+Jkka3WeQVWeJqH5/jIZsTiu+MDtSWW9HmSIE0bwT1oOwrOx/hr1T1ZI0CWBpCYwvwZFxpJmQCiVo3FQEOc7Kt38m6Ek2qAia3hO1nFgoWxZoJS8U5yobF7lmOaCN2kxefxC9iFbG8zmezF0mXLelCZTcPn9Qg9ze1vePSXKDYuY8KlMNtMqeGDQ4tRpCv2ldWmanFabRAqsZ2lFNUNaIPQczaOvgOKp9XVjG7MNmSYUAfuBtfiChODTOLWr8uyg8mvkqjZ2UtvFUfXDHn8vwKXoQ== 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=SIU9hbnyPKO4rmv2bFc88tWCvlQ563t9f31OOptKbTQ=; b=ORt8DYrkjzU+oRASd1Pq07p0uY8BFbHWsObDpIOoNBGDz+xcjszuGXGR9F8sXi4NN9gVhHyzABMLDynVd+qWi6rBhsIwq1M05wcpKIdnSVY3ImlCagdLjfMmUVv1baT1n3lNHpfn6TDDtf/VIx8p7I4xItyxN3bOG7kfgei09hZXTVu6YBEYL/LApuGO7kD5RYpAEy4xTSkSoHFXrnz2nyXvutwLvIkxewj+hi7bte/eMUUgJY7fpwMjRgncsJD5mjDulTDb+XGK1XDY+bMLbY11An6dL8l5Q08DkZmUvoGDm8rNc1Yj535l5RjCNq2R0N7XlaJgO9OFl7h34xH4bQ== 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=SIU9hbnyPKO4rmv2bFc88tWCvlQ563t9f31OOptKbTQ=; b=KCpQtxc0gnEJeUJON026g4rqhbTYg3gxT8ssGTuTjVUUrhGuRdO5d4gyt4DmED1LgmLTAKaOW2hX6KMGjSA0219wpUcYjndIYotF4W6uBkzzTdI8mpTJYGrVsVPxB9uG9rGijOjWMGlrEUHhU6XI2l4nM4sOfS1vO44MLrzQqXs= Received: from SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) by BLAPR10MB4963.namprd10.prod.outlook.com (2603:10b6:208:326::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.32; Mon, 24 Jul 2023 04:39:09 +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.031; Mon, 24 Jul 2023 04:39:09 +0000 From: Chandan Babu R To: linux-xfs@vger.kernel.org Cc: Chandan Babu R , djwong@kernel.org, cem@kernel.org Subject: [PATCH V3 23/23] mdrestore: Add support for passing log device as an argument Date: Mon, 24 Jul 2023 10:05:27 +0530 Message-Id: <20230724043527.238600-24-chandan.babu@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230724043527.238600-1-chandan.babu@oracle.com> References: <20230724043527.238600-1-chandan.babu@oracle.com> X-ClientProxiedBy: SI1PR02CA0035.apcprd02.prod.outlook.com (2603:1096:4:1f6::8) To SA1PR10MB5867.namprd10.prod.outlook.com (2603:10b6:806:233::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR10MB5867:EE_|BLAPR10MB4963:EE_ X-MS-Office365-Filtering-Correlation-Id: 97b2c88b-8969-4659-7d7b-08db8bffebe4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hYBRQtxJli+I+dxxYEXQAZ2j/vYDWATiaFTpstUdrWz6HokdBWKojevQLQuEJIz7hGMcwrApV2aj4YBPDT0Erx4gy0Ee63gT3daqAjizcaWq7p+6Npo2awYtgQJhAhTwK5k/tm8GpFPL5vtNTE0VxnLPAeXFjAxXpUo4foxdu66RmOKvke03+t7BWMnTSap+j1d5Q7CE3wfTFRUm/llj2WCzgF9a5JoqdBOFPbGWK9VMmvxbH1qFrjIUAWv4iJk0NocT32qvGf2/gTULGqe7XG7ylEzgzZ/sgv+H+wB1iadZs57edV5ymPjdQRXGD+DKPqqIGOXmTv66rTVpAIUErJ1rJst2YJnGB/cbyEIE2Uwt1FfaWPxuchZV87tmC1vvsf+6hg3c0cKXh7QUXDNyl4UTvt8WcDOhZIei+09F/9/u1LYf4OjU+Amu4Sqct1NAYZ1gL3iN46QBe336W56WX5fo7UJ/+1NNRJO807u74dAWQCKx7h869194JNBoSw/CabBDxSlq5fHTT1bJIendmcne/PzSi6HIALxdrOUrnys9IWanLrncA+UxY4K4nWtN 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)(396003)(346002)(376002)(39860400002)(136003)(366004)(451199021)(2906002)(66946007)(66556008)(66476007)(4326008)(6916009)(6486002)(6666004)(478600001)(86362001)(6512007)(83380400001)(36756003)(186003)(2616005)(26005)(1076003)(6506007)(38100700002)(41300700001)(8936002)(8676002)(5660300002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3E/ZGdqvZr8ybyhsiBSh+wecVc+ltUwy/hd5j9xoAs7Tt1kzVjldqd6wlT/PBf+PrBFjY/VNQIrU2lrHCZduJ8sYp0lqxwnq4DZzlGB525E1dA/N4zkfxesEK5ttTZqS8VRgUSdFCOOYdmP/FYqGAtqyhAAJ1RFWqYce9bzRnMcMxR+VyJCS41WRogItsSZ+HBi857qihBM7Zo5VxipyvLPgBL3lju7QMMqTkmKg0xQ1AUph2pjd/EHHh85Y10MtiUatxh1imSoYds4g21z6Az+We9q+kI7e1JDrMo8YQGaN7nKqc7WDvEppLilUWiBdV9nFlUgTp+C6F0NfG/aeEFJXP8qemuEvMs8vlVYa13BmjeMZANEBmSTRl1Oxl5fRa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ant-Network-Message-Id: 97b2c88b-8969-4659-7d7b-08db8bffebe4 X-MS-Exchange-CrossTenant-AuthSource: SA1PR10MB5867.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2023 04:39:09.6784 (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: JWDkqtlmYeQbKvqxeBQBXkpuN3MwdJGZK/svRxxfCE8dpRbV6ATeOK4CyH4Qg2ZDt1x/8qPXVHtgkuFn/5lEvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4963 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-24_03,2023-07-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307240042 X-Proofpoint-ORIG-GUID: hgpgd6nBcPmFwldVNQgHIY7PYnVwWacH X-Proofpoint-GUID: hgpgd6nBcPmFwldVNQgHIY7PYnVwWacH Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org metadump v2 format allows dumping metadata from external log devices. This commit allows passing the device file to which log data must be restored from the corresponding metadump file. Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R --- man/man8/xfs_mdrestore.8 | 8 ++++++++ mdrestore/xfs_mdrestore.c | 11 +++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/man/man8/xfs_mdrestore.8 b/man/man8/xfs_mdrestore.8 index 72f3b297..6e7457c0 100644 --- a/man/man8/xfs_mdrestore.8 +++ b/man/man8/xfs_mdrestore.8 @@ -5,6 +5,9 @@ xfs_mdrestore \- restores an XFS metadump image to a filesystem image .B xfs_mdrestore [ .B \-gi +] [ +.B \-l +.I logdev ] .I source .I target @@ -49,6 +52,11 @@ Shows metadump information on stdout. If no is specified, exits after displaying information. Older metadumps man not include any descriptive information. .TP +.B \-l " logdev" +Metadump in v2 format can contain metadata dumped from an external log. +In such a scenario, the user has to provide a device to which the log device +contents from the metadump file are copied. +.TP .B \-V Prints the version number and exits. .SH DIAGNOSTICS diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c index 85a61c8b..beb23489 100644 --- a/mdrestore/xfs_mdrestore.c +++ b/mdrestore/xfs_mdrestore.c @@ -453,7 +453,8 @@ static struct mdrestore_ops mdrestore_ops_v2 = { static void usage(void) { - fprintf(stderr, "Usage: %s [-V] [-g] [-i] source target\n", progname); + fprintf(stderr, "Usage: %s [-V] [-g] [-i] [-l logdev] source target\n", + progname); exit(1); } @@ -478,7 +479,7 @@ main( progname = basename(argv[0]); - while ((c = getopt(argc, argv, "giV")) != EOF) { + while ((c = getopt(argc, argv, "gil:V")) != EOF) { switch (c) { case 'g': mdrestore.show_progress = true; @@ -486,6 +487,10 @@ main( case 'i': mdrestore.show_info = true; break; + case 'l': + logdev = optarg; + mdrestore.external_log = true; + break; case 'V': printf("%s version %s\n", progname, VERSION); exit(0); @@ -522,6 +527,8 @@ main( switch (be32_to_cpu(headers.magic)) { case XFS_MD_MAGIC_V1: + if (logdev != NULL) + usage(); mdrestore.mdrops = &mdrestore_ops_v1; break;