On Tue, Nov 05, 2019 at 11:02:39PM +1100, Matthew Bobrowski wrote: > + ret = iomap_dio_rw(iocb, from, &ext4_iomap_ops, &ext4_dio_write_ops, > + is_sync_kiocb(iocb) || unaligned_aio || extend); > + > + if (extend) > + ret = ext4_handle_inode_extension(inode, offset, ret, count); > + Can we do a slight optimization here like this? ret = iomap_dio_rw(iocb, from, &ext4_iomap_ops, &ext4_dio_write_ops, is_sync_kiocb(iocb) || unaligned_aio || extend); if (extend && ret != -EBIOCQUEUED) ret = ext4_handle_inode_extension(inode, offset, ret, count); If iomap_dio_rw() returns -EBIOCQUEUED, there's no need to do any of the ext4_handle_inode_extension --- in particular, there's no need to call ext4_truncate_failed_write(), which has a bunch of extra overhead, including taking and releasing i_data_sem. - Ted