[PATCH RFC 10/12] RDMA/rtrs-srv: Remove paths_num

Guoqing Jiang
2022-11-13T01:09:01Z

The paths_num is only increased by rtrs_rdma_connect -> __alloc_path
which is only one time thing, so is the decreasing of it given only
rtrs_srv_close_work -> del_path_from_srv, which means paths_num should
always be 1.

Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
drivers/infiniband/ulp/rtrs/rtrs-srv.c | 8 --------
drivers/infiniband/ulp/rtrs/rtrs-srv.h | 1 -
2 files changed, 9 deletions(-)

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
index e2ea09a8def7..400cf8ae34a3 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
@@ -1437,8 +1437,6 @@ static void __add_path_to_srv(struct rtrs_srv_sess *srv,
struct rtrs_srv_path *srv_path)
{
list_add_tail(&srv_path->s.entry, &srv->paths_list);
- srv->paths_num++;
- WARN_ON(srv->paths_num >= MAX_PATHS_NUM);
}

static void del_path_from_srv(struct rtrs_srv_path *srv_path)
@@ -1450,8 +1448,6 @@ static void del_path_from_srv(struct rtrs_srv_path *srv_path)

mutex_lock(&srv->paths_mutex);
list_del(&srv_path->s.entry);
- WARN_ON(!srv->paths_num);
- srv->paths_num--;
mutex_unlock(&srv->paths_mutex);
}

@@ -1719,10 +1715,6 @@ static struct rtrs_srv_path *__alloc_path(struct rtrs_srv_sess *srv,
char str[NAME_MAX];
struct rtrs_addr path;

- if (srv->paths_num >= MAX_PATHS_NUM) {
- err = -ECONNRESET;
- goto err;
- }
if (__is_path_w_addr_exists(srv, &cm_id->route.addr)) {
err = -EEXIST;
pr_err("Path with same addr exists\n");
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.h b/drivers/infiniband/ulp/rtrs/rtrs-srv.h
index eccc432b0715..8e4fcb578f49 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.h
+++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.h
@@ -100,7 +100,6 @@ struct rtrs_srv_sess {
struct list_head paths_list;
int paths_up;
struct mutex paths_ev_mutex;
- size_t paths_num;
struct mutex paths_mutex;
uuid_t paths_uuid;
refcount_t refcount;
--
2.31.1