Commit f3433d79 authored by Vaishali Thakkar's avatar Vaishali Thakkar Committed by Jason Gunthorpe

RDMA/rtrs-clt: Rename rtrs_clt to rtrs_clt_sess

Structure rtrs_clt is used for sessions. So to avoid confusions rename it
to rtrs_clt_sess.

Transformations are done with the help of following coccinelle script.

@@
@@
struct
- rtrs_clt
+ rtrs_clt_sess

Link: https://lore.kernel.org/r/20220105180708.7774-6-jinpu.wang@ionos.comSigned-off-by: default avatarVaishali Thakkar <vaishali.thakkar@ionos.com>
Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent f7ecac6a
...@@ -433,7 +433,7 @@ static void msg_conf(void *priv, int errno) ...@@ -433,7 +433,7 @@ static void msg_conf(void *priv, int errno)
schedule_work(&iu->work); schedule_work(&iu->work);
} }
static int send_usr_msg(struct rtrs_clt *rtrs, int dir, static int send_usr_msg(struct rtrs_clt_sess *rtrs, int dir,
struct rnbd_iu *iu, struct kvec *vec, struct rnbd_iu *iu, struct kvec *vec,
size_t len, struct scatterlist *sg, unsigned int sg_len, size_t len, struct scatterlist *sg, unsigned int sg_len,
void (*conf)(struct work_struct *work), void (*conf)(struct work_struct *work),
...@@ -1010,7 +1010,7 @@ static int rnbd_client_xfer_request(struct rnbd_clt_dev *dev, ...@@ -1010,7 +1010,7 @@ static int rnbd_client_xfer_request(struct rnbd_clt_dev *dev,
struct request *rq, struct request *rq,
struct rnbd_iu *iu) struct rnbd_iu *iu)
{ {
struct rtrs_clt *rtrs = dev->sess->rtrs; struct rtrs_clt_sess *rtrs = dev->sess->rtrs;
struct rtrs_permit *permit = iu->permit; struct rtrs_permit *permit = iu->permit;
struct rnbd_msg_io msg; struct rnbd_msg_io msg;
struct rtrs_clt_req_ops req_ops; struct rtrs_clt_req_ops req_ops;
......
...@@ -75,7 +75,7 @@ struct rnbd_cpu_qlist { ...@@ -75,7 +75,7 @@ struct rnbd_cpu_qlist {
struct rnbd_clt_session { struct rnbd_clt_session {
struct list_head list; struct list_head list;
struct rtrs_clt *rtrs; struct rtrs_clt_sess *rtrs;
wait_queue_head_t rtrs_waitq; wait_queue_head_t rtrs_waitq;
bool rtrs_ready; bool rtrs_ready;
struct rnbd_cpu_qlist __percpu struct rnbd_cpu_qlist __percpu
......
...@@ -50,7 +50,8 @@ static ssize_t max_reconnect_attempts_show(struct device *dev, ...@@ -50,7 +50,8 @@ static ssize_t max_reconnect_attempts_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *page) char *page)
{ {
struct rtrs_clt *clt = container_of(dev, struct rtrs_clt, dev); struct rtrs_clt_sess *clt = container_of(dev, struct rtrs_clt_sess,
dev);
return sysfs_emit(page, "%d\n", return sysfs_emit(page, "%d\n",
rtrs_clt_get_max_reconnect_attempts(clt)); rtrs_clt_get_max_reconnect_attempts(clt));
...@@ -63,7 +64,8 @@ static ssize_t max_reconnect_attempts_store(struct device *dev, ...@@ -63,7 +64,8 @@ static ssize_t max_reconnect_attempts_store(struct device *dev,
{ {
int value; int value;
int ret; int ret;
struct rtrs_clt *clt = container_of(dev, struct rtrs_clt, dev); struct rtrs_clt_sess *clt = container_of(dev, struct rtrs_clt_sess,
dev);
ret = kstrtoint(buf, 10, &value); ret = kstrtoint(buf, 10, &value);
if (ret) { if (ret) {
...@@ -90,9 +92,9 @@ static ssize_t mpath_policy_show(struct device *dev, ...@@ -90,9 +92,9 @@ static ssize_t mpath_policy_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *page) char *page)
{ {
struct rtrs_clt *clt; struct rtrs_clt_sess *clt;
clt = container_of(dev, struct rtrs_clt, dev); clt = container_of(dev, struct rtrs_clt_sess, dev);
switch (clt->mp_policy) { switch (clt->mp_policy) {
case MP_POLICY_RR: case MP_POLICY_RR:
...@@ -114,12 +116,12 @@ static ssize_t mpath_policy_store(struct device *dev, ...@@ -114,12 +116,12 @@ static ssize_t mpath_policy_store(struct device *dev,
const char *buf, const char *buf,
size_t count) size_t count)
{ {
struct rtrs_clt *clt; struct rtrs_clt_sess *clt;
int value; int value;
int ret; int ret;
size_t len = 0; size_t len = 0;
clt = container_of(dev, struct rtrs_clt, dev); clt = container_of(dev, struct rtrs_clt_sess, dev);
ret = kstrtoint(buf, 10, &value); ret = kstrtoint(buf, 10, &value);
if (!ret && (value == MP_POLICY_RR || if (!ret && (value == MP_POLICY_RR ||
...@@ -169,12 +171,12 @@ static ssize_t add_path_store(struct device *dev, ...@@ -169,12 +171,12 @@ static ssize_t add_path_store(struct device *dev,
.src = &srcaddr, .src = &srcaddr,
.dst = &dstaddr .dst = &dstaddr
}; };
struct rtrs_clt *clt; struct rtrs_clt_sess *clt;
const char *nl; const char *nl;
size_t len; size_t len;
int err; int err;
clt = container_of(dev, struct rtrs_clt, dev); clt = container_of(dev, struct rtrs_clt_sess, dev);
nl = strchr(buf, '\n'); nl = strchr(buf, '\n');
if (nl) if (nl)
...@@ -425,7 +427,7 @@ static const struct attribute_group rtrs_clt_path_attr_group = { ...@@ -425,7 +427,7 @@ static const struct attribute_group rtrs_clt_path_attr_group = {
int rtrs_clt_create_path_files(struct rtrs_clt_path *clt_path) int rtrs_clt_create_path_files(struct rtrs_clt_path *clt_path)
{ {
struct rtrs_clt *clt = clt_path->clt; struct rtrs_clt_sess *clt = clt_path->clt;
char str[NAME_MAX]; char str[NAME_MAX];
int err; int err;
struct rtrs_addr path = { struct rtrs_addr path = {
...@@ -497,12 +499,12 @@ static const struct attribute_group rtrs_clt_attr_group = { ...@@ -497,12 +499,12 @@ static const struct attribute_group rtrs_clt_attr_group = {
.attrs = rtrs_clt_attrs, .attrs = rtrs_clt_attrs,
}; };
int rtrs_clt_create_sysfs_root_files(struct rtrs_clt *clt) int rtrs_clt_create_sysfs_root_files(struct rtrs_clt_sess *clt)
{ {
return sysfs_create_group(&clt->dev.kobj, &rtrs_clt_attr_group); return sysfs_create_group(&clt->dev.kobj, &rtrs_clt_attr_group);
} }
void rtrs_clt_destroy_sysfs_root(struct rtrs_clt *clt) void rtrs_clt_destroy_sysfs_root(struct rtrs_clt_sess *clt)
{ {
sysfs_remove_group(&clt->dev.kobj, &rtrs_clt_attr_group); sysfs_remove_group(&clt->dev.kobj, &rtrs_clt_attr_group);
......
This diff is collapsed.
...@@ -126,7 +126,7 @@ struct rtrs_rbuf { ...@@ -126,7 +126,7 @@ struct rtrs_rbuf {
struct rtrs_clt_path { struct rtrs_clt_path {
struct rtrs_path s; struct rtrs_path s;
struct rtrs_clt *clt; struct rtrs_clt_sess *clt;
wait_queue_head_t state_wq; wait_queue_head_t state_wq;
enum rtrs_clt_state state; enum rtrs_clt_state state;
atomic_t connected_cnt; atomic_t connected_cnt;
...@@ -153,7 +153,7 @@ struct rtrs_clt_path { ...@@ -153,7 +153,7 @@ struct rtrs_clt_path {
*mp_skip_entry; *mp_skip_entry;
}; };
struct rtrs_clt { struct rtrs_clt_sess {
struct list_head paths_list; /* rcu protected list */ struct list_head paths_list; /* rcu protected list */
size_t paths_num; size_t paths_num;
struct rtrs_clt_path struct rtrs_clt_path
...@@ -191,25 +191,26 @@ static inline struct rtrs_clt_path *to_clt_path(struct rtrs_path *s) ...@@ -191,25 +191,26 @@ static inline struct rtrs_clt_path *to_clt_path(struct rtrs_path *s)
return container_of(s, struct rtrs_clt_path, s); return container_of(s, struct rtrs_clt_path, s);
} }
static inline int permit_size(struct rtrs_clt *clt) static inline int permit_size(struct rtrs_clt_sess *clt)
{ {
return sizeof(struct rtrs_permit) + clt->pdu_sz; return sizeof(struct rtrs_permit) + clt->pdu_sz;
} }
static inline struct rtrs_permit *get_permit(struct rtrs_clt *clt, int idx) static inline struct rtrs_permit *get_permit(struct rtrs_clt_sess *clt,
int idx)
{ {
return (struct rtrs_permit *)(clt->permits + permit_size(clt) * idx); return (struct rtrs_permit *)(clt->permits + permit_size(clt) * idx);
} }
int rtrs_clt_reconnect_from_sysfs(struct rtrs_clt_path *path); int rtrs_clt_reconnect_from_sysfs(struct rtrs_clt_path *path);
void rtrs_clt_close_conns(struct rtrs_clt_path *clt_path, bool wait); void rtrs_clt_close_conns(struct rtrs_clt_path *clt_path, bool wait);
int rtrs_clt_create_path_from_sysfs(struct rtrs_clt *clt, int rtrs_clt_create_path_from_sysfs(struct rtrs_clt_sess *clt,
struct rtrs_addr *addr); struct rtrs_addr *addr);
int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt_path *path, int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt_path *path,
const struct attribute *sysfs_self); const struct attribute *sysfs_self);
void rtrs_clt_set_max_reconnect_attempts(struct rtrs_clt *clt, int value); void rtrs_clt_set_max_reconnect_attempts(struct rtrs_clt_sess *clt, int value);
int rtrs_clt_get_max_reconnect_attempts(const struct rtrs_clt *clt); int rtrs_clt_get_max_reconnect_attempts(const struct rtrs_clt_sess *clt);
void free_path(struct rtrs_clt_path *clt_path); void free_path(struct rtrs_clt_path *clt_path);
/* rtrs-clt-stats.c */ /* rtrs-clt-stats.c */
...@@ -239,8 +240,8 @@ ssize_t rtrs_clt_reset_all_help(struct rtrs_clt_stats *stats, ...@@ -239,8 +240,8 @@ ssize_t rtrs_clt_reset_all_help(struct rtrs_clt_stats *stats,
/* rtrs-clt-sysfs.c */ /* rtrs-clt-sysfs.c */
int rtrs_clt_create_sysfs_root_files(struct rtrs_clt *clt); int rtrs_clt_create_sysfs_root_files(struct rtrs_clt_sess *clt);
void rtrs_clt_destroy_sysfs_root(struct rtrs_clt *clt); void rtrs_clt_destroy_sysfs_root(struct rtrs_clt_sess *clt);
int rtrs_clt_create_path_files(struct rtrs_clt_path *clt_path); int rtrs_clt_create_path_files(struct rtrs_clt_path *clt_path);
void rtrs_clt_destroy_path_files(struct rtrs_clt_path *clt_path, void rtrs_clt_destroy_path_files(struct rtrs_clt_path *clt_path,
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
struct rtrs_permit; struct rtrs_permit;
struct rtrs_clt; struct rtrs_clt_sess;
struct rtrs_srv_ctx; struct rtrs_srv_ctx;
struct rtrs_srv_sess; struct rtrs_srv_sess;
struct rtrs_srv_op; struct rtrs_srv_op;
...@@ -52,14 +52,14 @@ struct rtrs_clt_ops { ...@@ -52,14 +52,14 @@ struct rtrs_clt_ops {
void (*link_ev)(void *priv, enum rtrs_clt_link_ev ev); void (*link_ev)(void *priv, enum rtrs_clt_link_ev ev);
}; };
struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops *ops, struct rtrs_clt_sess *rtrs_clt_open(struct rtrs_clt_ops *ops,
const char *pathname, const char *pathname,
const struct rtrs_addr *paths, const struct rtrs_addr *paths,
size_t path_cnt, u16 port, size_t path_cnt, u16 port,
size_t pdu_sz, u8 reconnect_delay_sec, size_t pdu_sz, u8 reconnect_delay_sec,
s16 max_reconnect_attempts, u32 nr_poll_queues); s16 max_reconnect_attempts, u32 nr_poll_queues);
void rtrs_clt_close(struct rtrs_clt *clt_path); void rtrs_clt_close(struct rtrs_clt_sess *clt);
enum wait_type { enum wait_type {
RTRS_PERMIT_NOWAIT = 0, RTRS_PERMIT_NOWAIT = 0,
...@@ -77,11 +77,12 @@ enum rtrs_clt_con_type { ...@@ -77,11 +77,12 @@ enum rtrs_clt_con_type {
RTRS_IO_CON RTRS_IO_CON
}; };
struct rtrs_permit *rtrs_clt_get_permit(struct rtrs_clt *sess, struct rtrs_permit *rtrs_clt_get_permit(struct rtrs_clt_sess *sess,
enum rtrs_clt_con_type con_type, enum rtrs_clt_con_type con_type,
enum wait_type wait); enum wait_type wait);
void rtrs_clt_put_permit(struct rtrs_clt *sess, struct rtrs_permit *permit); void rtrs_clt_put_permit(struct rtrs_clt_sess *sess,
struct rtrs_permit *permit);
/** /**
* rtrs_clt_req_ops - it holds the request confirmation callback * rtrs_clt_req_ops - it holds the request confirmation callback
...@@ -98,10 +99,10 @@ struct rtrs_clt_req_ops { ...@@ -98,10 +99,10 @@ struct rtrs_clt_req_ops {
}; };
int rtrs_clt_request(int dir, struct rtrs_clt_req_ops *ops, int rtrs_clt_request(int dir, struct rtrs_clt_req_ops *ops,
struct rtrs_clt *sess, struct rtrs_permit *permit, struct rtrs_clt_sess *sess, struct rtrs_permit *permit,
const struct kvec *vec, size_t nr, size_t len, const struct kvec *vec, size_t nr, size_t len,
struct scatterlist *sg, unsigned int sg_cnt); struct scatterlist *sg, unsigned int sg_cnt);
int rtrs_clt_rdma_cq_direct(struct rtrs_clt *clt, unsigned int index); int rtrs_clt_rdma_cq_direct(struct rtrs_clt_sess *clt, unsigned int index);
/** /**
* rtrs_attrs - RTRS session attributes * rtrs_attrs - RTRS session attributes
...@@ -112,7 +113,7 @@ struct rtrs_attrs { ...@@ -112,7 +113,7 @@ struct rtrs_attrs {
u32 max_segments; u32 max_segments;
}; };
int rtrs_clt_query(struct rtrs_clt *sess, struct rtrs_attrs *attr); int rtrs_clt_query(struct rtrs_clt_sess *sess, struct rtrs_attrs *attr);
/* /*
* Here goes RTRS server API * Here goes RTRS server API
......
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