Commit 02ee80f5 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Jens Axboe

block/rnbd-clt: Remove some arguments from insert_dev_if_not_exists_devpath

Remove 'pathname' and 'sess' since we can dereference it from 'dev'.
Signed-off-by: default avatarGuoqing Jiang <guoqing.jiang@gmx.com>
Reviewed-by: default avatarDanil Kipnis <danil.kipnis@cloud.ionos.com>
Signed-off-by: default avatarGioh Kim <gi-oh.kim@cloud.ionos.com>
Signed-off-by: default avatarJack Wang <jinpu.wang@cloud.ionos.com>
Reviewed-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Link: https://lore.kernel.org/r/20210419073722.15351-4-gi-oh.kim@ionos.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e5f221c7
...@@ -1471,14 +1471,13 @@ static bool exists_devpath(const char *pathname, const char *sessname) ...@@ -1471,14 +1471,13 @@ static bool exists_devpath(const char *pathname, const char *sessname)
return found; return found;
} }
static bool insert_dev_if_not_exists_devpath(const char *pathname, static bool insert_dev_if_not_exists_devpath(struct rnbd_clt_dev *dev)
struct rnbd_clt_session *sess,
struct rnbd_clt_dev *dev)
{ {
bool found; bool found;
struct rnbd_clt_session *sess = dev->sess;
mutex_lock(&sess_lock); mutex_lock(&sess_lock);
found = __exists_dev(pathname, sess->sessname); found = __exists_dev(dev->pathname, sess->sessname);
if (!found) { if (!found) {
mutex_lock(&sess->lock); mutex_lock(&sess->lock);
list_add_tail(&dev->list, &sess->devs_list); list_add_tail(&dev->list, &sess->devs_list);
...@@ -1522,7 +1521,7 @@ struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname, ...@@ -1522,7 +1521,7 @@ struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname,
ret = PTR_ERR(dev); ret = PTR_ERR(dev);
goto put_sess; goto put_sess;
} }
if (insert_dev_if_not_exists_devpath(pathname, sess, dev)) { if (insert_dev_if_not_exists_devpath(dev)) {
ret = -EEXIST; ret = -EEXIST;
goto put_dev; goto put_dev;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment