lightnvm: pblk: stop recreating global caches
authorHans Holmberg <hans.holmberg@cnexlabs.com>
Tue, 9 Oct 2018 11:11:58 +0000 (13:11 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 9 Oct 2018 14:25:07 +0000 (08:25 -0600)
commit1864de94ec9d6e1ae4d481212847374df9b1be41
tree05bf1d0ff69e95206cd7b6950380ff558e24af11
parent63dee3a6c39a5bfa5f299ebb314f2e3e0273092b
lightnvm: pblk: stop recreating global caches

Pblk should not create a set of global caches every time
a pblk instance is created. The global caches should be
made available only when there is one or more pblk instances.

This patch bundles the global caches together with a kref
keeping track of whether the caches should be available or not.

Also, turn the global pblk lock into a mutex that explicitly
protects the caches (as this was the only purpose of the lock).

Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/lightnvm/pblk-init.c