diff options
author | Guoqing Jiang <guoqing.jiang@cloud.ionos.com> | 2021-04-19 09:37:10 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-04-20 08:59:04 -0600 |
commit | d16b5ac87454996f9fae6d49be0fdcbcb7dbdd58 (patch) | |
tree | 31cf9825d712ea9b6e87840471d91776d0dc24b9 /drivers/block/rnbd | |
parent | 8e43c90a268b9e6fd1529ddda7d61477dd78f1f2 (diff) | |
download | linux-d16b5ac87454996f9fae6d49be0fdcbcb7dbdd58.tar.bz2 |
block/rnbd: Kill destroy_device_cb
We can use destroy_device directly since destroy_device_cb is just the
wrapper of destroy_device.
Signed-off-by: Guoqing Jiang <guoqing.jiang@ionos.com>
Reviewed-by: Danil Kipnis <danil.kipnis@ionos.com>
Signed-off-by: Gioh Kim <gi-oh.kim@ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Link: https://lore.kernel.org/r/20210419073722.15351-8-gi-oh.kim@ionos.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/rnbd')
-rw-r--r-- | drivers/block/rnbd/rnbd-srv.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index a6a68d44f517..a4fd9f167c18 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -178,8 +178,10 @@ err: return err; } -static void destroy_device(struct rnbd_srv_dev *dev) +static void destroy_device(struct kref *kref) { + struct rnbd_srv_dev *dev = container_of(kref, struct rnbd_srv_dev, kref); + WARN_ONCE(!list_empty(&dev->sess_dev_list), "Device %s is being destroyed but still in use!\n", dev->id); @@ -198,18 +200,9 @@ static void destroy_device(struct rnbd_srv_dev *dev) kfree(dev); } -static void destroy_device_cb(struct kref *kref) -{ - struct rnbd_srv_dev *dev; - - dev = container_of(kref, struct rnbd_srv_dev, kref); - - destroy_device(dev); -} - static void rnbd_put_srv_dev(struct rnbd_srv_dev *dev) { - kref_put(&dev->kref, destroy_device_cb); + kref_put(&dev->kref, destroy_device); } void rnbd_destroy_sess_dev(struct rnbd_srv_sess_dev *sess_dev, bool keep_id) |