On Thu 10-10-19 07:47:18, Darrick J. Wong wrote: > On Thu, Oct 10, 2019 at 12:54:20AM -0700, Christoph Hellwig wrote: > > On Thu, Oct 10, 2019 at 10:02:27AM +1100, Dave Chinner wrote: > > > That would mean the callers need to do something like this by > > > default: > > > > > > ret = iomap_dio_rw(iocb, iter, ops, dops, is_sync_kiocb(iocb)); > > > > > > And filesystems like XFS will need to do: > > > > > > ret = iomap_dio_rw(iocb, iter, ops, dops, > > > is_sync_kiocb(iocb) || unaligned); > > > > > > and ext4 will calculate the parameter in whatever way it needs to. > > > > I defintively like that. > > > > > > > > In fact, it may be that a wrapper function is better for existing > > > callers: > > > > > > static inline ssize_t iomap_dio_rw() > > > { > > > return iomap_dio_rw_wait(iocb, iter, ops, dops, is_sync_kiocb(iocb)); > > > } > > > > > > And XFS/ext4 writes call iomap_dio_rw_wait() directly. That way we > > > don't need to change the read code at all... > > > > I have to say I really hated the way we were growing all these wrappers > > in the old direct I/O code, so I've been asked Jan to not add the > > wrapper in his old version. But compared to the force_sync version it > > at least makes a little more sense here. I'm just not sure if > > iomap_dio_rw_wait is the right name, but the __-prefix convention for > > non-trivial differences also sucks. I can't think of a better name, > > though. > > <shrug> I'd just add the 'bool wait' parameter at the end of > iomap_dio_rw() and leave it that way. If we ever develop more than one > caller that passes in "is_sync_kiocb(iocb)" (or more than two lucky > callers screwing it up I guess?) for that parameter then maybe we can > re-evaluate. OK, fine by me. I guess this is the least controversial proposal so I'll resend patches with this change tomorrow... Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR