Re: [PATCH v3 13/19] selftests: ublk: add utility to get block device metadata size
From: Ming Lei
Date: Tue Jan 06 2026 - 08:50:42 EST
On Mon, Jan 05, 2026 at 05:57:45PM -0700, Caleb Sander Mateos wrote:
> Some block device integrity parameters are available in sysfs, but
> others are only accessible using the FS_IOC_GETLBMD_CAP ioctl. Add a
> metadata_size utility program to print out the logical block metadata
> size, PI offset, and PI size within the metadata. Example output:
> $ metadata_size /dev/ublkb0
> metadata_size: 64
> pi_offset: 56
> pi_tuple_size: 8
>
> Signed-off-by: Caleb Sander Mateos <csander@xxxxxxxxxxxxxxx>
> ---
> tools/testing/selftests/ublk/Makefile | 4 +--
> tools/testing/selftests/ublk/metadata_size.c | 36 ++++++++++++++++++++
> 2 files changed, 38 insertions(+), 2 deletions(-)
> create mode 100644 tools/testing/selftests/ublk/metadata_size.c
>
> diff --git a/tools/testing/selftests/ublk/Makefile b/tools/testing/selftests/ublk/Makefile
> index 06ba6fde098d..41f776bb86a6 100644
> --- a/tools/testing/selftests/ublk/Makefile
> +++ b/tools/testing/selftests/ublk/Makefile
> @@ -47,14 +47,14 @@ TEST_PROGS += test_stress_03.sh
> TEST_PROGS += test_stress_04.sh
> TEST_PROGS += test_stress_05.sh
> TEST_PROGS += test_stress_06.sh
> TEST_PROGS += test_stress_07.sh
>
> -TEST_GEN_PROGS_EXTENDED = kublk
> +TEST_GEN_PROGS_EXTENDED = kublk metadata_size
>
> LOCAL_HDRS += $(wildcard *.h)
> include ../lib.mk
>
> -$(TEST_GEN_PROGS_EXTENDED): $(wildcard *.c)
> +$(OUTPUT)/kublk: common.c fault_inject.c file_backed.c kublk.c null.c stripe.c
I feel wildcard is pretty handy, can we avoid to kill it? Such as:
STANDALONE_UTILS := metadata_size.c
KUBLK_SRCS := $(filter-out $(STANDALONE_UTILS),$(wildcard *.c))
Thanks,
Ming