On Wed, Jan 13, 2021 at 10:32:15AM -0500, Brian Foster wrote: > Something I hadn't thought about before is whether applications might > depend on current unaligned dio serialization for coherency and thus > break if the kernel suddenly allows concurrent unaligned dio to pass > through. Should this be something that is explicitly requested by > userspace? direct I/O has always been documented as not being synchronized. Also for block devices you won't get any synchronization at all, down to the sector level. > > That aside, I agree that the DIO_UNALIGNED approach seems a bit more > clear than NOALLOC, but TBH the more I look at this the more Christoph's > first approach seems cleanest to me. It is a bit unfortunate to > duplicate the mapping lookups and have the extra ILOCK cycle, but the > lock is shared and only taken when I/O is unaligned. I don't really see > why that is a show stopper yet it's acceptable to fall back to exclusive > dio if the target range happens to be discontiguous (but otherwise > mapped/written). I think both approaches have pros an cons. My original one (which really is yours as you suggested it) has the advantage of having a much simpler structure, and not limititing the non-exclusive I/O to a single extent. The refined version of Dave's approach avoids the extra one or two extent lookups, and any knowledge of extent state above the iomap layer.