Skip to content

Commit f7ecac6

Browse files
Vaishali Thakkarjgunthorpe
authored andcommitted
RDMA/rtrs-srv: Rename rtrs_srv to rtrs_srv_sess
Structure rtrs_srv is used for sessions so in order to avoid confusions rename it to rtrs_srv_sess. All changes were done with the help of following Coccinelle script: @@ @@ struct - rtrs_srv + rtrs_srv_sess Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vaishali Thakkar <[email protected]> Signed-off-by: Jack Wang <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent caa84d9 commit f7ecac6

File tree

6 files changed

+43
-42
lines changed

6 files changed

+43
-42
lines changed

drivers/block/rnbd/rnbd-srv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ static void destroy_sess(struct rnbd_srv_session *srv_sess)
263263
kfree(srv_sess);
264264
}
265265

266-
static int create_sess(struct rtrs_srv *rtrs)
266+
static int create_sess(struct rtrs_srv_sess *rtrs)
267267
{
268268
struct rnbd_srv_session *srv_sess;
269269
char pathname[NAME_MAX];
@@ -305,7 +305,7 @@ static int create_sess(struct rtrs_srv *rtrs)
305305
return 0;
306306
}
307307

308-
static int rnbd_srv_link_ev(struct rtrs_srv *rtrs,
308+
static int rnbd_srv_link_ev(struct rtrs_srv_sess *rtrs,
309309
enum rtrs_srv_link_ev ev, void *priv)
310310
{
311311
struct rnbd_srv_session *srv_sess = priv;

drivers/block/rnbd/rnbd-srv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
struct rnbd_srv_session {
2121
/* Entry inside global sess_list */
2222
struct list_head list;
23-
struct rtrs_srv *rtrs;
23+
struct rtrs_srv_sess *rtrs;
2424
char sessname[NAME_MAX];
2525
int queue_depth;
2626
struct bio_set sess_bio_set;

drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static const struct attribute_group rtrs_srv_stats_attr_group = {
154154

155155
static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_path *srv_path)
156156
{
157-
struct rtrs_srv *srv = srv_path->srv;
157+
struct rtrs_srv_sess *srv = srv_path->srv;
158158
int err = 0;
159159

160160
mutex_lock(&srv->paths_mutex);
@@ -199,7 +199,7 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_path *srv_pat
199199
static void
200200
rtrs_srv_destroy_once_sysfs_root_folders(struct rtrs_srv_path *srv_path)
201201
{
202-
struct rtrs_srv *srv = srv_path->srv;
202+
struct rtrs_srv_sess *srv = srv_path->srv;
203203

204204
mutex_lock(&srv->paths_mutex);
205205
if (!--srv->dev_ref) {
@@ -258,7 +258,7 @@ static int rtrs_srv_create_stats_files(struct rtrs_srv_path *srv_path)
258258

259259
int rtrs_srv_create_path_files(struct rtrs_srv_path *srv_path)
260260
{
261-
struct rtrs_srv *srv = srv_path->srv;
261+
struct rtrs_srv_sess *srv = srv_path->srv;
262262
struct rtrs_path *s = &srv_path->s;
263263
char str[NAME_MAX];
264264
int err;

drivers/infiniband/ulp/rtrs/rtrs-srv.c

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static void free_id(struct rtrs_srv_op *id)
108108

109109
static void rtrs_srv_free_ops_ids(struct rtrs_srv_path *srv_path)
110110
{
111-
struct rtrs_srv *srv = srv_path->srv;
111+
struct rtrs_srv_sess *srv = srv_path->srv;
112112
int i;
113113

114114
if (srv_path->ops_ids) {
@@ -137,7 +137,7 @@ static inline void rtrs_srv_inflight_ref_release(struct percpu_ref *ref)
137137

138138
static int rtrs_srv_alloc_ops_ids(struct rtrs_srv_path *srv_path)
139139
{
140-
struct rtrs_srv *srv = srv_path->srv;
140+
struct rtrs_srv_sess *srv = srv_path->srv;
141141
struct rtrs_srv_op *id;
142142
int i, ret;
143143

@@ -541,7 +541,7 @@ EXPORT_SYMBOL(rtrs_srv_resp_rdma);
541541
* @srv: Session pointer
542542
* @priv: The private pointer that is associated with the session.
543543
*/
544-
void rtrs_srv_set_sess_priv(struct rtrs_srv *srv, void *priv)
544+
void rtrs_srv_set_sess_priv(struct rtrs_srv_sess *srv, void *priv)
545545
{
546546
srv->priv = priv;
547547
}
@@ -566,7 +566,7 @@ static void unmap_cont_bufs(struct rtrs_srv_path *srv_path)
566566

567567
static int map_cont_bufs(struct rtrs_srv_path *srv_path)
568568
{
569-
struct rtrs_srv *srv = srv_path->srv;
569+
struct rtrs_srv_sess *srv = srv_path->srv;
570570
struct rtrs_path *ss = &srv_path->s;
571571
int i, mri, err, mrs_num;
572572
unsigned int chunk_bits;
@@ -723,7 +723,7 @@ static void rtrs_srv_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc)
723723

724724
static void rtrs_srv_path_up(struct rtrs_srv_path *srv_path)
725725
{
726-
struct rtrs_srv *srv = srv_path->srv;
726+
struct rtrs_srv_sess *srv = srv_path->srv;
727727
struct rtrs_srv_ctx *ctx = srv->ctx;
728728
int up;
729729

@@ -739,7 +739,7 @@ static void rtrs_srv_path_up(struct rtrs_srv_path *srv_path)
739739

740740
static void rtrs_srv_path_down(struct rtrs_srv_path *srv_path)
741741
{
742-
struct rtrs_srv *srv = srv_path->srv;
742+
struct rtrs_srv_sess *srv = srv_path->srv;
743743
struct rtrs_srv_ctx *ctx = srv->ctx;
744744

745745
if (!srv_path->established)
@@ -756,7 +756,7 @@ static void rtrs_srv_path_down(struct rtrs_srv_path *srv_path)
756756
static bool exist_pathname(struct rtrs_srv_ctx *ctx,
757757
const char *pathname, const uuid_t *path_uuid)
758758
{
759-
struct rtrs_srv *srv;
759+
struct rtrs_srv_sess *srv;
760760
struct rtrs_srv_path *srv_path;
761761
bool found = false;
762762

@@ -973,7 +973,7 @@ static int post_recv_io(struct rtrs_srv_con *con, size_t q_size)
973973

974974
static int post_recv_path(struct rtrs_srv_path *srv_path)
975975
{
976-
struct rtrs_srv *srv = srv_path->srv;
976+
struct rtrs_srv_sess *srv = srv_path->srv;
977977
struct rtrs_path *s = &srv_path->s;
978978
size_t q_size;
979979
int err, cid;
@@ -1000,7 +1000,7 @@ static void process_read(struct rtrs_srv_con *con,
10001000
{
10011001
struct rtrs_path *s = con->c.path;
10021002
struct rtrs_srv_path *srv_path = to_srv_path(s);
1003-
struct rtrs_srv *srv = srv_path->srv;
1003+
struct rtrs_srv_sess *srv = srv_path->srv;
10041004
struct rtrs_srv_ctx *ctx = srv->ctx;
10051005
struct rtrs_srv_op *id;
10061006

@@ -1058,7 +1058,7 @@ static void process_write(struct rtrs_srv_con *con,
10581058
{
10591059
struct rtrs_path *s = con->c.path;
10601060
struct rtrs_srv_path *srv_path = to_srv_path(s);
1061-
struct rtrs_srv *srv = srv_path->srv;
1061+
struct rtrs_srv_sess *srv = srv_path->srv;
10621062
struct rtrs_srv_ctx *ctx = srv->ctx;
10631063
struct rtrs_srv_op *id;
10641064

@@ -1145,7 +1145,7 @@ static void rtrs_srv_inv_rkey_done(struct ib_cq *cq, struct ib_wc *wc)
11451145
struct rtrs_srv_con *con = to_srv_con(wc->qp->qp_context);
11461146
struct rtrs_path *s = con->c.path;
11471147
struct rtrs_srv_path *srv_path = to_srv_path(s);
1148-
struct rtrs_srv *srv = srv_path->srv;
1148+
struct rtrs_srv_sess *srv = srv_path->srv;
11491149
u32 msg_id, off;
11501150
void *data;
11511151

@@ -1202,7 +1202,7 @@ static void rtrs_srv_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
12021202
struct rtrs_srv_con *con = to_srv_con(wc->qp->qp_context);
12031203
struct rtrs_path *s = con->c.path;
12041204
struct rtrs_srv_path *srv_path = to_srv_path(s);
1205-
struct rtrs_srv *srv = srv_path->srv;
1205+
struct rtrs_srv_sess *srv = srv_path->srv;
12061206
u32 imm_type, imm_payload;
12071207
int err;
12081208

@@ -1295,7 +1295,7 @@ static void rtrs_srv_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
12951295
* @pathname: Pathname buffer
12961296
* @len: Length of sessname buffer
12971297
*/
1298-
int rtrs_srv_get_path_name(struct rtrs_srv *srv, char *pathname,
1298+
int rtrs_srv_get_path_name(struct rtrs_srv_sess *srv, char *pathname,
12991299
size_t len)
13001300
{
13011301
struct rtrs_srv_path *srv_path;
@@ -1320,7 +1320,7 @@ EXPORT_SYMBOL(rtrs_srv_get_path_name);
13201320
* rtrs_srv_get_queue_depth() - Get rtrs_srv qdepth.
13211321
* @srv: Session
13221322
*/
1323-
int rtrs_srv_get_queue_depth(struct rtrs_srv *srv)
1323+
int rtrs_srv_get_queue_depth(struct rtrs_srv_sess *srv)
13241324
{
13251325
return srv->queue_depth;
13261326
}
@@ -1346,12 +1346,13 @@ static int rtrs_srv_get_next_cq_vector(struct rtrs_srv_path *srv_path)
13461346

13471347
static void rtrs_srv_dev_release(struct device *dev)
13481348
{
1349-
struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev);
1349+
struct rtrs_srv_sess *srv = container_of(dev, struct rtrs_srv_sess,
1350+
dev);
13501351

13511352
kfree(srv);
13521353
}
13531354

1354-
static void free_srv(struct rtrs_srv *srv)
1355+
static void free_srv(struct rtrs_srv_sess *srv)
13551356
{
13561357
int i;
13571358

@@ -1365,11 +1366,11 @@ static void free_srv(struct rtrs_srv *srv)
13651366
put_device(&srv->dev);
13661367
}
13671368

1368-
static struct rtrs_srv *get_or_create_srv(struct rtrs_srv_ctx *ctx,
1369+
static struct rtrs_srv_sess *get_or_create_srv(struct rtrs_srv_ctx *ctx,
13691370
const uuid_t *paths_uuid,
13701371
bool first_conn)
13711372
{
1372-
struct rtrs_srv *srv;
1373+
struct rtrs_srv_sess *srv;
13731374
int i;
13741375

13751376
mutex_lock(&ctx->srv_mutex);
@@ -1431,7 +1432,7 @@ static struct rtrs_srv *get_or_create_srv(struct rtrs_srv_ctx *ctx,
14311432
return ERR_PTR(-ENOMEM);
14321433
}
14331434

1434-
static void put_srv(struct rtrs_srv *srv)
1435+
static void put_srv(struct rtrs_srv_sess *srv)
14351436
{
14361437
if (refcount_dec_and_test(&srv->refcount)) {
14371438
struct rtrs_srv_ctx *ctx = srv->ctx;
@@ -1445,7 +1446,7 @@ static void put_srv(struct rtrs_srv *srv)
14451446
}
14461447
}
14471448

1448-
static void __add_path_to_srv(struct rtrs_srv *srv,
1449+
static void __add_path_to_srv(struct rtrs_srv_sess *srv,
14491450
struct rtrs_srv_path *srv_path)
14501451
{
14511452
list_add_tail(&srv_path->s.entry, &srv->paths_list);
@@ -1455,7 +1456,7 @@ static void __add_path_to_srv(struct rtrs_srv *srv,
14551456

14561457
static void del_path_from_srv(struct rtrs_srv_path *srv_path)
14571458
{
1458-
struct rtrs_srv *srv = srv_path->srv;
1459+
struct rtrs_srv_sess *srv = srv_path->srv;
14591460

14601461
if (WARN_ON(!srv))
14611462
return;
@@ -1491,7 +1492,7 @@ static int sockaddr_cmp(const struct sockaddr *a, const struct sockaddr *b)
14911492
}
14921493
}
14931494

1494-
static bool __is_path_w_addr_exists(struct rtrs_srv *srv,
1495+
static bool __is_path_w_addr_exists(struct rtrs_srv_sess *srv,
14951496
struct rdma_addr *addr)
14961497
{
14971498
struct rtrs_srv_path *srv_path;
@@ -1574,7 +1575,7 @@ static void rtrs_srv_close_work(struct work_struct *work)
15741575
static int rtrs_rdma_do_accept(struct rtrs_srv_path *srv_path,
15751576
struct rdma_cm_id *cm_id)
15761577
{
1577-
struct rtrs_srv *srv = srv_path->srv;
1578+
struct rtrs_srv_sess *srv = srv_path->srv;
15781579
struct rtrs_msg_conn_rsp msg;
15791580
struct rdma_conn_param param;
15801581
int err;
@@ -1623,7 +1624,7 @@ static int rtrs_rdma_do_reject(struct rdma_cm_id *cm_id, int errno)
16231624
}
16241625

16251626
static struct rtrs_srv_path *
1626-
__find_path(struct rtrs_srv *srv, const uuid_t *sess_uuid)
1627+
__find_path(struct rtrs_srv_sess *srv, const uuid_t *sess_uuid)
16271628
{
16281629
struct rtrs_srv_path *srv_path;
16291630

@@ -1639,7 +1640,7 @@ static int create_con(struct rtrs_srv_path *srv_path,
16391640
struct rdma_cm_id *cm_id,
16401641
unsigned int cid)
16411642
{
1642-
struct rtrs_srv *srv = srv_path->srv;
1643+
struct rtrs_srv_sess *srv = srv_path->srv;
16431644
struct rtrs_path *s = &srv_path->s;
16441645
struct rtrs_srv_con *con;
16451646

@@ -1726,7 +1727,7 @@ static int create_con(struct rtrs_srv_path *srv_path,
17261727
return err;
17271728
}
17281729

1729-
static struct rtrs_srv_path *__alloc_path(struct rtrs_srv *srv,
1730+
static struct rtrs_srv_path *__alloc_path(struct rtrs_srv_sess *srv,
17301731
struct rdma_cm_id *cm_id,
17311732
unsigned int con_num,
17321733
unsigned int recon_cnt,
@@ -1826,7 +1827,7 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_id,
18261827
{
18271828
struct rtrs_srv_ctx *ctx = cm_id->context;
18281829
struct rtrs_srv_path *srv_path;
1829-
struct rtrs_srv *srv;
1830+
struct rtrs_srv_sess *srv;
18301831

18311832
u16 version, con_num, cid;
18321833
u16 recon_cnt;
@@ -2185,7 +2186,7 @@ struct rtrs_srv_ctx *rtrs_srv_open(struct rtrs_srv_ops *ops, u16 port)
21852186
}
21862187
EXPORT_SYMBOL(rtrs_srv_open);
21872188

2188-
static void close_paths(struct rtrs_srv *srv)
2189+
static void close_paths(struct rtrs_srv_sess *srv)
21892190
{
21902191
struct rtrs_srv_path *srv_path;
21912192

@@ -2197,7 +2198,7 @@ static void close_paths(struct rtrs_srv *srv)
21972198

21982199
static void close_ctx(struct rtrs_srv_ctx *ctx)
21992200
{
2200-
struct rtrs_srv *srv;
2201+
struct rtrs_srv_sess *srv;
22012202

22022203
mutex_lock(&ctx->srv_mutex);
22032204
list_for_each_entry(srv, &ctx->srv_list, ctx_list)

drivers/infiniband/ulp/rtrs/rtrs-srv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct rtrs_srv_mr {
7373

7474
struct rtrs_srv_path {
7575
struct rtrs_path s;
76-
struct rtrs_srv *srv;
76+
struct rtrs_srv_sess *srv;
7777
struct work_struct close_work;
7878
enum rtrs_srv_state state;
7979
spinlock_t state_lock;
@@ -90,7 +90,7 @@ struct rtrs_srv_path {
9090
struct rtrs_srv_stats *stats;
9191
};
9292

93-
struct rtrs_srv {
93+
struct rtrs_srv_sess {
9494
struct list_head paths_list;
9595
int paths_up;
9696
struct mutex paths_ev_mutex;

drivers/infiniband/ulp/rtrs/rtrs.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
struct rtrs_permit;
1616
struct rtrs_clt;
1717
struct rtrs_srv_ctx;
18-
struct rtrs_srv;
18+
struct rtrs_srv_sess;
1919
struct rtrs_srv_op;
2020

2121
/*
@@ -163,7 +163,7 @@ struct rtrs_srv_ops {
163163
* @priv: Private data from user if previously set with
164164
* rtrs_srv_set_sess_priv()
165165
*/
166-
int (*link_ev)(struct rtrs_srv *sess, enum rtrs_srv_link_ev ev,
166+
int (*link_ev)(struct rtrs_srv_sess *sess, enum rtrs_srv_link_ev ev,
167167
void *priv);
168168
};
169169

@@ -173,12 +173,12 @@ void rtrs_srv_close(struct rtrs_srv_ctx *ctx);
173173

174174
bool rtrs_srv_resp_rdma(struct rtrs_srv_op *id, int errno);
175175

176-
void rtrs_srv_set_sess_priv(struct rtrs_srv *sess, void *priv);
176+
void rtrs_srv_set_sess_priv(struct rtrs_srv_sess *sess, void *priv);
177177

178-
int rtrs_srv_get_path_name(struct rtrs_srv *sess, char *pathname,
178+
int rtrs_srv_get_path_name(struct rtrs_srv_sess *sess, char *pathname,
179179
size_t len);
180180

181-
int rtrs_srv_get_queue_depth(struct rtrs_srv *sess);
181+
int rtrs_srv_get_queue_depth(struct rtrs_srv_sess *sess);
182182

183183
int rtrs_addr_to_sockaddr(const char *str, size_t len, u16 port,
184184
struct rtrs_addr *addr);

0 commit comments

Comments
 (0)