mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tal Zussman <tz2294@columbia.edu>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: gfs2@lists.linux.dev, linux-kernel@vger.kernel.org,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: Re: [PATCH 1/3] gfs2: stop using pages for log buffers
Date: Fri, 20 Nov 2026 13:14:11 -0500	[thread overview]
Message-ID: <e3b26fcd-8309-448c-bd34-dbced0b50a9c@columbia.edu> (raw)
In-Reply-To: <CAHc6FU7adAS0f2BjU6iU3AUD6hAFF=2zOeCMkVvV88p4O-a6=w@mail.gmail.com>

On 11/19/26 7:08 PM, Andreas Gruenbacher wrote:
> On Tue, Nov 17, 2026 at 8:46 AM Tal Zussman <tz2294@columbia.edu> 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@columbia.edu>
>> ---

...

>> 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
> 


  reply	other threads:[~2026-11-20 18:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  7:46 [PATCH 0/3] gfs2: stop using struct page in the log code Tal Zussman
2026-11-17  7:46 ` [PATCH 1/3] gfs2: stop using pages for log buffers Tal Zussman
2026-11-20  0:08   ` Andreas Gruenbacher
2026-11-20 18:14     ` Tal Zussman [this message]
2026-11-17  7:46 ` [PATCH 2/3] gfs2: plug the log writes of a flush Tal Zussman
2026-11-17  7:46 ` [PATCH 3/3] gfs2: remove the remaining page references in the log code Tal Zussman
2026-11-19 23:47 ` [PATCH 0/3] gfs2: stop using struct page " Andreas Gruenbacher
2026-11-20 18:11   ` Tal Zussman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3b26fcd-8309-448c-bd34-dbced0b50a9c@columbia.edu \
    --to=tz2294@columbia.edu \
    --cc=agruenba@redhat.com \
    --cc=gfs2@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®