mirror of
https://github.com/torvalds/linux.git
synced 2024-11-18 10:01:43 +00:00
RDMA/rxe: Fix misleading comments and names
The names and comments of the 'unlocked' pool APIs are very misleading and not what was intended. This patch replaces 'rxe_xxx_nl' with 'rxe_xxx_locked' with comments indicating that the caller is expected to hold the rxe pool lock. Link: https://lore.kernel.org/r/20210125211641.2694-3-rpearson@hpe.com Reported-by: Hillf Danton <hdanton@sina.com> Suggested-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Bob Pearson <rpearson@hpe.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
parent
c4369575b2
commit
88cc77eb8b
@ -15,18 +15,18 @@ static struct rxe_mc_grp *create_grp(struct rxe_dev *rxe,
|
||||
int err;
|
||||
struct rxe_mc_grp *grp;
|
||||
|
||||
grp = rxe_alloc_nl(&rxe->mc_grp_pool);
|
||||
grp = rxe_alloc_locked(&rxe->mc_grp_pool);
|
||||
if (!grp)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
INIT_LIST_HEAD(&grp->qp_list);
|
||||
spin_lock_init(&grp->mcg_lock);
|
||||
grp->rxe = rxe;
|
||||
rxe_add_key_nl(grp, mgid);
|
||||
rxe_add_key_locked(grp, mgid);
|
||||
|
||||
err = rxe_mcast_add(rxe, mgid);
|
||||
if (unlikely(err)) {
|
||||
rxe_drop_key_nl(grp);
|
||||
rxe_drop_key_locked(grp);
|
||||
rxe_drop_ref(grp);
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
@ -47,7 +47,7 @@ int rxe_mcast_get_grp(struct rxe_dev *rxe, union ib_gid *mgid,
|
||||
|
||||
write_lock_irqsave(&pool->pool_lock, flags);
|
||||
|
||||
grp = rxe_pool_get_key_nl(pool, mgid);
|
||||
grp = rxe_pool_get_key_locked(pool, mgid);
|
||||
if (grp)
|
||||
goto done;
|
||||
|
||||
|
@ -266,7 +266,7 @@ out:
|
||||
return;
|
||||
}
|
||||
|
||||
void __rxe_add_key_nl(struct rxe_pool_entry *elem, void *key)
|
||||
void __rxe_add_key_locked(struct rxe_pool_entry *elem, void *key)
|
||||
{
|
||||
struct rxe_pool *pool = elem->pool;
|
||||
|
||||
@ -280,11 +280,11 @@ void __rxe_add_key(struct rxe_pool_entry *elem, void *key)
|
||||
unsigned long flags;
|
||||
|
||||
write_lock_irqsave(&pool->pool_lock, flags);
|
||||
__rxe_add_key_nl(elem, key);
|
||||
__rxe_add_key_locked(elem, key);
|
||||
write_unlock_irqrestore(&pool->pool_lock, flags);
|
||||
}
|
||||
|
||||
void __rxe_drop_key_nl(struct rxe_pool_entry *elem)
|
||||
void __rxe_drop_key_locked(struct rxe_pool_entry *elem)
|
||||
{
|
||||
struct rxe_pool *pool = elem->pool;
|
||||
|
||||
@ -297,11 +297,11 @@ void __rxe_drop_key(struct rxe_pool_entry *elem)
|
||||
unsigned long flags;
|
||||
|
||||
write_lock_irqsave(&pool->pool_lock, flags);
|
||||
__rxe_drop_key_nl(elem);
|
||||
__rxe_drop_key_locked(elem);
|
||||
write_unlock_irqrestore(&pool->pool_lock, flags);
|
||||
}
|
||||
|
||||
void __rxe_add_index_nl(struct rxe_pool_entry *elem)
|
||||
void __rxe_add_index_locked(struct rxe_pool_entry *elem)
|
||||
{
|
||||
struct rxe_pool *pool = elem->pool;
|
||||
|
||||
@ -315,11 +315,11 @@ void __rxe_add_index(struct rxe_pool_entry *elem)
|
||||
unsigned long flags;
|
||||
|
||||
write_lock_irqsave(&pool->pool_lock, flags);
|
||||
__rxe_add_index_nl(elem);
|
||||
__rxe_add_index_locked(elem);
|
||||
write_unlock_irqrestore(&pool->pool_lock, flags);
|
||||
}
|
||||
|
||||
void __rxe_drop_index_nl(struct rxe_pool_entry *elem)
|
||||
void __rxe_drop_index_locked(struct rxe_pool_entry *elem)
|
||||
{
|
||||
struct rxe_pool *pool = elem->pool;
|
||||
|
||||
@ -333,11 +333,11 @@ void __rxe_drop_index(struct rxe_pool_entry *elem)
|
||||
unsigned long flags;
|
||||
|
||||
write_lock_irqsave(&pool->pool_lock, flags);
|
||||
__rxe_drop_index_nl(elem);
|
||||
__rxe_drop_index_locked(elem);
|
||||
write_unlock_irqrestore(&pool->pool_lock, flags);
|
||||
}
|
||||
|
||||
void *rxe_alloc_nl(struct rxe_pool *pool)
|
||||
void *rxe_alloc_locked(struct rxe_pool *pool)
|
||||
{
|
||||
struct rxe_type_info *info = &rxe_type_info[pool->type];
|
||||
struct rxe_pool_entry *elem;
|
||||
@ -507,7 +507,7 @@ out:
|
||||
return obj;
|
||||
}
|
||||
|
||||
void *rxe_pool_get_key_nl(struct rxe_pool *pool, void *key)
|
||||
void *rxe_pool_get_key_locked(struct rxe_pool *pool, void *key)
|
||||
{
|
||||
struct rxe_type_info *info = &rxe_type_info[pool->type];
|
||||
struct rb_node *node;
|
||||
@ -551,7 +551,7 @@ void *rxe_pool_get_key(struct rxe_pool *pool, void *key)
|
||||
unsigned long flags;
|
||||
|
||||
read_lock_irqsave(&pool->pool_lock, flags);
|
||||
obj = rxe_pool_get_key_nl(pool, key);
|
||||
obj = rxe_pool_get_key_locked(pool, key);
|
||||
read_unlock_irqrestore(&pool->pool_lock, flags);
|
||||
|
||||
return obj;
|
||||
|
@ -106,11 +106,10 @@ int rxe_pool_init(struct rxe_dev *rxe, struct rxe_pool *pool,
|
||||
/* free resources from object pool */
|
||||
void rxe_pool_cleanup(struct rxe_pool *pool);
|
||||
|
||||
/* allocate an object from pool */
|
||||
void *rxe_alloc(struct rxe_pool *pool);
|
||||
/* allocate an object from pool holding and not holding the pool lock */
|
||||
void *rxe_alloc_locked(struct rxe_pool *pool);
|
||||
|
||||
/* allocate an object from pool - no lock */
|
||||
void *rxe_alloc_nl(struct rxe_pool *pool);
|
||||
void *rxe_alloc(struct rxe_pool *pool);
|
||||
|
||||
/* connect already allocated object to pool */
|
||||
int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_entry *elem);
|
||||
@ -118,60 +117,60 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_entry *elem);
|
||||
#define rxe_add_to_pool(pool, obj) __rxe_add_to_pool(pool, &(obj)->pelem)
|
||||
|
||||
/* assign an index to an indexed object and insert object into
|
||||
* pool's rb tree with and without holding the pool_lock
|
||||
* pool's rb tree holding and not holding the pool_lock
|
||||
*/
|
||||
void __rxe_add_index_locked(struct rxe_pool_entry *elem);
|
||||
|
||||
#define rxe_add_index_locked(obj) __rxe_add_index_locked(&(obj)->pelem)
|
||||
|
||||
void __rxe_add_index(struct rxe_pool_entry *elem);
|
||||
|
||||
#define rxe_add_index(obj) __rxe_add_index(&(obj)->pelem)
|
||||
|
||||
void __rxe_add_index_nl(struct rxe_pool_entry *elem);
|
||||
|
||||
#define rxe_add_index_nl(obj) __rxe_add_index_nl(&(obj)->pelem)
|
||||
|
||||
/* drop an index and remove object from rb tree
|
||||
* with and without holding the pool_lock
|
||||
* holding and not holding the pool_lock
|
||||
*/
|
||||
void __rxe_drop_index_locked(struct rxe_pool_entry *elem);
|
||||
|
||||
#define rxe_drop_index_locked(obj) __rxe_drop_index_locked(&(obj)->pelem)
|
||||
|
||||
void __rxe_drop_index(struct rxe_pool_entry *elem);
|
||||
|
||||
#define rxe_drop_index(obj) __rxe_drop_index(&(obj)->pelem)
|
||||
|
||||
void __rxe_drop_index_nl(struct rxe_pool_entry *elem);
|
||||
|
||||
#define rxe_drop_index_nl(obj) __rxe_drop_index_nl(&(obj)->pelem)
|
||||
|
||||
/* assign a key to a keyed object and insert object into
|
||||
* pool's rb tree with and without holding pool_lock
|
||||
* pool's rb tree holding and not holding pool_lock
|
||||
*/
|
||||
void __rxe_add_key_locked(struct rxe_pool_entry *elem, void *key);
|
||||
|
||||
#define rxe_add_key_locked(obj, key) __rxe_add_key_locked(&(obj)->pelem, key)
|
||||
|
||||
void __rxe_add_key(struct rxe_pool_entry *elem, void *key);
|
||||
|
||||
#define rxe_add_key(obj, key) __rxe_add_key(&(obj)->pelem, key)
|
||||
|
||||
void __rxe_add_key_nl(struct rxe_pool_entry *elem, void *key);
|
||||
/* remove elem from rb tree holding and not holding the pool_lock */
|
||||
void __rxe_drop_key_locked(struct rxe_pool_entry *elem);
|
||||
|
||||
#define rxe_add_key_nl(obj, key) __rxe_add_key_nl(&(obj)->pelem, key)
|
||||
#define rxe_drop_key_locked(obj) __rxe_drop_key_locked(&(obj)->pelem)
|
||||
|
||||
/* remove elem from rb tree with and without holding pool_lock */
|
||||
void __rxe_drop_key(struct rxe_pool_entry *elem);
|
||||
|
||||
#define rxe_drop_key(obj) __rxe_drop_key(&(obj)->pelem)
|
||||
|
||||
void __rxe_drop_key_nl(struct rxe_pool_entry *elem);
|
||||
|
||||
#define rxe_drop_key_nl(obj) __rxe_drop_key_nl(&(obj)->pelem)
|
||||
|
||||
/* lookup an indexed object from index with and without holding pool_lock.
|
||||
/* lookup an indexed object from index holding and not holding the pool_lock.
|
||||
* takes a reference on object
|
||||
*/
|
||||
void *rxe_pool_get_index_locked(struct rxe_pool *pool, u32 index);
|
||||
|
||||
void *rxe_pool_get_index(struct rxe_pool *pool, u32 index);
|
||||
|
||||
void *rxe_pool_get_index_nl(struct rxe_pool *pool, u32 index);
|
||||
|
||||
/* lookup keyed object from key with and without holding pool_lock.
|
||||
/* lookup keyed object from key holding and not holding the pool_lock.
|
||||
* takes a reference on the objecti
|
||||
*/
|
||||
void *rxe_pool_get_key(struct rxe_pool *pool, void *key);
|
||||
void *rxe_pool_get_key_locked(struct rxe_pool *pool, void *key);
|
||||
|
||||
void *rxe_pool_get_key_nl(struct rxe_pool *pool, void *key);
|
||||
void *rxe_pool_get_key(struct rxe_pool *pool, void *key);
|
||||
|
||||
/* cleanup an object when all references are dropped */
|
||||
void rxe_elem_release(struct kref *kref);
|
||||
|
Loading…
Reference in New Issue
Block a user