Re: [PATCH 1/2] xfs_logprint: print misc buffers when using -o

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

 



On Thu, Jan 28, 2021 at 06:37:07PM +1100, Donald Douwsma wrote:
> Logprint only dumps raw buffers for unhandled misc buffer types, but
> this information is generally useful when debugging logprint issues so
> allow it to print whenever -o is used.
> 
> Switch to using the common xlog_print_data function to dump the buffer.
> 
> Signed-off-by: Donald Douwsma <ddouwsma@xxxxxxxxxx>
> ---
>  logprint/log_misc.c      | 19 +++----------------
>  logprint/log_print_all.c |  2 +-
>  2 files changed, 4 insertions(+), 17 deletions(-)
> 
> diff --git a/logprint/log_misc.c b/logprint/log_misc.c
> index c325f046..d44e9ff7 100644
> --- a/logprint/log_misc.c
> +++ b/logprint/log_misc.c
> @@ -392,23 +392,10 @@ xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops)
>  		}
>  	} else {
>  		printf(_("BUF DATA\n"));
> -		if (print_data) {
> -			uint *dp  = (uint *)*ptr;
> -			int  nums = be32_to_cpu(head->oh_len) >> 2;
> -			int  byte = 0;
> -
> -			while (byte < nums) {
> -				if ((byte % 8) == 0)
> -					printf("%2x ", byte);
> -				printf("%8x ", *dp);
> -				dp++;
> -				byte++;
> -				if ((byte % 8) == 0)
> -					printf("\n");
> -			}
> -			printf("\n");
> -		}

Nitpicking: One patch to collapse this into a xlog_recover_print_data
call as a no-functional-changes cleanup, then a second patch to make the
buffer dumps happen any time -D or -o are specified.

TBH the sb/agheader decoders probably need some serious updating to
handle newer fields.  It's also unfortunate that xfs_db doesn't know how
to decode log buffers; adding such a thing would be a neat way to enable
targetted fuzzing of log recovery.

--D

>  	}
> +
> +	xlog_recover_print_data(*ptr, be32_to_cpu(head->oh_len));
> +
>  	*ptr += be32_to_cpu(head->oh_len);
>      }
>      if (head && head->oh_flags & XLOG_CONTINUE_TRANS)
> diff --git a/logprint/log_print_all.c b/logprint/log_print_all.c
> index eafffe28..2b9e810d 100644
> --- a/logprint/log_print_all.c
> +++ b/logprint/log_print_all.c
> @@ -176,8 +176,8 @@ xlog_recover_print_buffer(
>  		} else {
>  			printf(_("	BUF DATA\n"));
>  			if (!print_buffer) continue;
> -			xlog_recover_print_data(p, len);
>  		}
> +		xlog_recover_print_data(p, len);
>  	}
>  }
>  
> -- 
> 2.27.0
> 



[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