Re: [PATCH 23/24] mdrestore: Add support for passing log device as an argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 23, 2023 at 02:30:49PM +0530, Chandan Babu R wrote:
> 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.
> 
> Signed-off-by: Chandan Babu R <chandan.babu@xxxxxxxxxx>
> ---
>  mdrestore/xfs_mdrestore.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c
> index 9e06d37dc..f5eff62ef 100644
> --- a/mdrestore/xfs_mdrestore.c
> +++ b/mdrestore/xfs_mdrestore.c
> @@ -427,7 +427,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);
>  }
>  
> @@ -453,7 +454,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 = 1;
> @@ -461,6 +462,9 @@ main(
>  			case 'i':
>  				mdrestore.show_info = 1;
>  				break;
> +			case 'l':
> +				logdev = optarg;
> +				break;
>  			case 'V':
>  				printf("%s version %s\n", progname, VERSION);
>  				exit(0);
> @@ -493,6 +497,8 @@ main(
>  	}
>  
>  	if (mdrestore_ops_v1.read_header(&mb, src_f) == 0) {
> +		if (logdev != NULL)
> +			usage();
>  		mdrestore.mdrops = &mdrestore_ops_v1;
>  		header = &mb;
>  	} else if (mdrestore_ops_v2.read_header(&xmh, src_f) == 0) {

What if we have a v2 with XME_ADDR_LOG_DEVICE meta_extents but the
caller doesn't specify -l?  Do we proceed with the metadump, only to
fail midway through the restore?

--D

> -- 
> 2.39.1
> 



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux