Re: [PATCH 4/8] FOLD: block: change the defer in task context interface to be procedural
From: Matthew Wilcox
Date: Thu Apr 09 2026 - 16:19:45 EST
On Thu, Apr 09, 2026 at 06:02:17PM +0200, Christoph Hellwig wrote:
> @@ -1836,9 +1837,7 @@ void bio_endio(struct bio *bio)
> }
> #endif
>
> - if (!in_task() && bio_flagged(bio, BIO_COMPLETE_IN_TASK))
> - bio_queue_completion(bio);
> - else if (bio->bi_end_io)
> + if (bio->bi_end_io)
> bio->bi_end_io(bio);
What I liked about this before is that we had one central place that
needed to be changed. This change means that every bi_end_io now needs
to check whether the BIO can be completed in its context.
> +++ b/fs/buffer.c
> @@ -2673,6 +2673,9 @@ static void end_bio_bh_io_sync(struct bio *bio)
> {
> struct buffer_head *bh = bio->bi_private;
>
> + if (buffer_dropbehind(bh) && bio_complete_in_task(bio))
> + return;
I really don't like this. It assumes there's only one reason to
complete in task context -- whether the buffer belongs to a dropbehind
folio. I want there to be other reasons. Why would you introduce the
new BH_dropbehind flag instead of checking BIO_COMPLETE_IN_TASK?
> struct iomap_ioend *ioend = iomap_ioend_from_bio(bio);
>
> + /* Page cache invalidation cannot be done in irq context. */
> + if (ioend->io_flags & IOMAP_IOEND_DONTCACHE) {
> + if (bio_complete_in_task(bio))
> + return;
> + }
I thought we agreed to kill off IOMAP_IOEND_DONTCACHE?