Message ID | a1a5c698061d4c4e6c8994cde7b51969d8929de3.1667214081.git.fdmanana@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: add couple tests to check fiemap correctly reports extent sharedness | expand |
On Mon, Oct 31, 2022 at 11:11:19AM +0000, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > 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> > --- > 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@redhat.com> > } > flag_str = flag_str"last"; > } > -- > 2.35.1 >
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"; }