Re: [RFC PATCH v2 3/8] fat: add iomap direct I/O support
From: Christoph Hellwig
Date: Fri Nov 20 2026 - 13:30:00 EST
On Tue, Nov 17, 2026 at 11:01:43PM -0300, Matheus Alves de Almeida wrote:
> +{
> + struct inode *inode = file_inode(iocb->ki_filp);
> + ssize_t ret;
> +
> + if ((iocb->ki_flags & IOCB_DIRECT) == 0)
> + return generic_file_read_iter(iocb, iter);
Does fat never cause a fallback to buffered I/O?
> + /* Wait under the inode lock for size updates and partial-block zeroing. */
Overly long line.
> + if (iocb->ki_pos + iov_iter_count(iter) > i_size_read(inode) ||
> + !IS_ALIGNED(iocb->ki_pos | iov_iter_alignment(iter),
> + i_blocksize(inode)))
> + dio_flags |= IOMAP_DIO_FORCE_WAIT;
Explain why the wait is fored please.
> +static int fat_dio_write_end_io(struct kiocb *iocb, ssize_t size, int error,
> + unsigned int flags)
> +{
> + struct inode *inode = file_inode(iocb->ki_filp);
> +
> + if (error)
> + return error;
> +
> + if (size && i_size_read(inode) < iocb->ki_pos + size) {
> + i_size_write(inode, iocb->ki_pos + size);
> + mark_inode_dirty(inode);
> + }
> +
> + return 0;
And just as a I comment on the hfsplus thread, this really should be
the default in iomap if no need_io is provided. Please coordinate
with Slava so that we get this into iomap first and then rebase both
series on top.