diff options
author | Shaohua Li <shli@fb.com> | 2017-05-01 23:09:21 +0200 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-05-01 23:09:21 +0200 |
commit | e265eb3a30543a237b2ebc4e0422ac82e55b07e4 (patch) | |
tree | 5485bce4a0645e5e9b6ef4686bd390b7b2599ffb /lib | |
parent | Merge tag 'leds_for_4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/j.... (diff) | |
parent | md/raid10: skip spare disk as 'first' disk (diff) | |
download | linux-e265eb3a30543a237b2ebc4e0422ac82e55b07e4.tar.xz linux-e265eb3a30543a237b2ebc4e0422ac82e55b07e4.zip |
Merge branch 'md-next' into md-linus
Diffstat (limited to 'lib')
-rw-r--r-- | lib/percpu-refcount.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c index 9ac959ef4cae..fe03c6d52761 100644 --- a/lib/percpu-refcount.c +++ b/lib/percpu-refcount.c @@ -260,6 +260,22 @@ void percpu_ref_switch_to_atomic(struct percpu_ref *ref, spin_unlock_irqrestore(&percpu_ref_switch_lock, flags); } +EXPORT_SYMBOL_GPL(percpu_ref_switch_to_atomic); + +/** + * percpu_ref_switch_to_atomic_sync - switch a percpu_ref to atomic mode + * @ref: percpu_ref to switch to atomic mode + * + * Schedule switching the ref to atomic mode, and wait for the + * switch to complete. Caller must ensure that no other thread + * will switch back to percpu mode. + */ +void percpu_ref_switch_to_atomic_sync(struct percpu_ref *ref) +{ + percpu_ref_switch_to_atomic(ref, NULL); + wait_event(percpu_ref_switch_waitq, !ref->confirm_switch); +} +EXPORT_SYMBOL_GPL(percpu_ref_switch_to_atomic_sync); /** * percpu_ref_switch_to_percpu - switch a percpu_ref to percpu mode @@ -290,6 +306,7 @@ void percpu_ref_switch_to_percpu(struct percpu_ref *ref) spin_unlock_irqrestore(&percpu_ref_switch_lock, flags); } +EXPORT_SYMBOL_GPL(percpu_ref_switch_to_percpu); /** * percpu_ref_kill_and_confirm - drop the initial ref and schedule confirmation |