On Wed, May 24, 2023 at 09:00:36AM +0200, Miklos Szeredi wrote: > > +ssize_t direct_write_fallback(struct kiocb *iocb, struct iov_iter *iter, > > + ssize_t direct_written, ssize_t buffered_written) > > +{ > > + struct address_space *mapping = iocb->ki_filp->f_mapping; > > + loff_t pos = iocb->ki_pos - buffered_written; > > + loff_t end = iocb->ki_pos - 1; > > + int err; > > + > > + /* > > + * If the buffered write fallback returned an error, we want to > > return > > + * the number of bytes which were written by direct I/O, or the > > error > > + * code if that was zero. > > + * > > + * Note that this differs from normal direct-io semantics, which > > will > > + * return -EFOO even if some bytes were written. > > + */ > > + if (unlikely(buffered_written < 0)) > > + return buffered_written; > > Comment/code mismatch. The comment says: > > if (buffered_written < 0) > return direct_written ?: buffered_written;
Yeah. And the old code matches the comment, so I'll update to that. I'm really wondering how I could come up with a good test case for this..