Re: [PATCHv2 3/5] xfs: report direct io attributes through file_getattr

Christoph Hellwig <[email protected]>
Newsgroups org.kernel.vger.linux-xfs,net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-block,org.kernel.vger.linux-ext4,org.kernel.vger.linux-fsdevel
Message-ID <[email protected]>
On Tue, Jul 14, 2026 at 03:09:57PM -0600, Keith Busch wrote:
> +void bdev_dio_align(struct block_device *bdev, struct fs_dio_align *align)

Nit: I'd usually pass the filled in structure before the source of the
information.

> +	case FS_IOC_GETDIOALIGN: {
> +		struct fs_dio_align align = {};
> +
> +		bdev_dio_align(bdev, &align);
> +		return copy_to_user(argp, &align, sizeof(align)) ? -EFAULT : 0;
> +	}

... and I'd probably split this into a little helper function as the
ioctl handlers sooner or later become a mess otherwise.

> +	case FS_IOC_GETDIOALIGN: {
> +		struct fs_dio_align	align = {};
> +
> +		if (!S_ISREG(inode->i_mode))
> +			return -ENOTTY;
> +		bdev_dio_align(xfs_inode_buftarg(ip)->bt_bdev, &align);
> +		if (xfs_is_cow_inode(ip))
> +			align.dio_offset_align = xfs_inode_alloc_unitsize(ip);
> +		if (copy_to_user(arg, &align, sizeof(align)))
> +			return -EFAULT;

Same here.

Otherwise this looks good to me.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.