Re: [PATCH v2] btrfs: keep `priv` struct on stack for sync reads in `btrfs_encoded_read_regular_fill_pages()`

From: David Sterba
Date: Thu Jan 23 2025 - 16:33:06 EST


On Wed, Jan 15, 2025 at 04:24:58PM +0100, Daniel Vacek wrote:
> Only allocate the `priv` struct from slab for asynchronous mode.
>
> There's no need to allocate an object from slab in the synchronous mode. In
> such a case stack can be happily used as it used to be before 68d3b27e05c7
> ("btrfs: move priv off stack in btrfs_encoded_read_regular_fill_pages()")
> which was a preparation for the async mode.
>
> While at it, fix the comment to reflect the atomic => refcount change in
> d29662695ed7 ("btrfs: fix use-after-free waiting for encoded read endios").
>
> Signed-off-by: Daniel Vacek <neelx@xxxxxxxx>
> ---
> v2 reduces the patch only to functional changes as suggested by Johannes
> and Dave.

Added to for-next, thanks.