From: Sun Yangkai <sunk67188@gmail.com>
To: Martin Raiber <martin@urbackup.org>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 6/7] btrfs: Introduce fast path for checking if a block group is done
Date: Tue, 13 Jan 2026 11:48:52 +0800 [thread overview]
Message-ID: <fc1111df-bb59-4aaa-8140-28d75c4bc7e3@gmail.com> (raw)
In-Reply-To: <0102019bb2ff5d8d-eb7c72aa-7327-4cab-af21-38a804adf477-000000@eu-west-1.amazonses.com>
在 2026/1/13 00:17, Martin Raiber 写道:
> A block group cannot switch away from BTRFS_CACHE_FINISHED
> once it enters that state. Therefore we can introduce
> a fast path that checks for the likely case
> that the block group is already cached, avoiding
> a full memory barrier in the likely fast path.
>
> Signed-off-by: Martin Raiber <martin@urbackup.org>
> ---
> fs/btrfs/block-group.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/btrfs/block-group.h b/fs/btrfs/block-group.h
> index cf877747fd56..73bdf7091d49 100644
> --- a/fs/btrfs/block-group.h
> +++ b/fs/btrfs/block-group.h
> @@ -380,6 +380,9 @@ static inline u64 btrfs_system_alloc_profile(struct btrfs_fs_info *fs_info)
>
> static inline int btrfs_block_group_done(const struct btrfs_block_group *cache)
> {
> + if (likely(cache->cached == BTRFS_CACHE_FINISHED))
> + return 1;
> +
> smp_mb();
> return cache->cached == BTRFS_CACHE_FINISHED ||
> cache->cached == BTRFS_CACHE_ERROR;
This function returns bool so maybe we can also fix its return type here.
Thanks,
Sun YangKai
next prev parent reply other threads:[~2026-01-13 3:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260112161549.2786827-1-martin@urbackup.org>
2026-01-12 16:17 ` [PATCH 1/7] btrfs: Use percpu refcounting for block groups Martin Raiber
2026-01-12 22:32 ` Boris Burkov
2026-01-14 6:06 ` kernel test robot
2026-01-12 16:17 ` [PATCH 2/7] btrfs: Use percpu semaphore for space info groups_sem Martin Raiber
2026-01-12 18:58 ` [PATCH v2 " Martin Raiber
2026-01-14 11:06 ` Johannes Thumshirn
2026-01-12 22:58 ` [PATCH " Boris Burkov
2026-01-13 19:15 ` Martin Raiber
2026-01-13 22:27 ` Boris Burkov
2026-01-12 16:17 ` [PATCH 3/7] btrfs: Don't lock data_rwsem if space cache v1 is not used Martin Raiber
2026-01-12 16:17 ` [PATCH 4/7] btrfs: Use percpu sem for block_group_cache_lock Martin Raiber
2026-01-12 16:17 ` [PATCH 6/7] btrfs: Introduce fast path for checking if a block group is done Martin Raiber
2026-01-13 3:48 ` Sun Yangkai [this message]
2026-01-12 16:17 ` [PATCH 5/7] btrfs: Skip locking percpu semaphores on mount Martin Raiber
2026-01-12 16:17 ` [PATCH 7/7] btrfs: Move block group members frequently accessed together closer Martin Raiber
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=fc1111df-bb59-4aaa-8140-28d75c4bc7e3@gmail.com \
--to=sunk67188@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=martin@urbackup.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