From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: Re: [RFC PATCH 1/3] fs: pass READ/WRITE to kiocb_set_rw_flags() Date: Fri, 20 Sep 2019 16:38:55 +0200 Message-ID: <20190920143855.GD25765@quack2.suse.cz> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-btrfs-owner@vger.kernel.org To: Omar Sandoval Cc: linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, Dave Chinner , linux-api@vger.kernel.org, kernel-team@fb.com, Jan Kara , Jens Axboe List-Id: linux-api@vger.kernel.org On Wed 18-09-19 23:53:44, Omar Sandoval wrote: > From: Omar Sandoval > > A following change will want to check whether an IO is a read or write > in kiocb_set_rw_flags(). Additionally, aio and io_uring currently set > the IOCB_WRITE flag on a kiocb right before calling call_write_iter(), > but we can move that into the common code. > > Cc: Jan Kara > Cc: Jens Axboe > Signed-off-by: Omar Sandoval ... > index ffe35d97afcb..75c4b7680385 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -3351,8 +3351,11 @@ static inline int iocb_flags(struct file *file) > return res; > } > > -static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags) > +static inline int kiocb_set_rw_flags(int rw, struct kiocb *ki, rwf_t flags) > { > + if (rw == WRITE) > + ki->ki_flags |= IOCB_WRITE; > + > if (unlikely(flags & ~RWF_SUPPORTED)) > return -EOPNOTSUPP; I'd find it more natural if the destination argument (i.e., kiocb) stayed to be the first argument of the function. Otherwise the patch looks good to me. Honza -- Jan Kara SUSE Labs, CR