]> git.baikalelectronics.ru Git - kernel.git/commit
lightnvm: pblk: avoid ref warning on cache creation
authorJavier González <javier@javigon.com>
Tue, 11 Dec 2018 19:16:21 +0000 (20:16 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 11 Dec 2018 19:22:34 +0000 (12:22 -0700)
commit424cb8dfa6285100f536af89f55d82e14bc01ff7
treecf6d0cf36fb17c73e75606ef2f9247fad68ef25f
parent105b9df43c484b910f7475929520fb04e32be8ce
lightnvm: pblk: avoid ref warning on cache creation

The current kref implementation around pblk global caches triggers a
false positive on refcount_inc_checked() (when called) as the kref is
initialized to 0. Instead of usint kref_inc() on a 0 reference, which is
in principle correct, use kref_init() to avoid the check. This is also
more explicit about what actually happens on cache creation.

In the process, do a small refactoring to use kref helpers.

Fixes: 764c657f2b7dc "lightnvm: pblk: stop recreating global caches"
Signed-off-by: Javier González <javier@cnexlabs.com>
Reviewed-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