[PATCH for-next v4 4/4] fs: add ioctl to query metadata and protection info capabilities

Christoph Hellwig hch at infradead.org
Sun Jun 22 22:32:55 PDT 2025


On Wed, Jun 18, 2025 at 11:21:53AM +0530, Anuj Gupta wrote:
> +/*
> + * struct logical_block_metadata_cap - Logical block metadata capability

No real need to duplicate the struct name here.

> + * If the device does not support metadata, all the fields will be zero.
> + * Applications must check lbmd_flags to determine whether metadata is supported or not.

Overly long line.

> + */
> +struct logical_block_metadata_cap {
> +	/* Bitmask of logical block metadata capability flags */
> +	__u32	lbmd_flags;
> +	/* The amount of data described by each unit of logical block metadata */

Loit sof overly long lines, please reformat these as block comments.

> +	__u16	lbmd_interval;
> +	/* Size in bytes of the logical block metadata associated with each interval */
> +	__u8	lbmd_size;
> +	/* Size in bytes of the opaque block tag associated with each interval */
> +	__u8	lbmd_opaque_size;



> +	/* Offset in bytes of the opaque block tag within the logical block metadata */
>
> +	__u8	lbmd_opaque_offset;
> +	/* Size in bytes of the T10 PI tuple associated with each interval */
> +	__u8	lbmd_pi_size;
> +	/* Offset in bytes of T10 PI tuple within the logical block metadata */
> +	__u8	lbmd_pi_offset;
> +	/* T10 PI guard tag type */
> +	__u8	lbmd_guard_tag_type;
> +	/* Size in bytes of the T10 PI application tag */
> +	__u8	lbmd_app_tag_size;
> +	/* Size in bytes of the T10 PI reference tag */
> +	__u8	lbmd_ref_tag_size;
> +	/* Size in bytes of the T10 PI storage tag */
> +	__u8	lbmd_storage_tag_size;
> +};

This leaves a byte of padding at the end, leaving to issues with
compiler alignments and potentially leaking uninitialized stack data.




More information about the Linux-nvme mailing list