On Fri, 25 Jul 2025, Christian Brauner wrote: > Hey Linus, > > /* Summary */ > This adds the new FS_IOC_GETLBMD_CAP ioctl() to query metadata and > protection info (PI) capabilities. This ioctl returns information about > the files integrity profile. This is useful for userspace applications > to understand a files end-to-end data protection support and configure > the I/O accordingly. > > For now this interface is only supported by block devices. However the > design and placement of this ioctl in generic FS ioctl space allows us > to extend it to work over files as well. This maybe useful when > filesystems start supporting PI-aware layouts. > > A new structure struct logical_block_metadata_cap is introduced, which > contains the following fields: > > - lbmd_flags: > bitmask of logical block metadata capability flags > > - lbmd_interval: > the amount of data described by each unit of logical block metadata > > - lbmd_size: > size in bytes of the logical block metadata associated with each > interval > > - lbmd_opaque_size: > size in bytes of the opaque block tag associated with each interval > > - lbmd_opaque_offset: > offset in bytes of the opaque block tag within the logical block > metadata > > - lbmd_pi_size: > size in bytes of the T10 PI tuple associated with each interval > > - lbmd_pi_offset: > offset in bytes of T10 PI tuple within the logical block metadata > > - lbmd_pi_guard_tag_type: > T10 PI guard tag type > > - lbmd_pi_app_tag_size: > size in bytes of the T10 PI application tag > > - lbmd_pi_ref_tag_size: > size in bytes of the T10 PI reference tag > > - lbmd_pi_storage_tag_size: > size in bytes of the T10 PI storage tag > > The internal logic to fetch the capability is encapsulated in a helper > function blk_get_meta_cap(), which uses the blk_integrity profile > associated with the device. The ioctl returns -EOPNOTSUPP, if > CONFIG_BLK_DEV_INTEGRITY is not enabled. > > /* Testing */ > > gcc (Debian 14.2.0-19) 14.2.0 > Debian clang version 19.1.7 (3) > > No build failures or warnings were observed. > > /* Conflicts */ > > Merge conflicts with mainline > ============================= > > No known conflicts. > > Merge conflicts with other trees > ================================ > > No known conflicts. > > The following changes since commit 19272b37aa4f83ca52bdf9c16d5d81bdd1354494: > > Linux 6.16-rc1 (2025-06-08 13:44:43 -0700) > > are available in the Git repository at: > > git@xxxxxxxxxxxxxxxxxxx:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-6.17-rc1.integrity > > for you to fetch changes up to bc5b0c8febccbeabfefc9b59083b223ec7c7b53a: > > block: fix lbmd_guard_tag_type assignment in FS_IOC_GETLBMD_CAP (2025-07-23 14:55:51 +0200) > > Please consider pulling these changes from the signed vfs-6.17-rc1.integrity tag. > > Thanks! > Christian > > ---------------------------------------------------------------- > vfs-6.17-rc1.integrity > > ---------------------------------------------------------------- > Anuj Gupta (5): > block: rename tuple_size field in blk_integrity to metadata_size > block: introduce pi_tuple_size field in blk_integrity > nvme: set pi_offset only when checksum type is not BLK_INTEGRITY_CSUM_NONE > fs: add ioctl to query metadata and protection info capabilities > block: fix lbmd_guard_tag_type assignment in FS_IOC_GETLBMD_CAP > > Arnd Bergmann (1): > block: fix FS_IOC_GETLBMD_CAP parsing in blkdev_common_ioctl() > > Christian Brauner (1): > Merge patch series "add ioctl to query metadata and protection info capabilities" > > block/bio-integrity-auto.c | 4 +-- > block/blk-integrity.c | 70 ++++++++++++++++++++++++++++++++++++++- > block/blk-settings.c | 44 ++++++++++++++++++++++-- > block/ioctl.c | 6 ++++ > block/t10-pi.c | 16 ++++----- > drivers/md/dm-crypt.c | 4 +-- > drivers/md/dm-integrity.c | 12 +++---- > drivers/nvdimm/btt.c | 2 +- > drivers/nvme/host/core.c | 7 ++-- > drivers/nvme/target/io-cmd-bdev.c | 2 +- > drivers/scsi/sd_dif.c | 3 +- > include/linux/blk-integrity.h | 11 ++++-- > include/linux/blkdev.h | 3 +- > include/uapi/linux/fs.h | 59 +++++++++++++++++++++++++++++++++ > 14 files changed, 213 insertions(+), 30 deletions(-) It would be great if Klara's patch at https://lore.kernel.org/lkml/20250725164334.9606-1-klarasmodin@xxxxxxxxx/ could follow just after this pull: I had been bisecting -next to find out why "losetup /dev/loop0 tmpfsfile" was failing, and that patch fixes it - and presumably other odd failures for anyone without BLK_DEV_INTEGRITY=y. Thanks, Hugh