]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
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)
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

index 47a29c92e7cd94ae3761c36076e9fbf22484572c..94599c35b9bb9afe0b7b9ad16ef6f0d70e0b837d 100644 (file)
@@ -130,6 +130,8 @@ _filter_fiemap_flags()
                        if (and(flags, 0x1)) {
                                if (set) {
                                        flag_str = flag_str"|";
+                               } else {
+                                       flag_str = "";
                                }
                                flag_str = flag_str"last";
                        }