Re: [PATCH v3 2/8] vfs: support STATX_DIOALIGN on block devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 16, 2022 at 01:15:00PM -0700, Eric Biggers wrote:
> +/* Handle STATX_DIOALIGN for block devices. */
> +static inline void handle_bdev_dioalign(struct path *path, u32 request_mask,
> +					struct kstat *stat)
> +{
> +#ifdef CONFIG_BLOCK
> +	struct inode *inode;
> +	struct block_device *bdev;
> +	unsigned int lbs;
> +
> +	if (likely(!(request_mask & STATX_DIOALIGN)))
> +		return;
> +
> +	inode = d_backing_inode(path->dentry);
> +	if (!S_ISBLK(inode->i_mode))
> +		return;
> +
> +	bdev = blkdev_get_no_open(inode->i_rdev);
> +	if (!bdev)
> +		return;
> +
> +	lbs = bdev_logical_block_size(bdev);
> +	stat->dio_mem_align = lbs;
> +	stat->dio_offset_align = lbs;
> +	stat->result_mask |= STATX_DIOALIGN;
> +
> +	blkdev_put_no_open(bdev);
> +#endif /* CONFIG_BLOCK */
> +}

This helper should go into block/bdev.c with the STATX_DIOALIGN and
S_ISBLK checks lifted into the caller.  I'd also pass just the inode
here.

Note that this also needs to account for the reduced memory alignment
that landed in the block tree eventually.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux