]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
mdrestore: Add support for passing log device as an argument
authorChandan Babu R <chandan.babu@oracle.com>
Mon, 6 Nov 2023 13:10:54 +0000 (18:40 +0530)
committerCarlos Maiolino <cem@kernel.org>
Tue, 21 Nov 2023 13:09:36 +0000 (14:09 +0100)
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" <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
man/man8/xfs_mdrestore.8
mdrestore/xfs_mdrestore.c

index 72f3b297787b70af9a326298f749944313e62006..6e7457c044565657b53fb63b43f15682d1f41304 100644 (file)
@@ -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
index 105a2f9e9c6cfcfd4c0715db5ff8bf6c9173e56d..2de177c6e3f1a76edaef87d2246bfe473018a075 100644 (file)
@@ -459,7 +459,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);
 }
 
@@ -484,7 +485,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;
@@ -492,6 +493,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);
@@ -528,6 +533,8 @@ main(
 
        switch (be32_to_cpu(headers.magic)) {
        case XFS_MD_MAGIC_V1:
+               if (logdev != NULL)
+                       usage();
                mdrestore.mdrops = &mdrestore_ops_v1;
                break;