Patchwork [BUG:902,1/2] rpcsvc: Support multiple vectors during reply submission

login
register
Submitter Shehjar Tikoo
Date 2010-05-07 07:23:10
Message ID <1273216991-10747-1-git-send-email-shehjart@gluster.com>
Download mbox | patch
Permalink /patch/3238/
State Accepted
Delegated to: Anand Avati
Headers show

Comments

Shehjar Tikoo - 2010-05-07 07:23:10
From: Shehjar Tikoo <shehjart@gluster.com>

RPC reply path allows attaching a single iovec to a reply. This limits
the replies for certain program ops which need to return multiple vectors
for eg, the NFSv3 read reply.

Signed-off-by: Shehjar Tikoo <shehjart@gluster.com>
---
 xlators/nfs/lib/src/rpcsvc.c |   27 +++++++++++++++++++++++++++
 xlators/nfs/lib/src/rpcsvc.h |    4 +++-
 2 files changed, 30 insertions(+), 1 deletions(-)

Patch

diff --git a/xlators/nfs/lib/src/rpcsvc.c b/xlators/nfs/lib/src/rpcsvc.c
index 47510ad..182ef4d 100644
--- a/xlators/nfs/lib/src/rpcsvc.c
+++ b/xlators/nfs/lib/src/rpcsvc.c
@@ -1647,6 +1647,33 @@  rpcsvc_request_attach_vector (rpcsvc_request_t *req, struct iovec msgvec,
 
 
 int
+rpcsvc_request_attach_vectors (rpcsvc_request_t *req, struct iovec *payload,
+                               int vcount, struct iobref *piobref)
+{
+        int     c = 0;
+        int     ret = -1;
+
+        for (;c < (vcount-1); c++) {
+                ret = rpcsvc_request_attach_vector (req, payload[c], NULL,
+                                                    piobref, 0);
+                if (ret < 0) {
+                        gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to attach "
+                                "vector");
+                        goto out;
+                }
+        }
+
+        ret = rpcsvc_request_attach_vector (req, payload[vcount-1], NULL,
+                                            piobref, 1);
+        if (ret < 0)
+                gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to attach final vec");
+
+out:
+	return ret;
+}
+
+
+int
 rpcsvc_submit_vectors (rpcsvc_request_t *req)
 {
         int                     ret = -1;
diff --git a/xlators/nfs/lib/src/rpcsvc.h b/xlators/nfs/lib/src/rpcsvc.h
index 2746288..3428a00 100644
--- a/xlators/nfs/lib/src/rpcsvc.h
+++ b/xlators/nfs/lib/src/rpcsvc.h
@@ -644,7 +644,9 @@  extern int rpcsvc_submit_vectors (rpcsvc_request_t *req);
 extern int rpcsvc_request_attach_vector (rpcsvc_request_t *req,
                                          struct iovec msgvec, struct iobuf *iob,
                                          struct iobref *ioref, int finalvector);
-
+extern int
+rpcsvc_request_attach_vectors (rpcsvc_request_t *req, struct iovec *payload,
+                               int vcount, struct iobref *piobref);
 
 typedef int (*auth_init_conn) (rpcsvc_conn_t *conn, void *priv);
 typedef int (*auth_init_request) (rpcsvc_request_t *req, void *priv);