public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
	Carlos Maiolino <cem@kernel.org>,
	linux-block@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/4] block: factor out a bio_await helper
Date: Mon, 6 Apr 2026 07:50:44 +0200	[thread overview]
Message-ID: <20260406055044.GB16443@lst.de> (raw)
In-Reply-To: <2065a50d-9029-44a6-9da0-4a2bb896bdb2@acm.org>

On Wed, Apr 01, 2026 at 08:35:10AM -0700, Bart Van Assche wrote:
>
> On 4/1/26 7:03 AM, Christoph Hellwig wrote:
>> +/**
>> + * bio_await - call a function on a bio, and wait until it completes
>> + * @bio:	the bio which describes the I/O
>> + * @kick:	function called to "kick off" the bio
>> + * @priv:	private data passed to @kick.
>> + *
>> + * Wait for the bio as well as any bio chained off it after executing the
>> + * passed in callback @kick.  The wait for the bio is set up before calling
>> + * @kick to ensure that the completion is captured.  If @kick is %NULL,
>> + * submit_bio() is used instead to submit the bio.
>> + *
>> + * Note: this overrides the bi_private and bi_end_io fields in the bio.
>> + */
>> +void bio_await(struct bio *bio, void *priv,
>> +	       void (*kick)(struct bio *bio, void *priv))
>
> Please consider swapping the @priv and @kick arguments because that's
> the argument order used elsewhere in the Linux kernel for callback
> function pointers and their private data pointer.

We have plenty of examples for both variants.  And the version here
generates objectively better code, because it keeps the arguments passed
on in the same registers.

> What happened to the bio->bi_opf |= REQ_SYNC statement? Shouldn't that 
> statement be preserved?

Yes.


  reply	other threads:[~2026-04-06  5:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-01 14:03 refactor submit_bio_wait and bio await helpers Christoph Hellwig
2026-04-01 14:03 ` [PATCH 1/4] block: unify the synchronous bi_end_io callbacks Christoph Hellwig
2026-04-01 15:30   ` Bart Van Assche
2026-04-01 14:03 ` [PATCH 2/4] block: factor out a bio_await helper Christoph Hellwig
2026-04-01 15:35   ` Bart Van Assche
2026-04-06  5:50     ` Christoph Hellwig [this message]
2026-04-01 14:03 ` [PATCH 3/4] block: add a bio_submit_or_kill helper Christoph Hellwig
2026-04-01 15:42   ` Bart Van Assche
2026-04-06  5:51     ` Christoph Hellwig
2026-04-01 14:03 ` [PATCH 4/4] xfs: use bio_await in xfs_zone_gc_reset_sync Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2026-04-06  5:57 refactor submit_bio_wait and bio await helpers v2 Christoph Hellwig
2026-04-06  5:57 ` [PATCH 2/4] block: factor out a bio_await helper Christoph Hellwig
2026-04-06  7:05   ` Damien Le Moal

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=20260406055044.GB16443@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=cem@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-xfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox