mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
scsi: sbitmap: Maintain allocation round_robin in sbitmap
Currently the allocation round_robin info is maintained by sbitmap_queue. However, bit allocation really belongs to sbitmap. Move it there. Link: https://lore.kernel.org/r/20210122023317.687987-3-ming.lei@redhat.com Cc: Omar Sandoval <osandov@fb.com> Cc: Kashyap Desai <kashyap.desai@broadcom.com> Cc: Sumanesh Samanta <sumanesh.samanta@broadcom.com> Cc: Ewan D. Milne <emilne@redhat.com> Cc: Hannes Reinecke <hare@suse.de> Cc: virtualization@lists.linux-foundation.org Tested-by: Sumanesh Samanta <sumanesh.samanta@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
4ec5917903
commit
efe1f3a1d5
@@ -56,6 +56,11 @@ struct sbitmap {
|
||||
*/
|
||||
unsigned int map_nr;
|
||||
|
||||
/**
|
||||
* @round_robin: Allocate bits in strict round-robin order.
|
||||
*/
|
||||
bool round_robin;
|
||||
|
||||
/**
|
||||
* @map: Allocated bitmap.
|
||||
*/
|
||||
@@ -124,11 +129,6 @@ struct sbitmap_queue {
|
||||
*/
|
||||
atomic_t ws_active;
|
||||
|
||||
/**
|
||||
* @round_robin: Allocate bits in strict round-robin order.
|
||||
*/
|
||||
bool round_robin;
|
||||
|
||||
/**
|
||||
* @min_shallow_depth: The minimum shallow depth which may be passed to
|
||||
* sbitmap_queue_get_shallow() or __sbitmap_queue_get_shallow().
|
||||
@@ -144,11 +144,14 @@ struct sbitmap_queue {
|
||||
* given, a good default is chosen.
|
||||
* @flags: Allocation flags.
|
||||
* @node: Memory node to allocate on.
|
||||
* @round_robin: If true, be stricter about allocation order; always allocate
|
||||
* starting from the last allocated bit. This is less efficient
|
||||
* than the default behavior (false).
|
||||
*
|
||||
* Return: Zero on success or negative errno on failure.
|
||||
*/
|
||||
int sbitmap_init_node(struct sbitmap *sb, unsigned int depth, int shift,
|
||||
gfp_t flags, int node);
|
||||
gfp_t flags, int node, bool round_robin);
|
||||
|
||||
/**
|
||||
* sbitmap_free() - Free memory used by a &struct sbitmap.
|
||||
@@ -174,15 +177,12 @@ void sbitmap_resize(struct sbitmap *sb, unsigned int depth);
|
||||
* sbitmap_get() - Try to allocate a free bit from a &struct sbitmap.
|
||||
* @sb: Bitmap to allocate from.
|
||||
* @alloc_hint: Hint for where to start searching for a free bit.
|
||||
* @round_robin: If true, be stricter about allocation order; always allocate
|
||||
* starting from the last allocated bit. This is less efficient
|
||||
* than the default behavior (false).
|
||||
*
|
||||
* This operation provides acquire barrier semantics if it succeeds.
|
||||
*
|
||||
* Return: Non-negative allocated bit number if successful, -1 otherwise.
|
||||
*/
|
||||
int sbitmap_get(struct sbitmap *sb, unsigned int alloc_hint, bool round_robin);
|
||||
int sbitmap_get(struct sbitmap *sb, unsigned int alloc_hint);
|
||||
|
||||
/**
|
||||
* sbitmap_get_shallow() - Try to allocate a free bit from a &struct sbitmap,
|
||||
|
Reference in New Issue
Block a user