Skip to content

Commit 45fa9f9

Browse files
YuKuai-huaweiaxboe
authored andcommitted
lib/sbitmap: make sbitmap_get_shallow() internal
Because it's only used in sbitmap.c Signed-off-by: Yu Kuai <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 42e6c6c commit 45fa9f9

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

include/linux/sbitmap.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -209,23 +209,6 @@ void sbitmap_resize(struct sbitmap *sb, unsigned int depth);
209209
*/
210210
int sbitmap_get(struct sbitmap *sb);
211211

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-
229212
/**
230213
* sbitmap_any_bit_set() - Check for a set bit in a &struct sbitmap.
231214
* @sb: Bitmap to check.

lib/sbitmap.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,22 @@ static int __sbitmap_get_shallow(struct sbitmap *sb,
307307
return sbitmap_find_bit(sb, shallow_depth, index, alloc_hint, true);
308308
}
309309

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)
311326
{
312327
int nr;
313328
unsigned int hint, depth;
@@ -322,7 +337,6 @@ int sbitmap_get_shallow(struct sbitmap *sb, unsigned long shallow_depth)
322337

323338
return nr;
324339
}
325-
EXPORT_SYMBOL_GPL(sbitmap_get_shallow);
326340

327341
bool sbitmap_any_bit_set(const struct sbitmap *sb)
328342
{

0 commit comments

Comments
 (0)