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

From: Heming Zhao
Date: Thu Mar 27 2025 - 02:09:55 EST


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