Re: [PATCH 1/3] common/punch: fix flags printing for filter _filter_fiemap_flags

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



On Mon, Oct 31, 2022 at 11:11:19AM +0000, fdmanana@xxxxxxxxxx wrote:
> From: Filipe Manana <fdmanana@xxxxxxxx>
> 
> In the filter _filter_fiemap_flags, if we get a flags field that only has
> the 'last' flag set, we end up printing the string "nonelast", which is
> ugly and not intuitive.
> 
> For example:
> 
>   $XFS_IO_PROG -f -c "pwrite 0 64K" $SCRATCH_MNT/foo > /dev/null
>   $XFS_IO_PROG -c "fiemap -v" $SCRATCH_MNT/foo | _filter_fiemap_flags
> 
> Gives:
> 
>   0: [0..127]: nonelast
> 
> So fix this by updating the filter's awk code to reset the flags string to
> an empty string if we have the "last" flag set and we haven't updated the
> flags string before. So now the same test gives the following result:
> 
>   0: [0..127]: last
> 
> Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx>
> ---
>  common/punch | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/common/punch b/common/punch
> index 47a29c92..94599c35 100644
> --- a/common/punch
> +++ b/common/punch
> @@ -130,6 +130,8 @@ _filter_fiemap_flags()
>  			if (and(flags, 0x1)) {
>  				if (set) {
>  					flag_str = flag_str"|";
> +				} else {
> +					flag_str = "";

Looks good to me.

We have two cases (g/352, g/353) call this function, I just gave them a test,
looks like this change doesn't affect them.

Reviewed-by: Zorro Lang <zlang@xxxxxxxxxx>

>  				}
>  				flag_str = flag_str"last";
>  			}
> -- 
> 2.35.1
> 




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux