All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: io-uring@vger.kernel.org
Subject: Re: [PATCH] io_uring: return void from io_put_kbuf_comp()
Date: Sat, 30 Mar 2024 08:43:06 +0800	[thread overview]
Message-ID: <ZgdgGrSosHxqBaIf@fedora> (raw)
In-Reply-To: <4387133d-1b5c-477c-bff3-f1b7956fbc4a@kernel.dk>

On Fri, Mar 29, 2024 at 10:07:13AM -0600, Jens Axboe wrote:
> On 3/29/24 9:50 AM, Ming Lei wrote:
> > The two callers don't handle the return value of io_put_kbuf_comp(), so
> > change its return type into void.
> 
> We might want to consider changing the name of it too, it's a bit
> different in that it's just recyling/dropping this kbuf rather than
> posting a completion on behalf of it.
> 
> Maybe io_kbuf_drop() would be better. Would distuingish it from the
> normal use cases of "drop this kbuf and return the cflags representation
> of it, as I'm posting a completionw ith it".
> 
> > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> > ---
> >  io_uring/kbuf.h | 12 +++---------
> >  1 file changed, 3 insertions(+), 9 deletions(-)
> > 
> > diff --git a/io_uring/kbuf.h b/io_uring/kbuf.h
> > index 1c7b654ee726..86931fa655ad 100644
> > --- a/io_uring/kbuf.h
> > +++ b/io_uring/kbuf.h
> > @@ -119,18 +119,12 @@ static inline void __io_put_kbuf_list(struct io_kiocb *req,
> >  	}
> >  }
> >  
> > -static inline unsigned int io_put_kbuf_comp(struct io_kiocb *req)
> > +static inline void io_put_kbuf_comp(struct io_kiocb *req)
> >  {
> > -	unsigned int ret;
> > -
> >  	lockdep_assert_held(&req->ctx->completion_lock);
> >  
> > -	if (!(req->flags & (REQ_F_BUFFER_SELECTED|REQ_F_BUFFER_RING)))
> > -		return 0;
> > -
> > -	ret = IORING_CQE_F_BUFFER | (req->buf_index << IORING_CQE_BUFFER_SHIFT);
> > -	__io_put_kbuf_list(req, &req->ctx->io_buffers_comp);
> > -	return ret;
> > +	if (req->flags & (REQ_F_BUFFER_SELECTED|REQ_F_BUFFER_RING))
> > +		__io_put_kbuf_list(req, &req->ctx->io_buffers_comp);
> >  }
> 
> If you post a v2 with the above suggestion, let's please just keep the
> flags checking how it is. It's consistent with what we do elsewhere.

OK, I can rename it as io_kbuf_drop() in v2 and keep the original check style.

Also the following patch removes one io_put_kbuf_comp(), I will post v2
when that patch gets feedback or merged.

https://lore.kernel.org/io-uring/20240329154712.1936153-1-ming.lei@redhat.com/


thanks,
Ming


      reply	other threads:[~2024-03-30  0:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29 15:50 [PATCH] io_uring: return void from io_put_kbuf_comp() Ming Lei
2024-03-29 16:07 ` Jens Axboe
2024-03-30  0:43   ` Ming Lei [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZgdgGrSosHxqBaIf@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.