Re: [f2fs-dev] [PATCH] fs: report direct io constraints through file_getattr
Jan Kara <[email protected]>
| Newsgroups | net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-block,org.kernel.vger.linux-ext4,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-xfs |
|---|---|
| Message-ID | <neamg3phll7hjwd765ddtqebtxasdvkoskff75dqzmgzv2xy5i@mf4agr6yoizn> |
On Thu 09-07-26 09:13:52, Christoph Hellwig wrote:
> On Tue, Jul 07, 2026 at 06:18:43PM -0700, Keith Busch wrote:
> > + u32 dio_align = ext4_dio_alignment(inode);
> > +
> > + if (dio_align != 0) {
>
>
> > + struct block_device *bdev = inode->i_sb->s_bdev;
> > +
> > + if (dio_align == 1) {
> > + fa->fsx_dio_mem_align = bdev_dma_alignment(bdev) + 1;
> > + fa->fsx_dio_offset_align = bdev_logical_block_size(bdev);
> > + fa->fsx_dio_read_offset_align = bdev_logical_block_size(bdev);
> > + } else {
> > + fa->fsx_dio_mem_align = dio_align;
> > + fa->fsx_dio_offset_align = dio_align;
> > + fa->fsx_dio_read_offset_align = dio_align;
> > + }
>
> Call bdev_fileattr and override the relevant field as needed?
>
> Question to the ext4 maintainers: why does ext4_dio_alignment
> affect the in-memory alignment? If it does so, it should probably
> also affect the virt boundry alignment..
I guess that is mostly a historical accident. ext4_dio_alignment() returns
1 (iomap alignment is used and that's different for memory and file offset
alignment), 0 (dio not supported, memory and file offset alignment is
indeed the same), and blocksize (a special case which can happen for
fscrypt if it supports dio and where I believe memory alignment
requirements may be in fact different). I'm adding Eric to CC to answer
what actual requirements fscrypt has for memory buffers for direct IO. I'd
expect with inline encryption we would have the same requirements as
ordinary iomap direct IO and for other code paths I'm not sure... Eric?
Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel