Re: [PATCH v6 3/4] buffer: add dropbehind writeback support
From: Christoph Hellwig
Date: Mon May 25 2026 - 01:26:41 EST
On Fri, May 22, 2026 at 07:14:46PM -0400, Tal Zussman wrote:
> > if (IS_ERR(folio))
> > return PTR_ERR(folio);
> > @@ -2160,6 +2165,13 @@ int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
> > *foliop = folio;
> > return status;
> > }
>
> Q: "Is an EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL() needed for
> block_write_begin_iocb()?
> Since the legacy wrapper block_write_begin() remains exported, it appears
> filesystems compiled as loadable modules (like ext4 or fat) will encounter
> linker errors if they attempt to transition to the new API."
>
> A: Can be added once filesystems want to use it.
Yeah, Sashiko is really stupid and counterproductive here.
> > @@ -2715,6 +2727,9 @@ static void submit_bh_wbc(blk_opf_t opf, struct buffer_head *bh,
> >
> > bio = bio_alloc(bh->b_bdev, 1, opf, GFP_NOIO);
> >
> > + if (folio_test_dropbehind(bh->b_folio))
> > + bio_set_flag(bio, BIO_COMPLETE_IN_TASK);
> > +
>
> Q: "Does this add unnecessary workqueue overhead for read operations?
> While task-context deferral is required for asynchronous writeback completions
> to allow folio_end_writeback() to sleep and invalidate the folio, read
> dropbehind invalidation is handled synchronously in the reader's task context
> via filemap_end_dropbehind_read().
> Could this be gated by an op == REQ_OP_WRITE or op_is_write(opf) check so
> that read bio completions aren't forced into a workqueue?"
>
> A: Seems worth adding a op_is_write(opf) check to avoid deferring read
> dropbehind completions.
Yes.