On Mon, Feb 03, 2025 at 07:21:08PM +1030, Qu Wenruo wrote: > That always falling-back-to-buffered-IO sounds pretty good. > (For NODATASUM inodes, we do not need to fallback though). Yes, that's what I meant above. > > The only concern is performance. > I guess even for the uncached write it still involves some extra folio copy, > thus not completely the same performance level of direct IO? In general buffered I/O is going to be slower, but at least the uncached mode will avoid the cache pollution. > And always falling back (for inodes with datacsum) may also sound a little > overkilled. > If the program is properly coded, and no contents change halfway, we always > pay the performance penalty but without really any extra benefit. But you don't know that, and people have very different expectations for "properly coded" :) So I'd opt for the safe variant (copy) an allow an opt-in for the faster but less safe variant (realy direct I/O without copy with checksums). And hopefully we can eventually find a version that will bounce buffer when modifying pages that are in-flight for direct I/O which would be safe and fast.