Skip to contentSkip to conversation

rnbd-srv: remove 'dir' argument from rnbd_srv_rdma_ev

PATCH In review Guoqing Jiang 3 participants 16 messages Aug 26, 2022 – Aug 30, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rnbd-srv: remove 'dir' argument from rnbd_srv_rdma_ev

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

---
 drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
 drivers/block/rnbd/rnbd-srv.h          | 1 +
 drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
 drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
 4 files changed, 8 insertions(+), 9 deletions(-)
drivers/block/rnbd/rnbd-srv.c +4 -5
index 3f6c268e04ef..9600715f1029 100644
@@ -368,10 +368,9 @@ static int process_msg_sess_info(struct rnbd_srv_session *srv_sess,
 				 const void *msg, size_t len,
 				 void *data, size_t datalen);
 
-static int rnbd_srv_rdma_ev(void *priv,
-			    struct rtrs_srv_op *id, int dir,
-			    void *data, size_t datalen, const void *usr,
-			    size_t usrlen)
+static int rnbd_srv_rdma_ev(void *priv, struct rtrs_srv_op *id,
+			    void *data, size_t datalen,
+			    const void *usr, size_t usrlen)
 {
 	struct rnbd_srv_session *srv_sess = priv;
 	const struct rnbd_msg_hdr *hdr = usr;
@@ -398,7 +397,7 @@ static int rnbd_srv_rdma_ev(void *priv,
 		break;
 	default:
 		pr_warn("Received unexpected message type %d with dir %d from session %s\n",
-			type, dir, srv_sess->sessname);
+			type, id->dir, srv_sess->sessname);
 		return -EINVAL;
 	}
 
drivers/block/rnbd/rnbd-srv.h +1 -0
index 081bceaf4ae9..5a0ef6c2b5c7 100644
@@ -14,6 +14,7 @@
 #include <linux/kref.h>
 
 #include <rtrs.h>
+#include <rtrs-srv.h>
 #include "rnbd-proto.h"
 #include "rnbd-log.h"
 
drivers/infiniband/ulp/rtrs/rtrs-srv.c +2 -2
index 34c03bde5064..9dc50ff0e1b9 100644
@@ -1024,7 +1024,7 @@ static void process_read(struct rtrs_srv_con *con,
 	usr_len = le16_to_cpu(msg->usr_len);
 	data_len = off - usr_len;
 	data = page_address(srv->chunks[buf_id]);
-	ret = ctx->ops.rdma_ev(srv->priv, id, READ, data, data_len,
+	ret = ctx->ops.rdma_ev(srv->priv, id, data, data_len,
 			   data + data_len, usr_len);
 
 	if (ret) {
@@ -1077,7 +1077,7 @@ static void process_write(struct rtrs_srv_con *con,
 	usr_len = le16_to_cpu(req->usr_len);
 	data_len = off - usr_len;
 	data = page_address(srv->chunks[buf_id]);
-	ret = ctx->ops.rdma_ev(srv->priv, id, WRITE, data, data_len,
+	ret = ctx->ops.rdma_ev(srv->priv, id, data, data_len,
 			       data + data_len, usr_len);
 	if (ret) {
 		rtrs_err_rl(s,
drivers/infiniband/ulp/rtrs/rtrs.h +1 -2
index 5e57a7ccc7fb..b48b53a7c143 100644
@@ -139,7 +139,6 @@ struct rtrs_srv_ops {
 
 	 *	@priv:		Private data set by rtrs_srv_set_sess_priv()
 	 *	@id:		internal RTRS operation id
-	 *	@dir:		READ/WRITE
 	 *	@data:		Pointer to (bidirectional) rdma memory area:
 	 *			- in case of %RTRS_SRV_RDMA_EV_RECV contains
 	 *			data sent by the client
@@ -151,7 +150,7 @@ struct rtrs_srv_ops {
 	 *	@usrlen:	Size of the user message
 	 */
 	int (*rdma_ev)(void *priv,
-		       struct rtrs_srv_op *id, int dir,
+		       struct rtrs_srv_op *id,
 		       void *data, size_t datalen, const void *usr,
 		       size_t usrlen);
 	/**
Signature · 1 line
2.31.1
maintainer
#1 lore raw
Quoted 44 lines · Guoqing Jiang

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

---
 drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
 drivers/block/rnbd/rnbd-srv.h          | 1 +
 drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
 drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
 4 files changed, 8 insertions(+), 9 deletions(-)
drivers/block/rnbd/rnbd-srv.c +4 -5
index 3f6c268e04ef..9600715f1029 100644
@@ -368,10 +368,9 @@ static int process_msg_sess_info(struct rnbd_srv_session *srv_sess,
                                 const void *msg, size_t len,
                                 void *data, size_t datalen);
 
-static int rnbd_srv_rdma_ev(void *priv,
-                           struct rtrs_srv_op *id, int dir,
-                           void *data, size_t datalen, const void *usr,
-                           size_t usrlen)
+static int rnbd_srv_rdma_ev(void *priv, struct rtrs_srv_op *id,
+                           void *data, size_t datalen,
+                           const void *usr, size_t usrlen)
 {
        struct rnbd_srv_session *srv_sess = priv;
        const struct rnbd_msg_hdr *hdr = usr;
@@ -398,7 +397,7 @@ static int rnbd_srv_rdma_ev(void *priv,
                break;
        default:
                pr_warn("Received unexpected message type %d with dir %d from session %s\n",
-                       type, dir, srv_sess->sessname);
+                       type, id->dir, srv_sess->sessname);
                return -EINVAL;
        }
 
drivers/block/rnbd/rnbd-srv.h +0 -0
index 081bceaf4ae9..5a0ef6c2b5c7 100644

drivers/block/rnbd/rnbd-srv.h line 17

Quoted 4 lines
drivers/block/rnbd/rnbd-srv.h +1 -0
@@ -14,6 +14,7 @@
 #include <linux/kref.h>
 
 #include <rtrs.h>
+#include <rtrs-srv.h>

why do we need this?

Quoted 49 lines
drivers/block/rnbd/rnbd-srv.h +0 -0
 #include "rnbd-proto.h"
 #include "rnbd-log.h"
 
drivers/infiniband/ulp/rtrs/rtrs-srv.c +2 -2
index 34c03bde5064..9dc50ff0e1b9 100644
@@ -1024,7 +1024,7 @@ static void process_read(struct rtrs_srv_con *con,
        usr_len = le16_to_cpu(msg->usr_len);
        data_len = off - usr_len;
        data = page_address(srv->chunks[buf_id]);
-       ret = ctx->ops.rdma_ev(srv->priv, id, READ, data, data_len,
+       ret = ctx->ops.rdma_ev(srv->priv, id, data, data_len,
                           data + data_len, usr_len);
 
        if (ret) {
@@ -1077,7 +1077,7 @@ static void process_write(struct rtrs_srv_con *con,
        usr_len = le16_to_cpu(req->usr_len);
        data_len = off - usr_len;
        data = page_address(srv->chunks[buf_id]);
-       ret = ctx->ops.rdma_ev(srv->priv, id, WRITE, data, data_len,
+       ret = ctx->ops.rdma_ev(srv->priv, id, data, data_len,
                               data + data_len, usr_len);
        if (ret) {
                rtrs_err_rl(s,
drivers/infiniband/ulp/rtrs/rtrs.h +1 -3
index 5e57a7ccc7fb..b48b53a7c143 100644
@@ -139,7 +139,6 @@ struct rtrs_srv_ops {
 
         *      @priv:          Private data set by rtrs_srv_set_sess_priv()
         *      @id:            internal RTRS operation id
-        *      @dir:           READ/WRITE
         *      @data:          Pointer to (bidirectional) rdma memory area:
         *                      - in case of %RTRS_SRV_RDMA_EV_RECV contains
         *                      data sent by the client
@@ -151,7 +150,7 @@ struct rtrs_srv_ops {
         *      @usrlen:        Size of the user message
         */
        int (*rdma_ev)(void *priv,
-                      struct rtrs_srv_op *id, int dir,
+                      struct rtrs_srv_op *id,
                       void *data, size_t datalen, const void *usr,
                       size_t usrlen);
        /**
--

2.31.1

#2 lore raw
Quoted 46 lines · Jinpu Wang
Quoted 45 lines · Guoqing Jiang

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

---
  drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
  drivers/block/rnbd/rnbd-srv.h          | 1 +
  drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
  drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
  4 files changed, 8 insertions(+), 9 deletions(-)
drivers/block/rnbd/rnbd-srv.c +4 -5
index 3f6c268e04ef..9600715f1029 100644
@@ -368,10 +368,9 @@ static int process_msg_sess_info(struct rnbd_srv_session *srv_sess,
                                  const void *msg, size_t len,
                                  void *data, size_t datalen);
 
-static int rnbd_srv_rdma_ev(void *priv,
-                           struct rtrs_srv_op *id, int dir,
-                           void *data, size_t datalen, const void *usr,
-                           size_t usrlen)
+static int rnbd_srv_rdma_ev(void *priv, struct rtrs_srv_op *id,
+                           void *data, size_t datalen,
+                           const void *usr, size_t usrlen)
  {
         struct rnbd_srv_session *srv_sess = priv;
         const struct rnbd_msg_hdr *hdr = usr;
@@ -398,7 +397,7 @@ static int rnbd_srv_rdma_ev(void *priv,
                 break;
         default:
                 pr_warn("Received unexpected message type %d with dir %d from session %s\n",
-                       type, dir, srv_sess->sessname);
+                       type, id->dir, srv_sess->sessname);
                 return -EINVAL;
         }
 
drivers/block/rnbd/rnbd-srv.h +0 -0
index 081bceaf4ae9..5a0ef6c2b5c7 100644
@@ -14,6 +14,7 @@
  #include <linux/kref.h>
 
Quoted 3 lines

drivers/block/rnbd/rnbd-srv.h line 17

Quoted 2 lines
drivers/block/rnbd/rnbd-srv.h +1 -0
  #include <rtrs.h>
+#include <rtrs-srv.h>

why do we need this?

Otherwise, compiler complains

drivers/block/rnbd/rnbd-srv.c: In function ‘rnbd_srv_rdma_ev’:
drivers/block/rnbd/rnbd-srv.c:400:33: error: invalid use of undefined type ‘struct rtrs_srv_op’ 400 |                         type, id->dir, srv_sess->sessname);

Thanks,
Guoqing

maintainer
#3 lore raw
Quoted 56 lines · Guoqing Jiang
Quoted 46 lines · Jinpu Wang
Quoted 45 lines · Guoqing Jiang

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

---
  drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
  drivers/block/rnbd/rnbd-srv.h          | 1 +
  drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
  drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
  4 files changed, 8 insertions(+), 9 deletions(-)
drivers/block/rnbd/rnbd-srv.c +4 -5
index 3f6c268e04ef..9600715f1029 100644
@@ -368,10 +368,9 @@ static int process_msg_sess_info(struct rnbd_srv_session *srv_sess,
                                  const void *msg, size_t len,
                                  void *data, size_t datalen);
 
-static int rnbd_srv_rdma_ev(void *priv,
-                           struct rtrs_srv_op *id, int dir,
-                           void *data, size_t datalen, const void *usr,
-                           size_t usrlen)
+static int rnbd_srv_rdma_ev(void *priv, struct rtrs_srv_op *id,
+                           void *data, size_t datalen,
+                           const void *usr, size_t usrlen)
  {
         struct rnbd_srv_session *srv_sess = priv;
         const struct rnbd_msg_hdr *hdr = usr;
@@ -398,7 +397,7 @@ static int rnbd_srv_rdma_ev(void *priv,
                 break;
         default:
                 pr_warn("Received unexpected message type %d with dir %d from session %s\n",
-                       type, dir, srv_sess->sessname);
+                       type, id->dir, srv_sess->sessname);
                 return -EINVAL;
         }
 
drivers/block/rnbd/rnbd-srv.h +0 -0
index 081bceaf4ae9..5a0ef6c2b5c7 100644
@@ -14,6 +14,7 @@
  #include <linux/kref.h>
 
Quoted 3 lines

drivers/block/rnbd/rnbd-srv.h line 17

Quoted 2 lines
drivers/block/rnbd/rnbd-srv.h +1 -0
  #include <rtrs.h>
+#include <rtrs-srv.h>

why do we need this?

Otherwise, compiler complains

Quoted 7 lines

drivers/block/rnbd/rnbd-srv.c: In function ‘rnbd_srv_rdma_ev’:
drivers/block/rnbd/rnbd-srv.c:400:33: error: invalid use of undefined type ‘struct rtrs_srv_op’
400 | type, id->dir, srv_sess->sessname);

Thanks,
Guoqing

ah, okay, this reminds me, why we have dir there, we don't want to export too much detail regarding the rtrs_srv_op to rnbd-server, it is supposed to be transparent to rnbd-srv.

#4 lore raw
Quoted 60 lines · Jinpu Wang
Quoted 59 lines · Guoqing Jiang
Quoted 46 lines · Jinpu Wang
Quoted 45 lines · Guoqing Jiang

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

---
   drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
   drivers/block/rnbd/rnbd-srv.h          | 1 +
   drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
   drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
   4 files changed, 8 insertions(+), 9 deletions(-)
drivers/block/rnbd/rnbd-srv.c +4 -5
index 3f6c268e04ef..9600715f1029 100644
@@ -368,10 +368,9 @@ static int process_msg_sess_info(struct rnbd_srv_session *srv_sess,
                                   const void *msg, size_t len,
                                   void *data, size_t datalen);
 
-static int rnbd_srv_rdma_ev(void *priv,
-                           struct rtrs_srv_op *id, int dir,
-                           void *data, size_t datalen, const void *usr,
-                           size_t usrlen)
+static int rnbd_srv_rdma_ev(void *priv, struct rtrs_srv_op *id,
+                           void *data, size_t datalen,
+                           const void *usr, size_t usrlen)
   {
          struct rnbd_srv_session *srv_sess = priv;
          const struct rnbd_msg_hdr *hdr = usr;
@@ -398,7 +397,7 @@ static int rnbd_srv_rdma_ev(void *priv,
                  break;
          default:
                  pr_warn("Received unexpected message type %d with dir %d from session %s\n",
-                       type, dir, srv_sess->sessname);
+                       type, id->dir, srv_sess->sessname);
                  return -EINVAL;
          }
 
drivers/block/rnbd/rnbd-srv.h +0 -0
index 081bceaf4ae9..5a0ef6c2b5c7 100644
@@ -14,6 +14,7 @@
   #include <linux/kref.h>
 
Quoted 3 lines

drivers/block/rnbd/rnbd-srv.h line 17

Quoted 2 lines
drivers/block/rnbd/rnbd-srv.h +1 -0
   #include <rtrs.h>
+#include <rtrs-srv.h>

why do we need this?

Otherwise, compiler complains

drivers/block/rnbd/rnbd-srv.c: In function ‘rnbd_srv_rdma_ev’:
drivers/block/rnbd/rnbd-srv.c:400:33: error: invalid use of undefined type ‘struct rtrs_srv_op’

    400 |                         type, id->dir, srv_sess->sessname);
Quoted 5 lines
Quoted 2 lines

Thanks,
Guoqing

ah, okay, this reminds me, why we have dir there, we don't want to export too much detail regarding the rtrs_srv_op to rnbd-server, it is supposed to be transparent to rnbd-srv.

What is the issue with more details are exported from rtrs-srv? Both of the modules are run in the same machine.

And I guess we can just pass parameters with register after remove an argument, otherwise need to push/pop stack with more than six parameters for x64.

Thanks,
Guoqing

maintainer
#5 lore raw
Quoted 66 lines · Guoqing Jiang
Quoted 62 lines · Jinpu Wang
Quoted 61 lines · Guoqing Jiang
Quoted 46 lines · Jinpu Wang
Quoted 45 lines · Guoqing Jiang

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

---
   drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
   drivers/block/rnbd/rnbd-srv.h          | 1 +
   drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
   drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
   4 files changed, 8 insertions(+), 9 deletions(-)
drivers/block/rnbd/rnbd-srv.c +4 -5
index 3f6c268e04ef..9600715f1029 100644
@@ -368,10 +368,9 @@ static int process_msg_sess_info(struct rnbd_srv_session *srv_sess,
                                   const void *msg, size_t len,
                                   void *data, size_t datalen);
 
-static int rnbd_srv_rdma_ev(void *priv,
-                           struct rtrs_srv_op *id, int dir,
-                           void *data, size_t datalen, const void *usr,
-                           size_t usrlen)
+static int rnbd_srv_rdma_ev(void *priv, struct rtrs_srv_op *id,
+                           void *data, size_t datalen,
+                           const void *usr, size_t usrlen)
   {
          struct rnbd_srv_session *srv_sess = priv;
          const struct rnbd_msg_hdr *hdr = usr;
@@ -398,7 +397,7 @@ static int rnbd_srv_rdma_ev(void *priv,
                  break;
          default:
                  pr_warn("Received unexpected message type %d with dir %d from session %s\n",
-                       type, dir, srv_sess->sessname);
+                       type, id->dir, srv_sess->sessname);
                  return -EINVAL;
          }
 
drivers/block/rnbd/rnbd-srv.h +0 -0
index 081bceaf4ae9..5a0ef6c2b5c7 100644
@@ -14,6 +14,7 @@
   #include <linux/kref.h>
 
Quoted 3 lines

drivers/block/rnbd/rnbd-srv.h line 17

Quoted 2 lines
drivers/block/rnbd/rnbd-srv.h +1 -0
   #include <rtrs.h>
+#include <rtrs-srv.h>

why do we need this?

Otherwise, compiler complains

drivers/block/rnbd/rnbd-srv.c: In function ‘rnbd_srv_rdma_ev’:
drivers/block/rnbd/rnbd-srv.c:400:33: error: invalid use of undefined type ‘struct rtrs_srv_op’

    400 |                         type, id->dir, srv_sess->sessname);

Thanks,
Guoqing

Quoted 7 lines
Quoted 3 lines

ah, okay, this reminds me, why we have dir there, we don't want to export too much detail regarding the rtrs_srv_op to rnbd-server, it is supposed to be transparent to rnbd-srv.

What is the issue with more details are exported from rtrs-srv? Both of the modules
are run in the same machine.

with including rtrs-srv.h, the code size is bigger, not to mention many unnecessary
info are exported to rnbd-srv module, ideally we want to have rnbd/rtrs layered properly
with clear separation.

Quoted 4 lines

And I guess we can just pass parameters with register after remove an argument,
otherwise need to push/pop stack with more than six parameters for x64.

I doubt it makes any notable performance change.

Quoted 3 lines

Thanks,
Guoqing

Thx!

#6 lore raw
Quoted 4 lines · Jinpu Wang
Quoted 3 lines

And I guess we can just pass parameters with register after remove an argument,
otherwise need to push/pop stack with more than six parameters for x64.

I doubt it makes any notable performance change.

I think it is called in the IO path (process_read and process_write) ...

BTW, do you agree if the 'usr' can be dropped from rdma_ev given it is always same as 'data + data_len'?

Thanks,
Guoqing

maintainer
#7 lore raw
Quoted 7 lines · Guoqing Jiang
Quoted 3 lines · Jinpu Wang
Quoted 3 lines

And I guess we can just pass parameters with register after remove an argument,
otherwise need to push/pop stack with more than six parameters for x64.

Quoted 7 lines
Quoted 1 line

I doubt it makes any notable performance change.

I think it is called in the IO path (process_read and process_write) ...

BTW, do you agree if the 'usr' can be dropped from rdma_ev given it is always
same as 'data + data_len'?

in the current form, yes, usr can be dropped. we can add later if there is a need.

Quoted 3 lines

Thanks,
Guoqing

Thx!

#8 lore raw
In reply to Jinpu Wang
Quoted 16 lines · Jinpu Wang
Quoted 15 lines · Guoqing Jiang
Quoted 11 lines · Jinpu Wang
Quoted 10 lines · Guoqing Jiang

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

---
  drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
  drivers/block/rnbd/rnbd-srv.h          | 1 +
  drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
  drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
  4 files changed, 8 insertions(+), 9 deletions(-)

<...>

Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Quoted 2 lines

#include <rtrs.h>
+#include <rtrs-srv.h>

why do we need this?

Otherwise, compiler complains

drivers/block/rnbd/rnbd-srv.c: In function ‘rnbd_srv_rdma_ev’:
drivers/block/rnbd/rnbd-srv.c:400:33: error: invalid use of undefined type ‘struct rtrs_srv_op’
400 | type, id->dir, srv_sess->sessname);

Quoted 5 lines
Quoted 2 lines

Thanks,
Guoqing

ah, okay, this reminds me, why we have dir there, we don't want to export too much detail regarding the rtrs_srv_op to rnbd-server, it is supposed to be transparent to rnbd-srv.

So decouple it from rtrs-srv.h and hide everything that not-needed to be exported to separate header file.

Thanks

#9 lore raw
In reply to Guoqing Jiang
Quoted 10 lines · Guoqing Jiang

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

---
 drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
 drivers/block/rnbd/rnbd-srv.h          | 1 +
 drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
 drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
 4 files changed, 8 insertions(+), 9 deletions(-)

I applied the patch and cleanup of rtrs-srv.h can be done later.

Thanks

#10 lore raw
Quoted 12 lines · Leon Romanovsky
Quoted 10 lines · Guoqing Jiang

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

---
  drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
  drivers/block/rnbd/rnbd-srv.h          | 1 +
  drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
  drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
  4 files changed, 8 insertions(+), 9 deletions(-)
Quoted 1 line

I applied the patch and cleanup of rtrs-srv.h can be done later.

Thanks! I suppose below

Quoted 2 lines

So decouple it from rtrs-srv.h and hide everything that not-needed to be exported to separate header file.

means move 'struct rtrs_srv_op' to rtrs.h, which seems not appropriate to me because both client and server include the header. Pls correct me if I am wrong.

Since process_{read,write} prints direction info if ctx->ops.rdma_ev fails, how about remove the 'dir' info from rnbd_srv_rdma_ev? Then we  don't need to include rtrs-srv.h.

drivers/block/rnbd/rnbd-srv.c +0 -0
index 431c6da19d3f..d07ff3ba560c 100644
@@ -387,8 +387,8 @@ static int rnbd_srv_rdma_ev(void *priv, struct rtrs_srv_op *id,

                                            datalen);
                break;
        default:
-               pr_warn("Received unexpected message type %d with dir %d from session %s\n", -                       type, id->dir, srv_sess->sessname);
+               pr_warn("Received unexpected message type %d from session %s\n", +                       type, srv_sess->sessname);
                return -EINVAL;
        }

drivers/block/rnbd/rnbd-srv.h +0 -0
index 5a0ef6c2b5c7..081bceaf4ae9 100644
@@ -14,7 +14,6 @@

 #include <linux/kref.h>

 #include <rtrs.h>
-#include <rtrs-srv.h>
 #include "rnbd-proto.h"
 #include "rnbd-log.h"

Thoughts?

Thanks,
Guoqing

maintainer
#11 lore raw
Quoted 63 lines · Guoqing Jiang
Quoted 12 lines · Leon Romanovsky
Quoted 10 lines · Guoqing Jiang

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

---
  drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
  drivers/block/rnbd/rnbd-srv.h          | 1 +
  drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
  drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
  4 files changed, 8 insertions(+), 9 deletions(-)
Quoted 1 line

I applied the patch and cleanup of rtrs-srv.h can be done later.

Thanks! I suppose below

Quoted 2 lines

So decouple it from rtrs-srv.h and hide everything that not-needed to be exported to separate header file.

means move 'struct rtrs_srv_op' to rtrs.h, which seems not appropriate to me because both client and server include the header. Pls correct me if I am wrong.

Since process_{read,write} prints direction info if ctx->ops.rdma_ev fails, how
about remove the 'dir' info from rnbd_srv_rdma_ev? Then we don't need to include rtrs-srv.h.

drivers/block/rnbd/rnbd-srv.c +2 -2
index 431c6da19d3f..d07ff3ba560c 100644
@@ -387,8 +387,8 @@ static int rnbd_srv_rdma_ev(void *priv, struct
 rtrs_srv_op *id,
                                             datalen);
                 break;
         default:
-               pr_warn("Received unexpected message type %d with dir %d
 from session %s\n",
-                       type, id->dir, srv_sess->sessname);
+               pr_warn("Received unexpected message type %d from
 session %s\n",
+                       type, srv_sess->sessname);
                 return -EINVAL;
         }
drivers/block/rnbd/rnbd-srv.h +0 -1
index 5a0ef6c2b5c7..081bceaf4ae9 100644
@@ -14,7 +14,6 @@
  #include <linux/kref.h>
 
  #include <rtrs.h>
-#include <rtrs-srv.h>
  #include "rnbd-proto.h"
  #include "rnbd-log.h"
 
Quoted 1 line

Thoughts?

I like the idea. Please post a formal patch based on leon's
https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/log/?h=wip/leon-for-next

Thx!

Quoted 3 lines

Thanks,
Guoqing

#12 lore raw
Quoted 64 lines · Jinpu Wang
Quoted 63 lines · Guoqing Jiang
Quoted 12 lines · Leon Romanovsky
Quoted 10 lines · Guoqing Jiang

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

---
  drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
  drivers/block/rnbd/rnbd-srv.h          | 1 +
  drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
  drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
  4 files changed, 8 insertions(+), 9 deletions(-)
Quoted 1 line

I applied the patch and cleanup of rtrs-srv.h can be done later.

Thanks! I suppose below

Quoted 2 lines

So decouple it from rtrs-srv.h and hide everything that not-needed to be exported to separate header file.

means move 'struct rtrs_srv_op' to rtrs.h, which seems not appropriate to me because both client and server include the header. Pls correct me if I am wrong.

Since process_{read,write} prints direction info if ctx->ops.rdma_ev fails, how
about remove the 'dir' info from rnbd_srv_rdma_ev? Then we don't need to include rtrs-srv.h.

drivers/block/rnbd/rnbd-srv.c +2 -2
index 431c6da19d3f..d07ff3ba560c 100644
@@ -387,8 +387,8 @@ static int rnbd_srv_rdma_ev(void *priv, struct
 rtrs_srv_op *id,
                                             datalen);
                 break;
         default:
-               pr_warn("Received unexpected message type %d with dir %d
 from session %s\n",
-                       type, id->dir, srv_sess->sessname);
+               pr_warn("Received unexpected message type %d from
 session %s\n",
+                       type, srv_sess->sessname);
                 return -EINVAL;
         }
drivers/block/rnbd/rnbd-srv.h +0 -1
index 5a0ef6c2b5c7..081bceaf4ae9 100644
@@ -14,7 +14,6 @@
  #include <linux/kref.h>
 
  #include <rtrs.h>
-#include <rtrs-srv.h>
  #include "rnbd-proto.h"
  #include "rnbd-log.h"
 
Quoted 3 lines
Quoted 1 line

Thoughts?

I like the idea. Please post a formal patch based on leon's
https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/log/?h=wip/leon-for-next

I squashed this hunk into original patch.

Thanks

Quoted 5 lines

Thx!

Quoted 3 lines

Thanks,
Guoqing

#13 lore raw
Quoted 61 lines · Leon Romanovsky
Quoted 60 lines · Jinpu Wang
Quoted 59 lines · Guoqing Jiang
Quoted 4 lines · Leon Romanovsky
Quoted 3 lines · Guoqing Jiang

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

Quoted 8 lines
Quoted 7 lines
---
   drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
   drivers/block/rnbd/rnbd-srv.h          | 1 +
   drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
   drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
   4 files changed, 8 insertions(+), 9 deletions(-)

I applied the patch and cleanup of rtrs-srv.h can be done later.

Thanks! I suppose below

Quoted 2 lines

So decouple it from rtrs-srv.h and hide everything that not-needed to be exported to separate header file.

means move 'struct rtrs_srv_op' to rtrs.h, which seems not appropriate to me because both client and server include the header. Pls correct me if I am wrong.

Since process_{read,write} prints direction info if ctx->ops.rdma_ev fails, how
about remove the 'dir' info from rnbd_srv_rdma_ev? Then we don't need to include rtrs-srv.h.

drivers/block/rnbd/rnbd-srv.c +2 -2
index 431c6da19d3f..d07ff3ba560c 100644
@@ -387,8 +387,8 @@ static int rnbd_srv_rdma_ev(void *priv, struct
 rtrs_srv_op *id,
                                              datalen);
                  break;
          default:
-               pr_warn("Received unexpected message type %d with dir %d
 from session %s\n",
-                       type, id->dir, srv_sess->sessname);
+               pr_warn("Received unexpected message type %d from
 session %s\n",
+                       type, srv_sess->sessname);
                  return -EINVAL;
          }
drivers/block/rnbd/rnbd-srv.h +0 -1
index 5a0ef6c2b5c7..081bceaf4ae9 100644
@@ -14,7 +14,6 @@
   #include <linux/kref.h>
 
   #include <rtrs.h>
-#include <rtrs-srv.h>
   #include "rnbd-proto.h"
   #include "rnbd-log.h"
 
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

Thoughts?

I like the idea. Please post a formal patch based on leon's
https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/log/?h=wip/leon-for-next

I squashed this hunk into original patch.

Great, thank you!

If possible, to better reflect the change, please at your convenience to replace the original commit message with below.

"Since process_{read,write} already prints direction info if ctx->ops.rdma_ev fails, no need to pass 'dir'"

Thanks,
Guoqing

#14 lore raw
Quoted 69 lines · Guoqing Jiang
Quoted 61 lines · Leon Romanovsky
Quoted 60 lines · Jinpu Wang
Quoted 59 lines · Guoqing Jiang
Quoted 4 lines · Leon Romanovsky
Quoted 3 lines · Guoqing Jiang

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

Quoted 8 lines
Quoted 7 lines
---
   drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
   drivers/block/rnbd/rnbd-srv.h          | 1 +
   drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
   drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
   4 files changed, 8 insertions(+), 9 deletions(-)

I applied the patch and cleanup of rtrs-srv.h can be done later.

Thanks! I suppose below

Quoted 2 lines

So decouple it from rtrs-srv.h and hide everything that not-needed to be exported to separate header file.

means move 'struct rtrs_srv_op' to rtrs.h, which seems not appropriate to me because both client and server include the header. Pls correct me if I am wrong.

Since process_{read,write} prints direction info if ctx->ops.rdma_ev fails, how
about remove the 'dir' info from rnbd_srv_rdma_ev? Then we don't need to include rtrs-srv.h.

drivers/block/rnbd/rnbd-srv.c +2 -2
index 431c6da19d3f..d07ff3ba560c 100644
@@ -387,8 +387,8 @@ static int rnbd_srv_rdma_ev(void *priv, struct
 rtrs_srv_op *id,
                                              datalen);
                  break;
          default:
-               pr_warn("Received unexpected message type %d with dir %d
 from session %s\n",
-                       type, id->dir, srv_sess->sessname);
+               pr_warn("Received unexpected message type %d from
 session %s\n",
+                       type, srv_sess->sessname);
                  return -EINVAL;
          }
drivers/block/rnbd/rnbd-srv.h +0 -1
index 5a0ef6c2b5c7..081bceaf4ae9 100644
@@ -14,7 +14,6 @@
   #include <linux/kref.h>
 
   #include <rtrs.h>
-#include <rtrs-srv.h>
   #include "rnbd-proto.h"
   #include "rnbd-log.h"
 
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

Thoughts?

I like the idea. Please post a formal patch based on leon's
https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/log/?h=wip/leon-for-next

I squashed this hunk into original patch.

Quoted 8 lines

Great, thank you!

If possible, to better reflect the change, please at your convenience to replace the original commit
message with below.

"Since process_{read,write} already prints direction info if ctx->ops.rdma_ev fails, no need to pass 'dir'"

Done, as long as patches are in wip/* branches, we can rebase them.

Thanks

Quoted 3 lines

Thanks,
Guoqing

maintainer
#15 lore raw
In reply to Leon Romanovsky
Quoted 66 lines · Leon Romanovsky
Quoted 64 lines · Jinpu Wang
Quoted 63 lines · Guoqing Jiang
Quoted 12 lines · Leon Romanovsky
Quoted 10 lines · Guoqing Jiang

Since all callers (process_{read,write}) set id->dir, no need to pass 'dir' again.

---
  drivers/block/rnbd/rnbd-srv.c          | 9 ++++-----
  drivers/block/rnbd/rnbd-srv.h          | 1 +
  drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
  drivers/infiniband/ulp/rtrs/rtrs.h     | 3 +--
  4 files changed, 8 insertions(+), 9 deletions(-)
Quoted 1 line

I applied the patch and cleanup of rtrs-srv.h can be done later.

Thanks! I suppose below

Quoted 2 lines

So decouple it from rtrs-srv.h and hide everything that not-needed to be exported to separate header file.

means move 'struct rtrs_srv_op' to rtrs.h, which seems not appropriate to me because both client and server include the header. Pls correct me if I am wrong.

Since process_{read,write} prints direction info if ctx->ops.rdma_ev fails, how
about remove the 'dir' info from rnbd_srv_rdma_ev? Then we don't need to include rtrs-srv.h.

drivers/block/rnbd/rnbd-srv.c +2 -2
index 431c6da19d3f..d07ff3ba560c 100644
@@ -387,8 +387,8 @@ static int rnbd_srv_rdma_ev(void *priv, struct
 rtrs_srv_op *id,
                                             datalen);
                 break;
         default:
-               pr_warn("Received unexpected message type %d with dir %d
 from session %s\n",
-                       type, id->dir, srv_sess->sessname);
+               pr_warn("Received unexpected message type %d from
 session %s\n",
+                       type, srv_sess->sessname);
                 return -EINVAL;
         }
drivers/block/rnbd/rnbd-srv.h +0 -1
index 5a0ef6c2b5c7..081bceaf4ae9 100644
@@ -14,7 +14,6 @@
  #include <linux/kref.h>
 
  #include <rtrs.h>
-#include <rtrs-srv.h>
  #include "rnbd-proto.h"
  #include "rnbd-log.h"
 
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Thoughts?

I like the idea. Please post a formal patch based on leon's
https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/log/?h=wip/leon-for-next

I squashed this hunk into original patch.

Hi Leon,

Thank you!

Quoted 7 lines

Thanks

Quoted 5 lines

Thx!

Quoted 3 lines

Thanks,
Guoqing