From: David Sterba <dsterba@suse.cz>
To: Yangtao Li <frank.li@vivo.com>
Cc: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 02/13] btrfs: update __btrfs_lookup_delayed_item to to use rb helper
Date: Tue, 22 Apr 2025 13:24:13 +0200 [thread overview]
Message-ID: <20250422112413.GB3659@suse.cz> (raw)
In-Reply-To: <20250422081504.1998809-2-frank.li@vivo.com>
On Tue, Apr 22, 2025 at 02:14:53AM -0600, Yangtao Li wrote:
> Update __btrfs_lookup_delayed_item() to use rb_find().
>
> Suggested-by: David Sterba <dsterba@suse.com>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> fs/btrfs/delayed-inode.c | 39 ++++++++++++++++++---------------------
> 1 file changed, 18 insertions(+), 21 deletions(-)
>
> diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
> index 3f1551d8a5c6..dbc1bc1cdf20 100644
> --- a/fs/btrfs/delayed-inode.c
> +++ b/fs/btrfs/delayed-inode.c
> @@ -336,6 +336,20 @@ static struct btrfs_delayed_item *btrfs_alloc_delayed_item(u16 data_len,
> return item;
> }
>
> +static int btrfs_delayed_item_key_cmp(const void *k, const struct rb_node *node)
Please don't use single letter variables, here you can use 'key'
The function name should be something like 'delayed_item_index_cmp' so
it's clear what object and what its member it compares. This applies to
other patches too.
> +{
> + const u64 *index = k;
> + const struct btrfs_delayed_item *delayed_item =
> + rb_entry(node, struct btrfs_delayed_item, rb_node);
> +
> + if (delayed_item->index < *index)
> + return 1;
> + else if (delayed_item->index > *index)
> + return -1;
> +
> + return 0;
> +}
> +
> /*
> * Look up the delayed item by key.
> *
next prev parent reply other threads:[~2025-04-22 11:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-22 8:14 [PATCH 01/13] btrfs: update btrfs_insert_inode_defrag to to use rb helper Yangtao Li
2025-04-22 8:14 ` [PATCH 02/13] btrfs: update __btrfs_lookup_delayed_item " Yangtao Li
2025-04-22 11:24 ` David Sterba [this message]
2025-04-22 8:14 ` [PATCH 03/13] btrfs: update ulist_rbtree_search " Yangtao Li
2025-04-22 8:14 ` [PATCH 04/13] btrfs: update ulist_rbtree_insert " Yangtao Li
2025-04-22 8:14 ` [PATCH 05/13] btrfs: update lookup_block_entry " Yangtao Li
2025-04-22 8:14 ` [PATCH 06/13] btrfs: update insert_block_entry " Yangtao Li
2025-04-22 8:14 ` [PATCH 07/13] btrfs: update lookup_root_entry " Yangtao Li
2025-04-22 8:14 ` [PATCH 08/13] btrfs: update insert_root_entry " Yangtao Li
2025-04-22 8:15 ` [PATCH 09/13] btrfs: update insert_ref_entry " Yangtao Li
2025-04-22 8:15 ` [PATCH 10/13] btrfs: update find_qgroup_rb " Yangtao Li
2025-04-22 8:15 ` [PATCH 11/13] btrfs: update add_qgroup_rb " Yangtao Li
2025-04-22 8:15 ` [PATCH 12/13] btrfs: update btrfs_qgroup_trace_subtree_after_cow " Yangtao Li
2025-04-22 8:15 ` [PATCH 13/13] btrfs: update btrfs_qgroup_add_swapped_blocks " Yangtao Li
2025-04-22 11:21 ` [PATCH 01/13] btrfs: update btrfs_insert_inode_defrag " David Sterba
2025-05-20 5:14 ` Yangtao Li
2025-05-21 7:06 ` David Sterba
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=20250422112413.GB3659@suse.cz \
--to=dsterba@suse.cz \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=frank.li@vivo.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@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