From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: damenly.su@gmail.com, linux-btrfs@vger.kernel.org
Cc: Su Yue <Damenly_Su@gmx.com>
Subject: Re: [PATCH 09/10] btrfs-progs: refrom block groups caches structure
Date: Thu, 5 Dec 2019 15:51:53 +0800 [thread overview]
Message-ID: <ea48239e-3bba-beb7-8960-e847f70b4a6f@gmx.com> (raw)
In-Reply-To: <20191205042921.25316-10-Damenly_Su@gmx.com>
[-- Attachment #1.1: Type: text/plain, Size: 2110 bytes --]
On 2019/12/5 下午12:29, damenly.su@gmail.com wrote:
> From: Su Yue <Damenly_Su@gmx.com>
>
> This commit organises block groups cache in
> btrfs_fs_info::block_group_cache_tree. And any dirty block groups are
> linked in transaction_handle::dirty_bgs.
>
> To keep coherence of bisect, it does almost replace in place:
> 1. Replace the old btrfs group lookup functions with new functions
> introduced in former commits.
> 2. set_extent_bits(..., BLOCK_GROUP_DIRYT) things are replaced by linking
> the block group cache into trans::dirty_bgs. Checking and clearing bits
> are transformed too.
> 3. set_extent_bits(..., bit | EXTENT_LOCKED) things are replaced by
> new the btrfs_add_block_group_cache() which inserts caches into
> btrfs_fs_info::block_group_cache_tree directly. Other operations are
> converted to tree operations.
Great cleanup and code unification.
Overall looks good, just small nitpicks inlined below.
>
> Signed-off-by: Su Yue <Damenly_Su@gmx.com>
> ---
> cmds/rescue-chunk-recover.c | 4 +-
> extent-tree.c | 211 ++++++------------------------------
> image/main.c | 5 +-
> transaction.c | 3 +-
> 4 files changed, 38 insertions(+), 185 deletions(-)
>
> diff --git a/cmds/rescue-chunk-recover.c b/cmds/rescue-chunk-recover.c
> index 461b66c6e13b..a13acc015d11 100644
> @@ -2699,25 +2571,22 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info)
> struct btrfs_block_group_cache *cache;
> u64 start;
> u64 end;
> - u64 ptr;
> int ret;
>
> - while(1) {
> - ret = find_first_extent_bit(&info->block_group_cache, 0,
> - &start, &end, (unsigned int)-1);
> - if (ret)
> + while (rb_first(&info->block_group_cache_tree)) {
> + cache = btrfs_lookup_first_block_group(info, 0);
> + if (!cache)
Since we're freeing all block groups, what about
rbtree_postorder_for_each_entry_safe()?
That would be faster than rb_first() as we don't need to balance the tree.
Despite that, the patch looks great to me.
Especially for that -185 part.
Thanks,
Qu
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 520 bytes --]
next prev parent reply other threads:[~2019-12-05 7:52 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-05 4:29 [PATCH 00/10] unify origanization structure of block group cache damenly.su
2019-12-05 4:29 ` [PATCH 01/10] btrfs-progs: handle error if btrfs_write_one_block_group() failed damenly.su
2019-12-05 7:21 ` Qu Wenruo
2019-12-05 4:29 ` [PATCH 02/10] btrfs-progs: block_group: add rb tree related memebers damenly.su
2019-12-05 7:22 ` Qu Wenruo
2019-12-05 4:29 ` [PATCH 03/10] btrfs-progs: port block group cache tree insertion and lookup functions damenly.su
2019-12-05 7:29 ` Qu Wenruo
2019-12-05 8:32 ` Su Yue
2019-12-05 13:41 ` David Sterba
2019-12-05 4:29 ` [PATCH 04/10] btrfs-progs: reform the function block_group_cache_tree_search() damenly.su
2019-12-05 7:38 ` Qu Wenruo
2019-12-05 8:08 ` Su Yue
2019-12-05 4:29 ` [PATCH 05/10] btrfs-progs: adjust function btrfs_lookup_first_block_group_kernel damenly.su
2019-12-05 7:40 ` Qu Wenruo
2019-12-05 8:20 ` Su Yue
2019-12-05 4:29 ` [PATCH 06/10] btrfs-progs: abstract function btrfs_add_block_group_cache() damenly.su
2019-12-05 7:42 ` Qu Wenruo
2019-12-05 4:29 ` [PATCH 07/10] block-progs: block_group: add dirty_bgs list related memebers damenly.su
2019-12-05 7:43 ` Qu Wenruo
2019-12-05 4:29 ` [PATCH 08/10] btrfs-progs: pass @trans to functions touch dirty block groups damenly.su
2019-12-05 7:44 ` Qu Wenruo
2019-12-05 4:29 ` [PATCH 09/10] btrfs-progs: refrom block groups caches structure damenly.su
2019-12-05 7:51 ` Qu Wenruo [this message]
2019-12-05 8:09 ` Su Yue
2019-12-05 4:29 ` [PATCH 10/10] btrfs-progs: cleanups after block group cache reform damenly.su
2019-12-05 7:52 ` Qu Wenruo
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=ea48239e-3bba-beb7-8960-e847f70b4a6f@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=Damenly_Su@gmx.com \
--cc=damenly.su@gmail.com \
--cc=linux-btrfs@vger.kernel.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