]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commit
common/punch: fix flags printing for filter _filter_fiemap_flags
authorFilipe Manana <fdmanana@suse.com>
Mon, 31 Oct 2022 11:11:19 +0000 (11:11 +0000)
committerZorro Lang <zlang@kernel.org>
Thu, 3 Nov 2022 05:47:56 +0000 (13:47 +0800)
commit2450821c9b151a98491a078aae921e22a61cff0c
tree7593d04c3ee5f5ccc46b086655471cad38d13fc5
parent1dd7395623cb1b56aadc88a7c46ed660e262a817
common/punch: fix flags printing for filter _filter_fiemap_flags

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@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/punch