Re: [PATCH 1/2] btrfs: additional gfp api for allocating compressed folios

From: David Sterba

Date: Fri Mar 20 2026 - 13:55:49 EST


On Fri, Mar 20, 2026 at 12:34:44AM -0700, JP Kobryn (Meta) wrote:
> btrfs_alloc_compr_folio() assumes all callers want GFP_NOFS. This is fine
> for most cases, however there are some call sites that would benefit from
> different flags. One such case is preventing direct reclaim from occurring
> during readahead allocations. With unbounded reclaim during this time,
> noticeable latency will occur under high memory pressure.
>
> Provide an additional API that accepts one additional gfp_t parameter,
> giving callers flexibility over the characteristics of their allocation.

If you still need to set the gfp flags in v2, please drop this patch and
extend btrfs_alloc_compr_folio(), the API is internal and we don't need
it fine grained.