From: Heming Zhao <heming.zhao@suse.com>
To: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: ocfs2-devel@lists.linux.dev, ailiop@suse.com
Subject: Re: [PATCH v4 2/3] ocfs2: adjust enabling place for la window
Date: Thu, 28 Mar 2024 10:36:31 +0800 [thread overview]
Message-ID: <0c640d4a-295a-4d5a-8193-6d5b936836f8@suse.com> (raw)
In-Reply-To: <b6038cf4-9966-47ad-b3e5-e0ad76270deb@linux.alibaba.com>
On 3/28/24 09:58, Joseph Qi wrote:
>
>
> On 3/27/24 8:59 PM, Heming Zhao wrote:
>> On 3/27/24 19:05, Joseph Qi wrote:
>>>
>>>
>>> On 3/27/24 4:21 PM, Heming Zhao wrote:
>>>> After introducing gd->bg_contig_free_bits, the code path
>>>> 'ocfs2_cluster_group_search() => ocfs2_local_alloc_seen_free_bits()'
>>>> becomes death when all the gd->bg_contig_free_bits are set to the
>>>> correct value. This patch relocates ocfs2_local_alloc_seen_free_bits()
>>>> to a more appropriate location. (The new place being
>>>> ocfs2_block_group_set_bits().)
>>>>
>>>> In ocfs2_local_alloc_seen_free_bits(), the scope of the spin-lock has
>>>> been adjusted to reduce meaningless lock races. e.g: when userspace
>>>> creates & deletes 1 cluster_size files in parallel, acquiring the
>>>> spin-lock in ocfs2_local_alloc_seen_free_bits() is totally pointless and
>>>> impedes IO performance.
>>>>
>>>> Signed-off-by: Heming Zhao <heming.zhao@suse.com>
>>>> ---
>>>> fs/ocfs2/localalloc.c | 15 ++++++++-------
>>>> fs/ocfs2/suballoc.c | 9 ++-------
>>>> 2 files changed, 10 insertions(+), 14 deletions(-)
>>>>
>>>> diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
>>>> index c803c10dd97e..2391b96b8a3b 100644
>>>> --- a/fs/ocfs2/localalloc.c
>>>> +++ b/fs/ocfs2/localalloc.c
>>>> @@ -212,14 +212,15 @@ static inline int ocfs2_la_state_enabled(struct ocfs2_super *osb)
>>>> void ocfs2_local_alloc_seen_free_bits(struct ocfs2_super *osb,
>>>> unsigned int num_clusters)
>>>> {
>>>> - spin_lock(&osb->osb_lock);
>>>> - if (osb->local_alloc_state == OCFS2_LA_DISABLED ||
>>>> - osb->local_alloc_state == OCFS2_LA_THROTTLED)
>>>> - if (num_clusters >= osb->local_alloc_default_bits) {
>>>> + if (num_clusters >= osb->local_alloc_default_bits) {
>>>> + spin_lock(&osb->osb_lock);
>>>> + if (osb->local_alloc_state == OCFS2_LA_DISABLED ||
>>>> + osb->local_alloc_state == OCFS2_LA_THROTTLED)
>>>> cancel_delayed_work(&osb->la_enable_wq);
>>>> - osb->local_alloc_state = OCFS2_LA_ENABLED;
>>>> - }
>>>> - spin_unlock(&osb->osb_lock);
>>>> +
>>>> + osb->local_alloc_state = OCFS2_LA_ENABLED;
>
> Seems the above should be along with cancel_delayed_work()?
Good catch! My stupid mistake.
-Heming
>
>>>> + spin_unlock(&osb->osb_lock);
>>>> + }
>>>
>>> This makes checking osb->local_alloc_default_bits outside osb_lock.
>>>
>>> Joseph
>>
>> I known, in my view, osb->local_alloc_default_bits doesn't change
>> after mounting the volume. So, using osb_lock to protect this
>> variable is pointless.
>>
>
> Okay, it will be only set during fill super, so I think it's fine.
>
next prev parent reply other threads:[~2024-03-28 2:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 8:21 [PATCH v4 0/3] improve write IO performance when fragmentation is high Heming Zhao
2024-03-27 8:21 ` [PATCH v4 1/3] ocfs2: " Heming Zhao
2024-03-27 10:58 ` Joseph Qi
2024-03-27 12:54 ` Heming Zhao
2024-03-28 1:50 ` Joseph Qi
2024-03-28 1:55 ` Heming Zhao
2024-03-27 8:21 ` [PATCH v4 2/3] ocfs2: adjust enabling place for la window Heming Zhao
2024-03-27 11:05 ` Joseph Qi
2024-03-27 12:59 ` Heming Zhao
2024-03-28 1:58 ` Joseph Qi
2024-03-28 2:36 ` Heming Zhao [this message]
2024-03-27 8:21 ` [PATCH v4 3/3] ocfs2: speed up chain-list searching Heming Zhao
2024-03-27 11:17 ` Joseph Qi
2024-03-27 12:59 ` Heming Zhao
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=0c640d4a-295a-4d5a-8193-6d5b936836f8@suse.com \
--to=heming.zhao@suse.com \
--cc=ailiop@suse.com \
--cc=joseph.qi@linux.alibaba.com \
--cc=ocfs2-devel@lists.linux.dev \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).