percpu-refcount: cosmetic updates
* s/percpu_ref_release/percpu_ref_func_t/ as it's customary to have _t postfix for types and the type is gonna be used for a different type of callback too. * Add @ARG to function comments. * Drop unnecessary and unaligned indentation from percpu_ref_init() function comment. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Kent Overstreet <koverstreet@google.com>
This commit is contained in:
Родитель
6a24474da8
Коммит
ac899061a9
|
@ -51,7 +51,7 @@
|
||||||
#include <linux/rcupdate.h>
|
#include <linux/rcupdate.h>
|
||||||
|
|
||||||
struct percpu_ref;
|
struct percpu_ref;
|
||||||
typedef void (percpu_ref_release)(struct percpu_ref *);
|
typedef void (percpu_ref_func_t)(struct percpu_ref *);
|
||||||
|
|
||||||
struct percpu_ref {
|
struct percpu_ref {
|
||||||
atomic_t count;
|
atomic_t count;
|
||||||
|
@ -62,11 +62,11 @@ struct percpu_ref {
|
||||||
* percpu_ref_kill_rcu())
|
* percpu_ref_kill_rcu())
|
||||||
*/
|
*/
|
||||||
unsigned __percpu *pcpu_count;
|
unsigned __percpu *pcpu_count;
|
||||||
percpu_ref_release *release;
|
percpu_ref_func_t *release;
|
||||||
struct rcu_head rcu;
|
struct rcu_head rcu;
|
||||||
};
|
};
|
||||||
|
|
||||||
int percpu_ref_init(struct percpu_ref *, percpu_ref_release *);
|
int percpu_ref_init(struct percpu_ref *ref, percpu_ref_func_t *release);
|
||||||
void percpu_ref_kill(struct percpu_ref *ref);
|
void percpu_ref_kill(struct percpu_ref *ref);
|
||||||
|
|
||||||
#define PCPU_STATUS_BITS 2
|
#define PCPU_STATUS_BITS 2
|
||||||
|
@ -78,6 +78,7 @@ void percpu_ref_kill(struct percpu_ref *ref);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* percpu_ref_get - increment a percpu refcount
|
* percpu_ref_get - increment a percpu refcount
|
||||||
|
* @ref: percpu_ref to get
|
||||||
*
|
*
|
||||||
* Analagous to atomic_inc().
|
* Analagous to atomic_inc().
|
||||||
*/
|
*/
|
||||||
|
@ -99,6 +100,7 @@ static inline void percpu_ref_get(struct percpu_ref *ref)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* percpu_ref_put - decrement a percpu refcount
|
* percpu_ref_put - decrement a percpu refcount
|
||||||
|
* @ref: percpu_ref to put
|
||||||
*
|
*
|
||||||
* Decrement the refcount, and if 0, call the release function (which was passed
|
* Decrement the refcount, and if 0, call the release function (which was passed
|
||||||
* to percpu_ref_init())
|
* to percpu_ref_init())
|
||||||
|
|
|
@ -33,8 +33,8 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* percpu_ref_init - initialize a percpu refcount
|
* percpu_ref_init - initialize a percpu refcount
|
||||||
* @ref: ref to initialize
|
* @ref: percpu_ref to initialize
|
||||||
* @release: function which will be called when refcount hits 0
|
* @release: function which will be called when refcount hits 0
|
||||||
*
|
*
|
||||||
* Initializes the refcount in single atomic counter mode with a refcount of 1;
|
* Initializes the refcount in single atomic counter mode with a refcount of 1;
|
||||||
* analagous to atomic_set(ref, 1).
|
* analagous to atomic_set(ref, 1).
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
* Note that @release must not sleep - it may potentially be called from RCU
|
* Note that @release must not sleep - it may potentially be called from RCU
|
||||||
* callback context by percpu_ref_kill().
|
* callback context by percpu_ref_kill().
|
||||||
*/
|
*/
|
||||||
int percpu_ref_init(struct percpu_ref *ref, percpu_ref_release *release)
|
int percpu_ref_init(struct percpu_ref *ref, percpu_ref_func_t *release)
|
||||||
{
|
{
|
||||||
atomic_set(&ref->count, 1 + PCPU_COUNT_BIAS);
|
atomic_set(&ref->count, 1 + PCPU_COUNT_BIAS);
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ static void percpu_ref_kill_rcu(struct rcu_head *rcu)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* percpu_ref_kill - safely drop initial ref
|
* percpu_ref_kill - safely drop initial ref
|
||||||
|
* @ref: percpu_ref to kill
|
||||||
*
|
*
|
||||||
* Must be used to drop the initial ref on a percpu refcount; must be called
|
* Must be used to drop the initial ref on a percpu refcount; must be called
|
||||||
* precisely once before shutdown.
|
* precisely once before shutdown.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче