Skip to content

Commit

Permalink
block/rnbd: Kill destroy_device_cb
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Guoqing Jiang authored and Jens Axboe committed Apr 20, 2021
1 parent 8e43c90 commit d16b5ac
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions drivers/block/rnbd/rnbd-srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,10 @@ static int process_rdma(struct rtrs_srv *sess,
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);
Expand All @@ -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)
Expand Down

0 comments on commit d16b5ac

Please sign in to comment.