On Sat 21-06-25 15:46:40, Zhang Yi wrote: > On 2025/6/20 0:44, Jan Kara wrote: > > On Wed 11-06-25 19:16:24, Zhang Yi wrote: > >> From: Zhang Yi <yi.zhang@xxxxxxxxxx> > >> > >> This partially reverts commit d6bf294773a4 ("ext4/jbd2: convert > >> jbd2_journal_blocks_per_page() to support large folio"). This > >> jbd2_journal_blocks_per_folio() will lead to a significant > >> overestimation of journal credits. Since we still reserve credits for > >> one page and attempt to extend and restart handles during large folio > >> writebacks, so we should convert this helper back to > >> ext4_journal_blocks_per_page(). > >> > >> Signed-off-by: Zhang Yi <yi.zhang@xxxxxxxxxx> > > > > Here I'm not decided. Does it make any particular sense to reserve credits > > for one *page* worth of blocks when pages don't have any particular meaning > > in our writeback code anymore? We could reserve credits just for one > > physical extent and that should be enough. > > Indeed, reserving credits for a single page is no longer suitable in the > currently folio based context. It do seems more appropriate to allocate > credits for a single extent. > > > For blocksize == pagesize (most > > common configs) this would be actually equivalent. If blocksize < pagesize, > > this could force us to do some more writeback retries and thus get somewhat > > higher writeback CPU overhead but do we really care for these configs? It > > is well possible I've overlooked something and someone will spot a > > performance regression in practical setup with this in which case we'd have > > to come up with something more clever but I think it's worth it to start > > simple and complicate later. > > This can indeed be a problem if the file system is already fragmented > enough. However, thanks to the credits extension logic in > __ext4_journal_ensure_credits(), I suppose that on most file system images, > it will not trigger excessive retry operations. Besides, although there > might be some lock cost in jbd2_journal_extend(), I suppose it won't be a > big deal. > > Perhaps we could reserve more credits through a complex formula at the > outset, which would lower the cost of expanding the credits. But I don't > think this will help much in reducing the number of retries, it may only > be helpful in extreme cases (the running transaction stats to commit, we > cannot extend it). > > So, I think we can implement it by reserving for an extent for the time > being. Do you agree? Yes, I agree. After all this is easy to change if we find some real issues with it. Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR