diff options
author | Filipe Manana <fdmanana@suse.com> | 2022-10-31 11:11:19 +0000 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2022-11-03 13:47:56 +0800 |
commit | 2450821c9b151a98491a078aae921e22a61cff0c (patch) | |
tree | 7593d04c3ee5f5ccc46b086655471cad38d13fc5 /common/punch | |
parent | 1dd7395623cb1b56aadc88a7c46ed660e262a817 (diff) |
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>
Diffstat (limited to 'common/punch')
-rw-r--r-- | common/punch | 2 |
1 files changed, 2 insertions, 0 deletions
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 = ""; } flag_str = flag_str"last"; } |