On Tue, 29 Aug 2023 at 18:11, Bernd Schubert <bschubert@xxxxxxx> wrote: > > This is just a preparation to avoid code duplication in the next > commit. > > Cc: Hao Xu <howeyxu@xxxxxxxxxxx> > Cc: Miklos Szeredi <miklos@xxxxxxxxxx> > Cc: Dharmendra Singh <dsingh@xxxxxxx> > Signed-off-by: Bernd Schubert <bschubert@xxxxxxx> > --- > fs/fuse/file.c | 48 +++++++++++++++++++++++++++++++++--------------- > 1 file changed, 33 insertions(+), 15 deletions(-) > > diff --git a/fs/fuse/file.c b/fs/fuse/file.c > index b1b9f2b9a37d..6b8b9512c336 100644 > --- a/fs/fuse/file.c > +++ b/fs/fuse/file.c > @@ -1298,6 +1298,37 @@ static ssize_t fuse_perform_write(struct kiocb *iocb, struct iov_iter *ii) > return res; > } > > +static bool fuse_io_past_eof(struct kiocb *iocb, > + struct iov_iter *iter) > +{ > + struct inode *inode = file_inode(iocb->ki_filp); > + > + return iocb->ki_pos + iov_iter_count(iter) > i_size_read(inode); > +} > + > +/* > + * @return true if an exclusive lock direct IO writes is needed > + */ > +static bool fuse_dio_wr_exclusive_lock(struct kiocb *iocb, struct iov_iter *from) > +{ > + struct file *file = iocb->ki_filp; > + struct fuse_file *ff = file->private_data; > + > + /* server side has to advise that it supports parallel dio writes */ > + if (!(ff->open_flags & FOPEN_PARALLEL_DIRECT_WRITES)) > + return false; You got the return values the wrong way around. I can fix this, no need to resend. Thanks, Miklos