Re: [PATCH 1/3] gfs2: stop using pages for log buffers
From: Tal Zussman
Date: Fri Nov 20 2026 - 13:20:48 EST
On 11/19/26 7:08 PM, Andreas Gruenbacher wrote:
> On Tue, Nov 17, 2026 at 8:46 AM Tal Zussman <tz2294@xxxxxxxxxxxx> wrote:
>>
>> The log headers, descriptors, revoke blocks, and escaped block copies
>> come from a mempool of pages and share a bio with the buffer heads being
>> journaled. The completion handler tells the two apart by checking each
>> segment for buffers, which treats a pool page as a folio. That won't
>> work once memdescs give these pages a type of their own.
>>
>> Allocate them from a kmalloc mempool instead and add them to the bio
>> with bio_add_virt_nofail(). Give the pool blocks their own completion
>> handler, and start a new bio whenever the handler changes so that a bio
>> only holds one kind of segment. gfs2_log_write() now takes a folio, so
>> the log write path no longer uses struct page.
>>
>> Each descriptor and each escaped block copy is now a bio of its own.
>> They are contiguous and merge under an I/O scheduler, but the flush
>> path doesn't plug, so without a scheduler they reach the device as
>> separate writes.
>>
>> Signed-off-by: Tal Zussman <tz2294@xxxxxxxxxxxx>
>> ---
...
>> diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
>> index a607e98eb45f..0da4cfbe54ea 100644
>> --- a/fs/gfs2/main.c
>> +++ b/fs/gfs2/main.c
>> @@ -166,8 +166,8 @@ static int __init init_gfs2_fs(void)
>> if (!gfs2_freeze_wq)
>> goto fail_wq3;
>>
>> - gfs2_page_pool = mempool_create_page_pool(64, 0);
>> - if (!gfs2_page_pool)
>> + gfs2_log_buf_pool = mempool_create_kmalloc_pool(64, PAGE_SIZE);
>
> We actually need s_blocksize size rather than PAGE_SIZE buffers here.
> How about a per-sbd mempool instead of a global one?
>
Let me give that a shot for v2.
Thanks,
Tal
>> + if (!gfs2_log_buf_pool)
>> goto fail_mempool;
>>
>> gfs2_register_debugfs();
>> @@ -187,7 +187,7 @@ static int __init init_gfs2_fs(void)
>> fail_fs2:
>> unregister_filesystem(&gfs2_fs_type);
>> fail_fs1:
>> - mempool_destroy(gfs2_page_pool);
>> + mempool_destroy(gfs2_log_buf_pool);
>> fail_mempool:
>> destroy_workqueue(gfs2_freeze_wq);
>> fail_wq3:
>> @@ -240,7 +240,7 @@ static void __exit exit_gfs2_fs(void)
>>
>> rcu_barrier();
>>
>> - mempool_destroy(gfs2_page_pool);
>> + mempool_destroy(gfs2_log_buf_pool);
>> kmem_cache_destroy(gfs2_trans_cachep);
>> kmem_cache_destroy(gfs2_qadata_cachep);
>> kmem_cache_destroy(gfs2_quotad_cachep);
>> diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
>> index 529c3ec37a18..1fd5f817312b 100644
>> --- a/fs/gfs2/util.c
>> +++ b/fs/gfs2/util.c
>> @@ -34,7 +34,7 @@ struct kmem_cache *gfs2_rgrpd_cachep __read_mostly;
>> struct kmem_cache *gfs2_quotad_cachep __read_mostly;
>> struct kmem_cache *gfs2_qadata_cachep __read_mostly;
>> struct kmem_cache *gfs2_trans_cachep __read_mostly;
>> -mempool_t *gfs2_page_pool __read_mostly;
>> +mempool_t *gfs2_log_buf_pool __read_mostly;
>>
>> void gfs2_assert_i(struct gfs2_sbd *sdp)
>> {
>> diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
>> index ffcc47d6b0b4..399c20004283 100644
>> --- a/fs/gfs2/util.h
>> +++ b/fs/gfs2/util.h
>> @@ -165,7 +165,7 @@ extern struct kmem_cache *gfs2_rgrpd_cachep;
>> extern struct kmem_cache *gfs2_quotad_cachep;
>> extern struct kmem_cache *gfs2_qadata_cachep;
>> extern struct kmem_cache *gfs2_trans_cachep;
>> -extern mempool_t *gfs2_page_pool;
>> +extern mempool_t *gfs2_log_buf_pool;
>> extern struct workqueue_struct *gfs2_control_wq;
>>
>> static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt,
>>
>> --
>> 2.39.5
>>
>
> Thanks,
> Andreas
>