Re: [PATCH v5 1/5] iomap: add iomap_dio_end_io() helper

From: Christian Brauner

Date: Fri Nov 20 2026 - 08:48:38 EST


On Tue, Nov 17, 2026 at 04:48:40PM -0800, Viacheslav Dubeyko wrote:
> The helper updates i_size without any locking, so it can be used only
> by file systems that issue all direct writes extending i_size
> synchronously (IOMAP_DIO_FORCE_WAIT) under inode_lock.

Meh, this should really not be named so it looks like its the default
completion handler. iomap_dio_end_io() really sounds like it.

Name it after what it does. Plus, check the rule. With
IOMAP_DIO_FORCE_WAIT the completion runs in the context that still holds
the inode lock, so the branch that updates i_size can assert that:

if (size && i_size_read(inode) < iocb->ki_pos + size) {
lockdep_assert_held_write(&inode->i_rwsem);
i_size_write(inode, iocb->ki_pos + size);
mark_inode_dirty(inode);
}

> +static inline
> +int iomap_dio_end_io(struct kiocb *iocb, ssize_t size,

This is an ->end_io callback so its address ends up in struct
iomap_dio_ops. Please make it a regular exported function in
fs/iomap/direct-io.c instead of a static inline in the header.

> Several file systems implement an almost identical ->end_io callback
> for direct writes: if the write succeeded and went beyond the current
> end-of-file, update i_size and mark the inode dirty (for example,
> ext2_dio_write_end_io()). Add a generic iomap_dio_end_io() helper for
> this case, so that file systems don't need to open-code it.

Hopefully that gets a follow-up patch right away and converts ext2.