Re: [PATCH v4 4/5] mm/filemap: add write_begin_get_folio() helper function

Matthew Wilcox
2025-07-07T14:54:49Z

On Mon, Jul 07, 2025 at 07:00:33AM +0000, 陈涛涛 Taotao Chen wrote:
> +++ b/mm/filemap.c

I think this should be a static inline function. I don't think it's
worth moving out of line. Of course if you have measurements that show
differently, you can change my mind.

> +/**
> + * write_begin_get_folio - Get folio for write_begin with flags
> + * @iocb: kiocb passed from write_begin (may be NULL)
> + * @mapping: the address space to search in
> + * @index: page cache index
> + * @len: length of data being written
> + *
> + * This is a helper for filesystem write_begin() implementations.
> + * It wraps __filemap_get_folio(), setting appropriate flags in
> + * the write begin context.
> + *
> + * Returns a folio or an ERR_PTR.

We prefer:

* Return: A folio or an ERR_PTR

as this gets its own section in the kernel-doc output.