lib/sbitmap: make sbitmap_get_shallow() internal

Because it's only used in sbitmap.c

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20250807032413.1469456-3-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by Yu Kuai and committed by Jens Axboe 45fa9f97 42e6c6ce

+16 -19
-17
include/linux/sbitmap.h
··· 210 210 int sbitmap_get(struct sbitmap *sb); 211 211 212 212 /** 213 - * sbitmap_get_shallow() - Try to allocate a free bit from a &struct sbitmap, 214 - * limiting the depth used from each word. 215 - * @sb: Bitmap to allocate from. 216 - * @shallow_depth: The maximum number of bits to allocate from the bitmap. 217 - * 218 - * This rather specific operation allows for having multiple users with 219 - * different allocation limits. E.g., there can be a high-priority class that 220 - * uses sbitmap_get() and a low-priority class that uses sbitmap_get_shallow() 221 - * with a @shallow_depth of (sb->depth >> 1). Then, the low-priority 222 - * class can only allocate half of the total bits in the bitmap, preventing it 223 - * from starving out the high-priority class. 224 - * 225 - * Return: Non-negative allocated bit number if successful, -1 otherwise. 226 - */ 227 - int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth); 228 - 229 - /** 230 213 * sbitmap_any_bit_set() - Check for a set bit in a &struct sbitmap. 231 214 * @sb: Bitmap to check. 232 215 *
+16 -2
lib/sbitmap.c
··· 307 307 return sbitmap_find_bit(sb, shallow_depth, index, alloc_hint, true); 308 308 } 309 309 310 - int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth) 310 + /** 311 + * sbitmap_get_shallow() - Try to allocate a free bit from a &struct sbitmap, 312 + * limiting the depth used from each word. 313 + * @sb: Bitmap to allocate from. 314 + * @shallow_depth: The maximum number of bits to allocate from the bitmap. 315 + * 316 + * This rather specific operation allows for having multiple users with 317 + * different allocation limits. E.g., there can be a high-priority class that 318 + * uses sbitmap_get() and a low-priority class that uses sbitmap_get_shallow() 319 + * with a @shallow_depth of (sb->depth >> 1). Then, the low-priority 320 + * class can only allocate half of the total bits in the bitmap, preventing it 321 + * from starving out the high-priority class. 322 + * 323 + * Return: Non-negative allocated bit number if successful, -1 otherwise. 324 + */ 325 + static int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth) 311 326 { 312 327 int nr; 313 328 unsigned int hint, depth; ··· 337 322 338 323 return nr; 339 324 } 340 - EXPORT_SYMBOL_GPL(sbitmap_get_shallow); 341 325 342 326 bool sbitmap_any_bit_set(const struct sbitmap *sb) 343 327 {