[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <44uujjsiacvtswckacusnt3blcbmfvyrzzuu77lejmua5nulrx@lmovehtaw6hb>
Date: Tue, 29 Jul 2025 11:36:40 +0200
From: Jan Kara <jack@...e.cz>
To: Yu Kuai <yukuai1@...weicloud.com>
Cc: jack@...e.cz, axboe@...nel.dk, akpm@...ux-foundation.org,
yang.yang@...o.com, dlemoal@...nel.org, ming.lei@...hat.com,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org, yukuai3@...wei.com,
yi.zhang@...wei.com, yangerkun@...wei.com, johnny.chenyi@...wei.com
Subject: Re: [PATCH v2 2/2] lib/sbitmap: make sbitmap_get_shallow() static
On Tue 29-07-25 11:19:06, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@...wei.com>
>
> Because it is only used in sbitmap.c
>
> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
> Reviewed-by: Damien Le Moal <dlemoal@...nel.org>
Indeed. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
> include/linux/sbitmap.h | 17 -----------------
> lib/sbitmap.c | 18 ++++++++++++++++--
> 2 files changed, 16 insertions(+), 19 deletions(-)
>
> diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
> index 4adf4b364fcd..ffb9907c7070 100644
> --- a/include/linux/sbitmap.h
> +++ b/include/linux/sbitmap.h
> @@ -209,23 +209,6 @@ void sbitmap_resize(struct sbitmap *sb, unsigned int depth);
> */
> int sbitmap_get(struct sbitmap *sb);
>
> -/**
> - * sbitmap_get_shallow() - Try to allocate a free bit from a &struct sbitmap,
> - * limiting the depth used from each word.
> - * @sb: Bitmap to allocate from.
> - * @shallow_depth: The maximum number of bits to allocate from the bitmap.
> - *
> - * This rather specific operation allows for having multiple users with
> - * different allocation limits. E.g., there can be a high-priority class that
> - * uses sbitmap_get() and a low-priority class that uses sbitmap_get_shallow()
> - * with a @shallow_depth of (sb->depth >> 1). Then, the low-priority
> - * class can only allocate half of the total bits in the bitmap, preventing it
> - * from starving out the high-priority class.
> - *
> - * Return: Non-negative allocated bit number if successful, -1 otherwise.
> - */
> -int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth);
> -
> /**
> * sbitmap_any_bit_set() - Check for a set bit in a &struct sbitmap.
> * @sb: Bitmap to check.
> diff --git a/lib/sbitmap.c b/lib/sbitmap.c
> index f2e90ac6b56e..5e3c35086253 100644
> --- a/lib/sbitmap.c
> +++ b/lib/sbitmap.c
> @@ -306,7 +306,22 @@ static int __sbitmap_get_shallow(struct sbitmap *sb,
> return sbitmap_find_bit(sb, shallow_depth, index, alloc_hint, true);
> }
>
> -int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth)
> +/**
> + * sbitmap_get_shallow() - Try to allocate a free bit from a &struct sbitmap,
> + * limiting the depth used from each word.
> + * @sb: Bitmap to allocate from.
> + * @shallow_depth: The maximum number of bits to allocate from the bitmap.
> + *
> + * This rather specific operation allows for having multiple users with
> + * different allocation limits. E.g., there can be a high-priority class that
> + * uses sbitmap_get() and a low-priority class that uses sbitmap_get_shallow()
> + * with a @shallow_depth of (sb->depth >> 1). Then, the low-priority
> + * class can only allocate half of the total bits in the bitmap, preventing it
> + * from starving out the high-priority class.
> + *
> + * Return: Non-negative allocated bit number if successful, -1 otherwise.
> + */
> +static int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth)
> {
> int nr;
> unsigned int hint, depth;
> @@ -321,7 +336,6 @@ int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth)
>
> return nr;
> }
> -EXPORT_SYMBOL_GPL(sbitmap_get_shallow);
>
> bool sbitmap_any_bit_set(const struct sbitmap *sb)
> {
> --
> 2.39.2
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists