six locks: Kill six_lock_pcpu_(alloc|free)
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 21 May 2023 00:57:55 +0000 (20:57 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:01 +0000 (17:10 -0400)
commit0d2234a79e877b1bfa71b2c8c712a155be419827
tree3ddf278178dc2b05ce81e20b0ed79dde52b8890d
parent01bf56a9771466147d94a013bc5678d0ed1b1382
six locks: Kill six_lock_pcpu_(alloc|free)

six_lock_pcpu_alloc() is an unsafe interface: it's not safe to allocate
or free the percpu reader count on an existing lock that's in use, the
only safe time to allocate percpu readers is when the lock is first
being initialized.

This patch adds a flags parameter to six_lock_init(), and instead of
six_lock_pcpu_free() we now expose six_lock_exit(), which does the same
thing but is less likely to be misused.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_cache.c
fs/bcachefs/btree_key_cache.c
fs/bcachefs/btree_locking.c
fs/bcachefs/btree_locking.h
fs/bcachefs/six.c
fs/bcachefs/six.h