lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250422112413.GB3659@suse.cz>
Date: Tue, 22 Apr 2025 13:24:13 +0200
From: David Sterba <dsterba@...e.cz>
To: Yangtao Li <frank.li@...o.com>
Cc: clm@...com, josef@...icpanda.com, dsterba@...e.com,
	linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 02/13] btrfs: update __btrfs_lookup_delayed_item to to
 use rb helper

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@...e.com>
> Signed-off-by: Yangtao Li <frank.li@...o.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.
>   *

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ