Re: [PATCH RFC 1/1] ocfs2: fix write IO performance improvement for high fragmentation

From: Heming Zhao
Date: Thu Mar 27 2025 - 02:53:33 EST


On 3/27/25 14:21, Gautham Ananthakrishna wrote:
HI Heming,

Sharing the test suite may not be practical (it has shell scripts, python and C binaries). However, I can take a look into your patch and run a quick test.

Thanks,
Gautham.


Thank you for your quick reply and willingness to help.

- Heming
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*From:* Heming Zhao <heming.zhao@xxxxxxxx>
*Sent:* Thursday, March 27, 2025 11:39 AM
*To:* Gautham Ananthakrishna <gautham.ananthakrishna@xxxxxxxxxx>; joseph.qi@xxxxxxxxxxxxxxxxx <joseph.qi@xxxxxxxxxxxxxxxxx>
*Cc:* linux-kernel@xxxxxxxxxxxxxxx <linux-kernel@xxxxxxxxxxxxxxx>; ocfs2-devel@xxxxxxxxxxxxxxx <ocfs2-devel@xxxxxxxxxxxxxxx>; Rajesh Sivaramasubramaniom <rajesh.sivaramasubramaniom@xxxxxxxxxx>; Junxiao Bi <junxiao.bi@xxxxxxxxxx>; akpm@xxxxxxxxxxxxxxxxxxxx <akpm@xxxxxxxxxxxxxxxxxxxx>
*Subject:* Re: [PATCH RFC 1/1] ocfs2: fix write IO performance improvement for high fragmentation
Hello Gautham,

Thanks for locating the issue and submitting a patch.
Is it possible to share your test case for this bug?

The key of this bug is ocfs2_cluster_group_search() comparing with wrong
bits size. I have another fix for this bug and will send it to this mailing
list later.

Thanks,
Heming

On 3/24/25 13:48, Gautham Ananthakrishna wrote:
The commit 4eb7b93e03101fd3f35e69affe566e4b1e3e3dca caused a regression
in our test suite in discontig extent tests. Upon troubleshooting I found
The following issues.

1. The function ocfs2_cluster_group_search() was called for discontig allocations
as well. But it checks only the contiguous bits 'bg_contig_free_bits'.
It hit the ENOSPC in the following case in one of the tests.

ocfs2_mkdir()
   ocfs2_reserve_new_inode()
    ocfs2_reserve_suballoc_bits()
     ocfs2_block_group_alloc()
      ocfs2_block_group_alloc_discontig()
       __ocfs2_claim_clusters()
        ocfs2_claim_suballoc_bits()
         ocfs2_search_chain()
          ocfs2_cluster_group_search()

Looked like the commit did not consider discontig searches. To fix this,
I have split ocfs2_cluster_group_search() into *_common(), *_contig() and
*_discontig()

2. That commit enforced ocfs2_cluster_group_search() to search only the
'bits_wanted' number of bits whereas ocfs2_block_group_find_clear_bits()
fills the best available size and the function ocfs2_cluster_group_search()
itself is supposed to search 'min_bits' at the minimum and need not be
'bits_wanted' always.

Fixed the above issues in this patch.
This patch fixes 4eb7b93e03101fd3f35e69affe566e4b1e3e3dca

Signed-off-by: Gautham Ananthakrishna <gautham.ananthakrishna@xxxxxxxxxx>
---
   fs/ocfs2/suballoc.c | 146 ++++++++++++++++++++++++++++----------------
   1 file changed, 95 insertions(+), 51 deletions(-)