lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sun, 26 Jun 2022 00:48:08 -0700 From: Christoph Hellwig <hch@...radead.org> To: Eric Biggers <ebiggers@...nel.org> Cc: linux-fsdevel@...r.kernel.org, linux-ext4@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net, linux-xfs@...r.kernel.org, linux-api@...r.kernel.org, linux-fscrypt@...r.kernel.org, linux-block@...r.kernel.org, linux-kernel@...r.kernel.org, Keith Busch <kbusch@...nel.org> Subject: Re: [PATCH v3 2/8] vfs: support STATX_DIOALIGN on block devices 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.
Powered by blists - more mailing lists