50dc83
From 90254e4ae9455fa0a126f83700978a9314eb79ea Mon Sep 17 00:00:00 2001
50dc83
From: Anuradha Talur <atalur@commvault.com>
50dc83
Date: Thu, 29 Nov 2018 12:54:21 -0800
50dc83
Subject: [PATCH 153/169] features/cloudsync : Added some new functions
50dc83
50dc83
This patch contains the following changes:
50dc83
1) Store ID info will now be stored in the inode ctx
50dc83
2) Added new readv type where read is made directly
50dc83
   from the remote store. This choice is made by
50dc83
   volume set operation.
50dc83
3) cs_forget() was missing. Added it.
50dc83
50dc83
backport of:https://review.gluster.org/#/c/glusterfs/+/21757/
50dc83
50dc83
> Change-Id: Ie3232b3d7ffb5313a03f011b0553b19793eedfa2
50dc83
> fixes: bz#1642168
50dc83
> Signed-off-by: Anuradha Talur <atalur@commvault.com>
50dc83
50dc83
Change-Id: I089e5a8c93049cf6bfabf011673796e38e78d7ee
50dc83
Signed-off-by: Susant Palai <spalai@redhat.com>
50dc83
Reviewed-on: https://code.engineering.redhat.com/gerrit/172192
50dc83
Tested-by: RHGS Build Bot <nigelb@redhat.com>
50dc83
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
50dc83
---
50dc83
 xlators/features/cloudsync/src/cloudsync-common.c  |  16 +
50dc83
 xlators/features/cloudsync/src/cloudsync-common.h  |  35 ++
50dc83
 xlators/features/cloudsync/src/cloudsync-fops-c.py |  12 +-
50dc83
 .../features/cloudsync/src/cloudsync-mem-types.h   |   1 +
50dc83
 xlators/features/cloudsync/src/cloudsync.c         | 600 ++++++++++++++++++---
50dc83
 xlators/features/cloudsync/src/cloudsync.h         |  20 +
50dc83
 xlators/mgmt/glusterd/src/glusterd-volume-set.c    |   7 +-
50dc83
 7 files changed, 597 insertions(+), 94 deletions(-)
50dc83
50dc83
diff --git a/xlators/features/cloudsync/src/cloudsync-common.c b/xlators/features/cloudsync/src/cloudsync-common.c
50dc83
index aee1f06..445a31b 100644
50dc83
--- a/xlators/features/cloudsync/src/cloudsync-common.c
50dc83
+++ b/xlators/features/cloudsync/src/cloudsync-common.c
50dc83
@@ -11,6 +11,20 @@
50dc83
 #include "cloudsync-common.h"
50dc83
 
50dc83
 void
50dc83
+cs_xattrinfo_wipe(cs_local_t *local)
50dc83
+{
50dc83
+    if (local->xattrinfo.lxattr) {
50dc83
+        if (local->xattrinfo.lxattr->file_path)
50dc83
+            GF_FREE(local->xattrinfo.lxattr->file_path);
50dc83
+
50dc83
+        if (local->xattrinfo.lxattr->volname)
50dc83
+            GF_FREE(local->xattrinfo.lxattr->volname);
50dc83
+
50dc83
+        GF_FREE(local->xattrinfo.lxattr);
50dc83
+    }
50dc83
+}
50dc83
+
50dc83
+void
50dc83
 cs_local_wipe(xlator_t *this, cs_local_t *local)
50dc83
 {
50dc83
     if (!local)
50dc83
@@ -40,5 +54,7 @@ cs_local_wipe(xlator_t *this, cs_local_t *local)
50dc83
     if (local->remotepath)
50dc83
         GF_FREE(local->remotepath);
50dc83
 
50dc83
+    cs_xattrinfo_wipe(local);
50dc83
+
50dc83
     mem_put(local);
50dc83
 }
50dc83
diff --git a/xlators/features/cloudsync/src/cloudsync-common.h b/xlators/features/cloudsync/src/cloudsync-common.h
50dc83
index 7b3520c..11d2334 100644
50dc83
--- a/xlators/features/cloudsync/src/cloudsync-common.h
50dc83
+++ b/xlators/features/cloudsync/src/cloudsync-common.h
50dc83
@@ -14,9 +14,23 @@
50dc83
 #include <glusterfs/call-stub.h>
50dc83
 #include <glusterfs/xlator.h>
50dc83
 #include <glusterfs/syncop.h>
50dc83
+#include <glusterfs/compat-errno.h>
50dc83
 #include "cloudsync-mem-types.h"
50dc83
 #include "cloudsync-messages.h"
50dc83
 
50dc83
+typedef struct cs_loc_xattr {
50dc83
+    char *file_path;
50dc83
+    uuid_t uuid;
50dc83
+    uuid_t gfid;
50dc83
+    char *volname;
50dc83
+} cs_loc_xattr_t;
50dc83
+
50dc83
+typedef struct cs_size_xattr {
50dc83
+    uint64_t size;
50dc83
+    uint64_t blksize;
50dc83
+    uint64_t blocks;
50dc83
+} cs_size_xattr_t;
50dc83
+
50dc83
 typedef struct cs_local {
50dc83
     loc_t loc;
50dc83
     fd_t *fd;
50dc83
@@ -34,10 +48,25 @@ typedef struct cs_local {
50dc83
     int call_cnt;
50dc83
     inode_t *inode;
50dc83
     char *remotepath;
50dc83
+
50dc83
+    struct {
50dc83
+        /* offset, flags and size are the information needed
50dc83
+         * by read fop for remote read operation. These will be
50dc83
+         * populated in cloudsync read fop, before being passed
50dc83
+         * on to the plugin performing remote read.
50dc83
+         */
50dc83
+        off_t offset;
50dc83
+        uint32_t flags;
50dc83
+        size_t size;
50dc83
+        cs_loc_xattr_t *lxattr;
50dc83
+    } xattrinfo;
50dc83
+
50dc83
 } cs_local_t;
50dc83
 
50dc83
 typedef int (*fop_download_t)(call_frame_t *frame, void *config);
50dc83
 
50dc83
+typedef int (*fop_remote_read_t)(call_frame_t *, void *);
50dc83
+
50dc83
 typedef void *(*store_init)(xlator_t *this);
50dc83
 
50dc83
 typedef int (*store_reconfigure)(xlator_t *this, dict_t *options);
50dc83
@@ -48,6 +77,7 @@ struct cs_remote_stores {
50dc83
     char *name;                    /* store name */
50dc83
     void *config;                  /* store related information */
50dc83
     fop_download_t dlfop;          /* store specific download function */
50dc83
+    fop_remote_read_t rdfop;       /* store specific read function */
50dc83
     store_init init;               /* store init to initialize store config */
50dc83
     store_reconfigure reconfigure; /* reconfigure store config */
50dc83
     store_fini fini;
50dc83
@@ -59,11 +89,15 @@ typedef struct cs_private {
50dc83
     struct cs_remote_stores *stores;
50dc83
     gf_boolean_t abortdl;
50dc83
     pthread_spinlock_t lock;
50dc83
+    gf_boolean_t remote_read;
50dc83
 } cs_private_t;
50dc83
 
50dc83
 void
50dc83
 cs_local_wipe(xlator_t *this, cs_local_t *local);
50dc83
 
50dc83
+void
50dc83
+cs_xattrinfo_wipe(cs_local_t *local);
50dc83
+
50dc83
 #define CS_STACK_UNWIND(fop, frame, params...)                                 \
50dc83
     do {                                                                       \
50dc83
         cs_local_t *__local = NULL;                                            \
50dc83
@@ -90,6 +124,7 @@ cs_local_wipe(xlator_t *this, cs_local_t *local);
50dc83
 
50dc83
 typedef struct store_methods {
50dc83
     int (*fop_download)(call_frame_t *frame, void *config);
50dc83
+    int (*fop_remote_read)(call_frame_t *, void *);
50dc83
     /* return type should be the store config */
50dc83
     void *(*fop_init)(xlator_t *this);
50dc83
     int (*fop_reconfigure)(xlator_t *this, dict_t *options);
50dc83
diff --git a/xlators/features/cloudsync/src/cloudsync-fops-c.py b/xlators/features/cloudsync/src/cloudsync-fops-c.py
50dc83
index 3122bd3..a7a2201 100755
50dc83
--- a/xlators/features/cloudsync/src/cloudsync-fops-c.py
50dc83
+++ b/xlators/features/cloudsync/src/cloudsync-fops-c.py
50dc83
@@ -137,15 +137,15 @@ cs_@NAME@_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
50dc83
                         } else {
50dc83
                                 __cs_inode_ctx_update (this, fd->inode, val);
50dc83
                                 gf_msg (this->name, GF_LOG_INFO, 0, 0,
50dc83
-                                        " state = %ld", val);
50dc83
+                                        " state = %" PRIu64, val);
50dc83
 
50dc83
                                 if (local->call_cnt == 1 &&
50dc83
                                     (val == GF_CS_REMOTE ||
50dc83
                                      val == GF_CS_DOWNLOADING))  {
50dc83
                                         gf_msg (this->name, GF_LOG_INFO, 0,
50dc83
                                                 0, " will repair and download "
50dc83
-                                                "the file, current state : %ld",
50dc83
-                                                val);
50dc83
+                                                "the file, current state : %"
50dc83
+                                                PRIu64, val);
50dc83
                                         goto repair;
50dc83
                                 } else {
50dc83
                                         gf_msg (this->name, GF_LOG_ERROR, 0, 0,
50dc83
@@ -274,7 +274,7 @@ fd_ops = ['readv', 'writev', 'flush', 'fsync', 'fsyncdir', 'ftruncate',
50dc83
 # These are the current actual lists used to generate the code
50dc83
 
50dc83
 # The following list contains fops which are fd based that modifies data
50dc83
-fd_data_modify_op_fop_template = ['readv', 'writev', 'flush', 'fsync',
50dc83
+fd_data_modify_op_fop_template = ['writev', 'flush', 'fsync',
50dc83
                                   'ftruncate', 'rchecksum', 'fallocate',
50dc83
                                   'discard', 'zerofill', 'seek']
50dc83
 
50dc83
@@ -284,8 +284,8 @@ loc_stat_op_fop_template = ['lookup', 'stat', 'discover', 'access', 'setattr',
50dc83
                             'getattr']
50dc83
 
50dc83
 # These fops need a separate implementation
50dc83
-special_fops = ['readdirp', 'statfs', 'setxattr', 'unlink', 'getxattr',
50dc83
-                'truncate', 'fstat']
50dc83
+special_fops = ['statfs', 'setxattr', 'unlink', 'getxattr',
50dc83
+                'truncate', 'fstat', 'readv']
50dc83
 
50dc83
 def gen_defaults():
50dc83
     for name in ops:
50dc83
diff --git a/xlators/features/cloudsync/src/cloudsync-mem-types.h b/xlators/features/cloudsync/src/cloudsync-mem-types.h
50dc83
index 9e6837a..2203464 100644
50dc83
--- a/xlators/features/cloudsync/src/cloudsync-mem-types.h
50dc83
+++ b/xlators/features/cloudsync/src/cloudsync-mem-types.h
50dc83
@@ -16,6 +16,7 @@ enum cs_mem_types_ {
50dc83
     gf_cs_mt_cs_private_t = gf_common_mt_end + 1,
50dc83
     gf_cs_mt_cs_remote_stores_t,
50dc83
     gf_cs_mt_cs_inode_ctx_t,
50dc83
+    gf_cs_mt_cs_lxattr_t,
50dc83
     gf_cs_mt_end
50dc83
 };
50dc83
 #endif /* __CLOUDSYNC_MEM_TYPES_H__ */
50dc83
diff --git a/xlators/features/cloudsync/src/cloudsync.c b/xlators/features/cloudsync/src/cloudsync.c
50dc83
index fbdcdf7..2240fc3 100644
50dc83
--- a/xlators/features/cloudsync/src/cloudsync.c
50dc83
+++ b/xlators/features/cloudsync/src/cloudsync.c
50dc83
@@ -16,6 +16,7 @@
50dc83
 #include <glusterfs/call-stub.h>
50dc83
 #include "cloudsync-autogen-fops.h"
50dc83
 
50dc83
+#include <string.h>
50dc83
 #include <dlfcn.h>
50dc83
 
50dc83
 void
50dc83
@@ -72,6 +73,8 @@ cs_init(xlator_t *this)
50dc83
 
50dc83
     this->private = priv;
50dc83
 
50dc83
+    GF_OPTION_INIT("cloudsync-remote-read", priv->remote_read, bool, out);
50dc83
+
50dc83
     /* temp workaround. Should be configurable through glusterd*/
50dc83
     per_vol = _gf_true;
50dc83
 
50dc83
@@ -135,6 +138,18 @@ cs_init(xlator_t *this)
50dc83
 
50dc83
         (void)dlerror();
50dc83
 
50dc83
+        if (priv->remote_read) {
50dc83
+            priv->stores->rdfop = store_methods->fop_remote_read;
50dc83
+            if (!priv->stores->rdfop) {
50dc83
+                gf_msg(this->name, GF_LOG_ERROR, 0, 0,
50dc83
+                       "failed to get"
50dc83
+                       " read fop %s",
50dc83
+                       dlerror());
50dc83
+                ret = -1;
50dc83
+                goto out;
50dc83
+            }
50dc83
+        }
50dc83
+
50dc83
         priv->stores->dlfop = store_methods->fop_download;
50dc83
         if (!priv->stores->dlfop) {
50dc83
             gf_msg(this->name, GF_LOG_ERROR, 0, 0,
50dc83
@@ -196,6 +211,22 @@ out:
50dc83
     return ret;
50dc83
 }
50dc83
 
50dc83
+int
50dc83
+cs_forget(xlator_t *this, inode_t *inode)
50dc83
+{
50dc83
+    uint64_t ctx_int = 0;
50dc83
+    cs_inode_ctx_t *ctx = NULL;
50dc83
+
50dc83
+    inode_ctx_del(inode, this, &ctx_int);
50dc83
+    if (!ctx_int)
50dc83
+        return 0;
50dc83
+
50dc83
+    ctx = (cs_inode_ctx_t *)(uintptr_t)ctx_int;
50dc83
+
50dc83
+    GF_FREE(ctx);
50dc83
+    return 0;
50dc83
+}
50dc83
+
50dc83
 void
50dc83
 cs_fini(xlator_t *this)
50dc83
 {
50dc83
@@ -217,6 +248,9 @@ cs_reconfigure(xlator_t *this, dict_t *options)
50dc83
         goto out;
50dc83
     }
50dc83
 
50dc83
+    GF_OPTION_RECONF("cloudsync-remote-read", priv->remote_read, options, bool,
50dc83
+                     out);
50dc83
+
50dc83
     /* needed only for per volume configuration*/
50dc83
     ret = priv->stores->reconfigure(this, options);
50dc83
 
50dc83
@@ -242,59 +276,6 @@ out:
50dc83
 }
50dc83
 
50dc83
 int32_t
50dc83
-cs_readdirp_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
50dc83
-                int32_t op_ret, int32_t op_errno, gf_dirent_t *entries,
50dc83
-                dict_t *xdata)
50dc83
-{
50dc83
-    gf_dirent_t *tmp = NULL;
50dc83
-    char *sxattr = NULL;
50dc83
-    uint64_t ia_size = 0;
50dc83
-    int ret = 0;
50dc83
-
50dc83
-    list_for_each_entry(tmp, &entries->list, list)
50dc83
-    {
50dc83
-        ret = dict_get_str(tmp->dict, GF_CS_OBJECT_SIZE, &sxattr);
50dc83
-        if (ret) {
50dc83
-            gf_msg_trace(this->name, 0, "size xattr found");
50dc83
-            continue;
50dc83
-        }
50dc83
-
50dc83
-        ia_size = atoll(sxattr);
50dc83
-        tmp->d_stat.ia_size = ia_size;
50dc83
-    }
50dc83
-
50dc83
-    STACK_UNWIND_STRICT(readdirp, frame, op_ret, op_errno, entries, xdata);
50dc83
-    return 0;
50dc83
-}
50dc83
-
50dc83
-int32_t
50dc83
-cs_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
50dc83
-            off_t off, dict_t *xdata)
50dc83
-{
50dc83
-    int ret = 0;
50dc83
-    int op_errno = ENOMEM;
50dc83
-
50dc83
-    if (!xdata) {
50dc83
-        xdata = dict_new();
50dc83
-        if (!xdata) {
50dc83
-            goto err;
50dc83
-        }
50dc83
-    }
50dc83
-
50dc83
-    ret = dict_set_int32(xdata, GF_CS_OBJECT_SIZE, 1);
50dc83
-    if (ret) {
50dc83
-        goto err;
50dc83
-    }
50dc83
-
50dc83
-    STACK_WIND(frame, cs_readdirp_cbk, FIRST_CHILD(this),
50dc83
-               FIRST_CHILD(this)->fops->readdirp, fd, size, off, xdata);
50dc83
-    return 0;
50dc83
-err:
50dc83
-    STACK_UNWIND_STRICT(readdirp, frame, -1, op_errno, NULL, NULL);
50dc83
-    return 0;
50dc83
-}
50dc83
-
50dc83
-int32_t
50dc83
 cs_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
50dc83
                 int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
50dc83
                 struct iatt *postbuf, dict_t *xdata)
50dc83
@@ -305,7 +286,6 @@ cs_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
50dc83
 
50dc83
     local = frame->local;
50dc83
 
50dc83
-    /* Do we need lock here? */
50dc83
     local->call_cnt++;
50dc83
 
50dc83
     if (op_ret == -1) {
50dc83
@@ -320,13 +300,13 @@ cs_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
50dc83
                 goto unwind;
50dc83
             } else {
50dc83
                 __cs_inode_ctx_update(this, local->loc.inode, val);
50dc83
-                gf_msg(this->name, GF_LOG_INFO, 0, 0, " state = %ld", val);
50dc83
+                gf_msg(this->name, GF_LOG_INFO, 0, 0, " state = %" PRIu64, val);
50dc83
 
50dc83
                 if (local->call_cnt == 1 &&
50dc83
                     (val == GF_CS_REMOTE || val == GF_CS_DOWNLOADING)) {
50dc83
                     gf_msg(this->name, GF_LOG_WARNING, 0, 0,
50dc83
                            "will repair and download "
50dc83
-                           "the file, current state : %ld",
50dc83
+                           "the file, current state : %" PRIu64,
50dc83
                            val);
50dc83
                     goto repair;
50dc83
                 } else {
50dc83
@@ -665,7 +645,7 @@ cs_fstat_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
50dc83
     if (op_ret == 0) {
50dc83
         ret = dict_get_uint64(xdata, GF_CS_OBJECT_STATUS, &val;;
50dc83
         if (!ret) {
50dc83
-            gf_msg_debug(this->name, 0, "state %ld", val);
50dc83
+            gf_msg_debug(this->name, 0, "state %" PRIu64, val);
50dc83
             ret = __cs_inode_ctx_update(this, fd->inode, val);
50dc83
             if (ret) {
50dc83
                 gf_msg(this->name, GF_LOG_ERROR, 0, 0, "ctx update failed");
50dc83
@@ -831,7 +811,7 @@ out:
50dc83
     return 0;
50dc83
 }
50dc83
 
50dc83
-void *
50dc83
+int
50dc83
 cs_download_task(void *arg)
50dc83
 {
50dc83
     call_frame_t *frame = NULL;
50dc83
@@ -842,7 +822,6 @@ cs_download_task(void *arg)
50dc83
     fd_t *fd = NULL;
50dc83
     cs_local_t *local = NULL;
50dc83
     dict_t *dict = NULL;
50dc83
-    int *retval = NULL;
50dc83
 
50dc83
     frame = (call_frame_t *)arg;
50dc83
 
50dc83
@@ -850,13 +829,6 @@ cs_download_task(void *arg)
50dc83
 
50dc83
     priv = this->private;
50dc83
 
50dc83
-    retval = GF_CALLOC(1, sizeof(int), gf_common_mt_int);
50dc83
-    if (!retval) {
50dc83
-        gf_msg(this->name, GF_LOG_ERROR, 0, 0, "insufficient memory");
50dc83
-        ret = -1;
50dc83
-        goto out;
50dc83
-    }
50dc83
-
50dc83
     if (!priv->stores) {
50dc83
         gf_msg(this->name, GF_LOG_ERROR, 0, 0,
50dc83
                "No remote store "
50dc83
@@ -972,20 +944,13 @@ out:
50dc83
         local->dlfd = NULL;
50dc83
     }
50dc83
 
50dc83
-    if (retval) {
50dc83
-        *retval = ret;
50dc83
-        pthread_exit(retval);
50dc83
-    } else {
50dc83
-        pthread_exit(&ret;;
50dc83
-    }
50dc83
+    return ret;
50dc83
 }
50dc83
 
50dc83
 int
50dc83
 cs_download(call_frame_t *frame)
50dc83
 {
50dc83
-    int *retval = NULL;
50dc83
     int ret = 0;
50dc83
-    pthread_t dthread;
50dc83
     cs_local_t *local = NULL;
50dc83
     xlator_t *this = NULL;
50dc83
 
50dc83
@@ -1000,16 +965,406 @@ cs_download(call_frame_t *frame)
50dc83
         goto out;
50dc83
     }
50dc83
 
50dc83
-    ret = gf_thread_create(&dthread, NULL, &cs_download_task, (void *)frame,
50dc83
-                           "downloadthread");
50dc83
+    ret = cs_download_task((void *)frame);
50dc83
+out:
50dc83
+    return ret;
50dc83
+}
50dc83
 
50dc83
-    pthread_join(dthread, (void **)&retval);
50dc83
+int
50dc83
+cs_set_xattr_req(call_frame_t *frame)
50dc83
+{
50dc83
+    cs_local_t *local = NULL;
50dc83
+    GF_UNUSED int ret = 0;
50dc83
+
50dc83
+    local = frame->local;
50dc83
+
50dc83
+    /* When remote reads are performed (i.e. reads on remote store),
50dc83
+     * there needs to be a way to associate a file on gluster volume
50dc83
+     * with its correspnding file on the remote store. In order to do
50dc83
+     * that, a unique key can be maintained as an xattr
50dc83
+     * (GF_CS_XATTR_ARCHIVE_UUID)on the stub file on gluster bricks.
50dc83
+     * This xattr should be provided to the plugin to
50dc83
+     * perform the read fop on the correct file. This assumes that the file
50dc83
+     * hierarchy and name need not be the same on remote store as that of
50dc83
+     * the gluster volume.
50dc83
+     */
50dc83
+    ret = dict_set_str(local->xattr_req, GF_CS_XATTR_ARCHIVE_UUID, "1");
50dc83
+
50dc83
+    return 0;
50dc83
+}
50dc83
 
50dc83
-    ret = *retval;
50dc83
+int
50dc83
+cs_update_xattrs(call_frame_t *frame, dict_t *xdata)
50dc83
+{
50dc83
+    cs_local_t *local = NULL;
50dc83
+    xlator_t *this = NULL;
50dc83
+    int size = -1;
50dc83
+    GF_UNUSED int ret = 0;
50dc83
+
50dc83
+    local = frame->local;
50dc83
+    this = frame->this;
50dc83
+
50dc83
+    local->xattrinfo.lxattr = GF_CALLOC(1, sizeof(cs_loc_xattr_t),
50dc83
+                                        gf_cs_mt_cs_lxattr_t);
50dc83
+    if (!local->xattrinfo.lxattr) {
50dc83
+        local->op_ret = -1;
50dc83
+        local->op_errno = ENOMEM;
50dc83
+        goto err;
50dc83
+    }
50dc83
+
50dc83
+    gf_uuid_copy(local->xattrinfo.lxattr->gfid, local->loc.gfid);
50dc83
+
50dc83
+    if (local->remotepath) {
50dc83
+        local->xattrinfo.lxattr->file_path = gf_strdup(local->remotepath);
50dc83
+        if (!local->xattrinfo.lxattr->file_path) {
50dc83
+            local->op_ret = -1;
50dc83
+            local->op_errno = ENOMEM;
50dc83
+            goto err;
50dc83
+        }
50dc83
+    }
50dc83
+
50dc83
+    ret = dict_get_gfuuid(xdata, GF_CS_XATTR_ARCHIVE_UUID,
50dc83
+                          &(local->xattrinfo.lxattr->uuid));
50dc83
+
50dc83
+    if (ret) {
50dc83
+        gf_uuid_clear(local->xattrinfo.lxattr->uuid);
50dc83
+    }
50dc83
+    size = strlen(this->name) - strlen("-cloudsync") + 1;
50dc83
+    local->xattrinfo.lxattr->volname = GF_CALLOC(1, size, gf_common_mt_char);
50dc83
+    if (!local->xattrinfo.lxattr->volname) {
50dc83
+        local->op_ret = -1;
50dc83
+        local->op_errno = ENOMEM;
50dc83
+        goto err;
50dc83
+    }
50dc83
+    strncpy(local->xattrinfo.lxattr->volname, this->name, size - 1);
50dc83
+    local->xattrinfo.lxattr->volname[size - 1] = '\0';
50dc83
+
50dc83
+    return 0;
50dc83
+err:
50dc83
+    cs_xattrinfo_wipe(local);
50dc83
+    return -1;
50dc83
+}
50dc83
+
50dc83
+int
50dc83
+cs_serve_readv(call_frame_t *frame, off_t offset, size_t size, uint32_t flags)
50dc83
+{
50dc83
+    xlator_t *this = NULL;
50dc83
+    cs_private_t *priv = NULL;
50dc83
+    int ret = -1;
50dc83
+    fd_t *fd = NULL;
50dc83
+    cs_local_t *local = NULL;
50dc83
+
50dc83
+    local = frame->local;
50dc83
+    this = frame->this;
50dc83
+    priv = this->private;
50dc83
+
50dc83
+    if (!local->remotepath) {
50dc83
+        ret = -1;
50dc83
+        gf_msg(this->name, GF_LOG_ERROR, 0, 0,
50dc83
+               "remote path not"
50dc83
+               " available. Check posix logs to resolve");
50dc83
+        goto out;
50dc83
+    }
50dc83
+
50dc83
+    if (!priv->stores) {
50dc83
+        gf_msg(this->name, GF_LOG_ERROR, 0, 0,
50dc83
+               "No remote store "
50dc83
+               "plugins found");
50dc83
+        ret = -1;
50dc83
+        goto out;
50dc83
+    }
50dc83
+
50dc83
+    if (local->fd) {
50dc83
+        fd = fd_anonymous(local->fd->inode);
50dc83
+    } else {
50dc83
+        fd = fd_anonymous(local->loc.inode);
50dc83
+    }
50dc83
+
50dc83
+    local->xattrinfo.size = size;
50dc83
+    local->xattrinfo.offset = offset;
50dc83
+    local->xattrinfo.flags = flags;
50dc83
+
50dc83
+    if (!fd) {
50dc83
+        gf_msg("CS", GF_LOG_ERROR, 0, 0, "fd creation failed");
50dc83
+        ret = -1;
50dc83
+        goto out;
50dc83
+    }
50dc83
+
50dc83
+    local->dlfd = fd;
50dc83
+    local->dloffset = offset;
50dc83
+
50dc83
+    /*this calling method is for per volume setting */
50dc83
+    ret = priv->stores->rdfop(frame, priv->stores->config);
50dc83
+    if (ret) {
50dc83
+        gf_msg(this->name, GF_LOG_ERROR, 0, 0,
50dc83
+               "read failed"
50dc83
+               ", remotepath: %s",
50dc83
+               local->remotepath);
50dc83
+        ret = -1;
50dc83
+        goto out;
50dc83
+    } else {
50dc83
+        gf_msg(this->name, GF_LOG_INFO, 0, 0,
50dc83
+               "read success, path"
50dc83
+               " : %s",
50dc83
+               local->remotepath);
50dc83
+    }
50dc83
 
50dc83
 out:
50dc83
-    if (retval)
50dc83
-        GF_FREE(retval);
50dc83
+    if (fd) {
50dc83
+        fd_unref(fd);
50dc83
+        local->dlfd = NULL;
50dc83
+    }
50dc83
+    return ret;
50dc83
+}
50dc83
+
50dc83
+int32_t
50dc83
+cs_readv_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
50dc83
+             int32_t op_errno, struct iovec *vector, int32_t count,
50dc83
+             struct iatt *stbuf, struct iobref *iobref, dict_t *xdata)
50dc83
+{
50dc83
+    cs_local_t *local = NULL;
50dc83
+    int ret = 0;
50dc83
+    uint64_t val = 0;
50dc83
+    fd_t *fd = NULL;
50dc83
+
50dc83
+    local = frame->local;
50dc83
+    fd = local->fd;
50dc83
+
50dc83
+    local->call_cnt++;
50dc83
+
50dc83
+    if (op_ret == -1) {
50dc83
+        ret = dict_get_uint64(xdata, GF_CS_OBJECT_STATUS, &val;;
50dc83
+        if (ret == 0) {
50dc83
+            if (val == GF_CS_ERROR) {
50dc83
+                gf_msg(this->name, GF_LOG_ERROR, 0, 0,
50dc83
+                       "could not get file state, unwinding");
50dc83
+                op_ret = -1;
50dc83
+                op_errno = EIO;
50dc83
+                goto unwind;
50dc83
+            } else {
50dc83
+                __cs_inode_ctx_update(this, fd->inode, val);
50dc83
+                gf_msg(this->name, GF_LOG_INFO, 0, 0, " state = %" PRIu64, val);
50dc83
+
50dc83
+                if (local->call_cnt == 1 &&
50dc83
+                    (val == GF_CS_REMOTE || val == GF_CS_DOWNLOADING)) {
50dc83
+                    gf_msg(this->name, GF_LOG_INFO, 0, 0,
50dc83
+                           " will read from remote : %" PRIu64, val);
50dc83
+                    goto repair;
50dc83
+                } else {
50dc83
+                    gf_msg(this->name, GF_LOG_ERROR, 0, 0,
50dc83
+                           "second readv, Unwinding");
50dc83
+                    goto unwind;
50dc83
+                }
50dc83
+            }
50dc83
+        } else {
50dc83
+            gf_msg(this->name, GF_LOG_ERROR, 0, 0,
50dc83
+                   "file state "
50dc83
+                   "could not be figured, unwinding");
50dc83
+            goto unwind;
50dc83
+        }
50dc83
+    } else {
50dc83
+        /* successful readv => file is local */
50dc83
+        __cs_inode_ctx_update(this, fd->inode, GF_CS_LOCAL);
50dc83
+        gf_msg(this->name, GF_LOG_INFO, 0, 0,
50dc83
+               "state : GF_CS_LOCAL"
50dc83
+               ", readv successful");
50dc83
+
50dc83
+        goto unwind;
50dc83
+    }
50dc83
+
50dc83
+repair:
50dc83
+    ret = locate_and_execute(frame);
50dc83
+    if (ret) {
50dc83
+        goto unwind;
50dc83
+    }
50dc83
+
50dc83
+    return 0;
50dc83
+
50dc83
+unwind:
50dc83
+    CS_STACK_UNWIND(readv, frame, op_ret, op_errno, vector, count, stbuf,
50dc83
+                    iobref, xdata);
50dc83
+
50dc83
+    return 0;
50dc83
+}
50dc83
+
50dc83
+int32_t
50dc83
+cs_resume_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
50dc83
+                off_t offset, uint32_t flags, dict_t *xdata)
50dc83
+{
50dc83
+    int ret = 0;
50dc83
+
50dc83
+    ret = cs_resume_postprocess(this, frame, fd->inode);
50dc83
+    if (ret) {
50dc83
+        goto unwind;
50dc83
+    }
50dc83
+
50dc83
+    cs_inodelk_unlock(frame);
50dc83
+
50dc83
+    STACK_WIND(frame, cs_readv_cbk, FIRST_CHILD(this),
50dc83
+               FIRST_CHILD(this)->fops->readv, fd, size, offset, flags, xdata);
50dc83
+
50dc83
+    return 0;
50dc83
+
50dc83
+unwind:
50dc83
+    cs_inodelk_unlock(frame);
50dc83
+
50dc83
+    cs_common_cbk(frame);
50dc83
+
50dc83
+    return 0;
50dc83
+}
50dc83
+
50dc83
+int32_t
50dc83
+cs_resume_remote_readv(call_frame_t *frame, xlator_t *this, fd_t *fd,
50dc83
+                       size_t size, off_t offset, uint32_t flags, dict_t *xdata)
50dc83
+{
50dc83
+    int ret = 0;
50dc83
+    cs_local_t *local = NULL;
50dc83
+    gf_cs_obj_state state = -1;
50dc83
+    cs_inode_ctx_t *ctx = NULL;
50dc83
+
50dc83
+    cs_inodelk_unlock(frame);
50dc83
+
50dc83
+    local = frame->local;
50dc83
+    if (!local) {
50dc83
+        ret = -1;
50dc83
+        goto unwind;
50dc83
+    }
50dc83
+
50dc83
+    __cs_inode_ctx_get(this, fd->inode, &ctx;;
50dc83
+
50dc83
+    state = __cs_get_file_state(this, fd->inode, ctx);
50dc83
+    if (state == GF_CS_ERROR) {
50dc83
+        gf_msg(this->name, GF_LOG_ERROR, 0, 0,
50dc83
+               "status is GF_CS_ERROR."
50dc83
+               " Aborting readv");
50dc83
+        local->op_ret = -1;
50dc83
+        local->op_errno = EREMOTE;
50dc83
+        ret = -1;
50dc83
+        goto unwind;
50dc83
+    }
50dc83
+
50dc83
+    /* Serve readv from remote store only if it is remote. */
50dc83
+    gf_msg_debug(this->name, 0, "status of file %s is %d",
50dc83
+                 local->remotepath ? local->remotepath : "", state);
50dc83
+
50dc83
+    /* We will reach this condition if local inode ctx had REMOTE
50dc83
+     * state when the control was in cs_readv but after stat
50dc83
+     * we got an updated state saying that the file is LOCAL.
50dc83
+     */
50dc83
+    if (state == GF_CS_LOCAL) {
50dc83
+        STACK_WIND(frame, cs_readv_cbk, FIRST_CHILD(this),
50dc83
+                   FIRST_CHILD(this)->fops->readv, fd, size, offset, flags,
50dc83
+                   xdata);
50dc83
+    } else if (state == GF_CS_REMOTE) {
50dc83
+        ret = cs_resume_remote_readv_postprocess(this, frame, fd->inode, offset,
50dc83
+                                                 size, flags);
50dc83
+        /* Failed to submit the remote readv fop to plugin */
50dc83
+        if (ret) {
50dc83
+            local->op_ret = -1;
50dc83
+            local->op_errno = EREMOTE;
50dc83
+            goto unwind;
50dc83
+        }
50dc83
+        /* When the file is in any other intermediate state,
50dc83
+         * we should not perform remote reads.
50dc83
+         */
50dc83
+    } else {
50dc83
+        local->op_ret = -1;
50dc83
+        local->op_errno = EINVAL;
50dc83
+        goto unwind;
50dc83
+    }
50dc83
+
50dc83
+    return 0;
50dc83
+
50dc83
+unwind:
50dc83
+    cs_common_cbk(frame);
50dc83
+
50dc83
+    return 0;
50dc83
+}
50dc83
+
50dc83
+int32_t
50dc83
+cs_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
50dc83
+         off_t offset, uint32_t flags, dict_t *xdata)
50dc83
+{
50dc83
+    int op_errno = -1;
50dc83
+    cs_local_t *local = NULL;
50dc83
+    int ret = 0;
50dc83
+    cs_inode_ctx_t *ctx = NULL;
50dc83
+    gf_cs_obj_state state = -1;
50dc83
+    cs_private_t *priv = NULL;
50dc83
+
50dc83
+    VALIDATE_OR_GOTO(frame, err);
50dc83
+    VALIDATE_OR_GOTO(this, err);
50dc83
+    VALIDATE_OR_GOTO(fd, err);
50dc83
+
50dc83
+    priv = this->private;
50dc83
+
50dc83
+    local = cs_local_init(this, frame, NULL, fd, GF_FOP_READ);
50dc83
+    if (!local) {
50dc83
+        gf_msg(this->name, GF_LOG_ERROR, 0, 0, "local init failed");
50dc83
+        op_errno = ENOMEM;
50dc83
+        goto err;
50dc83
+    }
50dc83
+
50dc83
+    __cs_inode_ctx_get(this, fd->inode, &ctx;;
50dc83
+
50dc83
+    if (ctx)
50dc83
+        state = __cs_get_file_state(this, fd->inode, ctx);
50dc83
+    else
50dc83
+        state = GF_CS_LOCAL;
50dc83
+
50dc83
+    local->xattr_req = xdata ? dict_ref(xdata) : (xdata = dict_new());
50dc83
+
50dc83
+    ret = dict_set_uint32(local->xattr_req, GF_CS_OBJECT_STATUS, 1);
50dc83
+    if (ret) {
50dc83
+        gf_msg(this->name, GF_LOG_ERROR, 0, 0,
50dc83
+               "dict_set failed key:"
50dc83
+               " %s",
50dc83
+               GF_CS_OBJECT_STATUS);
50dc83
+        goto err;
50dc83
+    }
50dc83
+
50dc83
+    if (priv->remote_read) {
50dc83
+        local->stub = fop_readv_stub(frame, cs_resume_remote_readv, fd, size,
50dc83
+                                     offset, flags, xdata);
50dc83
+    } else {
50dc83
+        local->stub = fop_readv_stub(frame, cs_resume_readv, fd, size, offset,
50dc83
+                                     flags, xdata);
50dc83
+    }
50dc83
+    if (!local->stub) {
50dc83
+        gf_msg(this->name, GF_LOG_ERROR, 0, 0, "insufficient memory");
50dc83
+        op_errno = ENOMEM;
50dc83
+        goto err;
50dc83
+    }
50dc83
+
50dc83
+    if (state == GF_CS_LOCAL) {
50dc83
+        STACK_WIND(frame, cs_readv_cbk, FIRST_CHILD(this),
50dc83
+                   FIRST_CHILD(this)->fops->readv, fd, size, offset, flags,
50dc83
+                   xdata);
50dc83
+    } else {
50dc83
+        local->call_cnt++;
50dc83
+        ret = locate_and_execute(frame);
50dc83
+        if (ret) {
50dc83
+            op_errno = ENOMEM;
50dc83
+            goto err;
50dc83
+        }
50dc83
+    }
50dc83
+
50dc83
+    return 0;
50dc83
+
50dc83
+err:
50dc83
+    CS_STACK_UNWIND(readv, frame, -1, op_errno, NULL, -1, NULL, NULL, NULL);
50dc83
+
50dc83
+    return 0;
50dc83
+}
50dc83
+
50dc83
+int
50dc83
+cs_resume_remote_readv_postprocess(xlator_t *this, call_frame_t *frame,
50dc83
+                                   inode_t *inode, off_t offset, size_t size,
50dc83
+                                   uint32_t flags)
50dc83
+{
50dc83
+    int ret = 0;
50dc83
+
50dc83
+    ret = cs_serve_readv(frame, offset, size, flags);
50dc83
 
50dc83
     return ret;
50dc83
 }
50dc83
@@ -1059,7 +1414,7 @@ cs_stat_check_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
50dc83
                 goto err;
50dc83
             } else {
50dc83
                 ret = __cs_inode_ctx_update(this, inode, val);
50dc83
-                gf_msg_debug(this->name, 0, "status : %lu", val);
50dc83
+                gf_msg_debug(this->name, 0, "status : %" PRIu64, val);
50dc83
                 if (ret) {
50dc83
                     gf_msg(this->name, GF_LOG_ERROR, 0, 0, "ctx update failed");
50dc83
                     local->op_ret = -1;
50dc83
@@ -1087,6 +1442,10 @@ cs_stat_check_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
50dc83
             gf_msg_debug(this->name, 0, "NULL filepath");
50dc83
         }
50dc83
 
50dc83
+        ret = cs_update_xattrs(frame, xdata);
50dc83
+        if (ret)
50dc83
+            goto err;
50dc83
+
50dc83
         local->op_ret = 0;
50dc83
         local->xattr_rsp = dict_ref(xdata);
50dc83
         memcpy(&local->stbuf, stbuf, sizeof(struct iatt));
50dc83
@@ -1121,6 +1480,8 @@ cs_do_stat_check(call_frame_t *main_frame)
50dc83
         goto err;
50dc83
     }
50dc83
 
50dc83
+    cs_set_xattr_req(main_frame);
50dc83
+
50dc83
     if (local->fd) {
50dc83
         STACK_WIND(main_frame, cs_stat_check_cbk, FIRST_CHILD(this),
50dc83
                    FIRST_CHILD(this)->fops->fstat, local->fd, local->xattr_req);
50dc83
@@ -1177,6 +1538,10 @@ cs_common_cbk(call_frame_t *frame)
50dc83
                             NULL, NULL, NULL);
50dc83
             break;
50dc83
 
50dc83
+        case GF_FOP_TRUNCATE:
50dc83
+            CS_STACK_UNWIND(truncate, frame, local->op_ret, local->op_errno,
50dc83
+                            NULL, NULL, NULL);
50dc83
+            break;
50dc83
         default:
50dc83
             break;
50dc83
     }
50dc83
@@ -1427,7 +1792,7 @@ __cs_inode_ctx_get(xlator_t *this, inode_t *inode, cs_inode_ctx_t **ctx)
50dc83
     if (ret)
50dc83
         *ctx = NULL;
50dc83
     else
50dc83
-        *ctx = (cs_inode_ctx_t *)ctxint;
50dc83
+        *ctx = (cs_inode_ctx_t *)(uintptr_t)ctxint;
50dc83
 
50dc83
     return;
50dc83
 }
50dc83
@@ -1452,7 +1817,7 @@ __cs_inode_ctx_update(xlator_t *this, inode_t *inode, uint64_t val)
50dc83
 
50dc83
             ctx->state = val;
50dc83
 
50dc83
-            ctxint = (uint64_t)ctx;
50dc83
+            ctxint = (uint64_t)(uintptr_t)ctx;
50dc83
 
50dc83
             ret = __inode_ctx_set(inode, this, &ctxint);
50dc83
             if (ret) {
50dc83
@@ -1460,7 +1825,7 @@ __cs_inode_ctx_update(xlator_t *this, inode_t *inode, uint64_t val)
50dc83
                 goto out;
50dc83
             }
50dc83
         } else {
50dc83
-            ctx = (cs_inode_ctx_t *)ctxint;
50dc83
+            ctx = (cs_inode_ctx_t *)(uintptr_t)ctxint;
50dc83
 
50dc83
             ctx->state = val;
50dc83
         }
50dc83
@@ -1483,7 +1848,7 @@ cs_inode_ctx_reset(xlator_t *this, inode_t *inode)
50dc83
         return 0;
50dc83
     }
50dc83
 
50dc83
-    ctx = (cs_inode_ctx_t *)ctxint;
50dc83
+    ctx = (cs_inode_ctx_t *)(uintptr_t)ctxint;
50dc83
 
50dc83
     GF_FREE(ctx);
50dc83
     return 0;
50dc83
@@ -1532,6 +1897,57 @@ cs_resume_postprocess(xlator_t *this, call_frame_t *frame, inode_t *inode)
50dc83
 out:
50dc83
     return ret;
50dc83
 }
50dc83
+
50dc83
+int32_t
50dc83
+__cs_get_dict_str(char **str, dict_t *xattr, const char *name, int *errnum)
50dc83
+{
50dc83
+    data_t *data = NULL;
50dc83
+    int ret = -1;
50dc83
+
50dc83
+    assert(str != NULL);
50dc83
+
50dc83
+    data = dict_get(xattr, (char *)name);
50dc83
+    if (!data) {
50dc83
+        *errnum = ENODATA;
50dc83
+        goto out;
50dc83
+    }
50dc83
+
50dc83
+    *str = GF_CALLOC(data->len + 1, sizeof(char), gf_common_mt_char);
50dc83
+    if (!(*str)) {
50dc83
+        *errnum = ENOMEM;
50dc83
+        goto out;
50dc83
+    }
50dc83
+
50dc83
+    memcpy(*str, data->data, sizeof(char) * (data->len));
50dc83
+    return 0;
50dc83
+
50dc83
+out:
50dc83
+    return ret;
50dc83
+}
50dc83
+
50dc83
+int32_t
50dc83
+__cs_get_dict_uuid(uuid_t uuid, dict_t *xattr, const char *name, int *errnum)
50dc83
+{
50dc83
+    data_t *data = NULL;
50dc83
+    int ret = -1;
50dc83
+
50dc83
+    assert(uuid != NULL);
50dc83
+
50dc83
+    data = dict_get(xattr, (char *)name);
50dc83
+    if (!data) {
50dc83
+        *errnum = ENODATA;
50dc83
+        goto out;
50dc83
+    }
50dc83
+
50dc83
+    assert(data->len == sizeof(uuid_t));
50dc83
+
50dc83
+    gf_uuid_copy(uuid, (unsigned char *)data->data);
50dc83
+    return 0;
50dc83
+
50dc83
+out:
50dc83
+    return ret;
50dc83
+}
50dc83
+
50dc83
 int32_t
50dc83
 cs_fdctx_to_dict(xlator_t *this, fd_t *fd, dict_t *dict)
50dc83
 {
50dc83
@@ -1606,7 +2022,6 @@ cs_notify(xlator_t *this, int event, void *data, ...)
50dc83
 
50dc83
 struct xlator_fops cs_fops = {
50dc83
     .stat = cs_stat,
50dc83
-    .readdirp = cs_readdirp,
50dc83
     .truncate = cs_truncate,
50dc83
     .seek = cs_seek,
50dc83
     .statfs = cs_statfs,
50dc83
@@ -1627,7 +2042,9 @@ struct xlator_fops cs_fops = {
50dc83
     .zerofill = cs_zerofill,
50dc83
 };
50dc83
 
50dc83
-struct xlator_cbks cs_cbks = {};
50dc83
+struct xlator_cbks cs_cbks = {
50dc83
+    .forget = cs_forget,
50dc83
+};
50dc83
 
50dc83
 struct xlator_dumpops cs_dumpops = {
50dc83
     .fdctx_to_dict = cs_fdctx_to_dict,
50dc83
@@ -1647,6 +2064,15 @@ struct volume_options cs_options[] = {
50dc83
     {.key = {"cloudsync-storetype"},
50dc83
      .type = GF_OPTION_TYPE_STR,
50dc83
      .description = "Defines which remote store is enabled"},
50dc83
+    {.key = {"cloudsync-remote-read"},
50dc83
+     .type = GF_OPTION_TYPE_BOOL,
50dc83
+     .description = "Defines a remote read fop when on"},
50dc83
+    {.key = {"cloudsync-store-id"},
50dc83
+     .type = GF_OPTION_TYPE_STR,
50dc83
+     .description = "Defines a volume wide store id"},
50dc83
+    {.key = {"cloudsync-product-id"},
50dc83
+     .type = GF_OPTION_TYPE_STR,
50dc83
+     .description = "Defines a volume wide product id"},
50dc83
     {.key = {NULL}},
50dc83
 };
50dc83
 
50dc83
diff --git a/xlators/features/cloudsync/src/cloudsync.h b/xlators/features/cloudsync/src/cloudsync.h
50dc83
index dbdb207..0cb800a 100644
50dc83
--- a/xlators/features/cloudsync/src/cloudsync.h
50dc83
+++ b/xlators/features/cloudsync/src/cloudsync.h
50dc83
@@ -19,6 +19,7 @@
50dc83
 #include "cloudsync-common.h"
50dc83
 #include "cloudsync-autogen-fops.h"
50dc83
 
50dc83
+#define ALIGN_SIZE 4096
50dc83
 #define CS_LOCK_DOMAIN "cs.protect.file.stat"
50dc83
 typedef struct cs_dlstore {
50dc83
     off_t off;
50dc83
@@ -29,6 +30,7 @@ typedef struct cs_dlstore {
50dc83
 } cs_dlstore;
50dc83
 
50dc83
 typedef struct cs_inode_ctx {
50dc83
+    cs_loc_xattr_t locxattr;
50dc83
     gf_cs_obj_state state;
50dc83
 } cs_inode_ctx_t;
50dc83
 
50dc83
@@ -100,4 +102,22 @@ cs_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
50dc83
 int32_t
50dc83
 cs_resume_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc,
50dc83
                    off_t offset, dict_t *xattr_req);
50dc83
+
50dc83
+int32_t
50dc83
+cs_readv_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
50dc83
+             int32_t op_errno, struct iovec *vector, int32_t count,
50dc83
+             struct iatt *stbuf, struct iobref *iobref, dict_t *xdata);
50dc83
+int32_t
50dc83
+cs_resume_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
50dc83
+                off_t offset, uint32_t flags, dict_t *xdata);
50dc83
+int32_t
50dc83
+cs_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
50dc83
+         off_t offset, uint32_t flags, dict_t *xdata);
50dc83
+
50dc83
+int
50dc83
+cs_resume_remote_readv_postprocess(xlator_t *this, call_frame_t *frame,
50dc83
+                                   inode_t *inode, off_t offset, size_t size,
50dc83
+                                   uint32_t flags);
50dc83
+int
50dc83
+cs_serve_readv(call_frame_t *frame, off_t offset, size_t size, uint32_t flags);
50dc83
 #endif /* __CLOUDSYNC_H__ */
50dc83
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
50dc83
index 4b32fb6..73abf37 100644
50dc83
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
50dc83
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
50dc83
@@ -3693,7 +3693,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
50dc83
      .op_version = GD_OP_VERSION_5_0,
50dc83
      .description = "enable/disable noatime option with ctime enabled.",
50dc83
      .flags = VOLOPT_FLAG_CLIENT_OPT | VOLOPT_FLAG_XLATOR_OPT},
50dc83
-    {.key = "feature.cloudsync-storetype",
50dc83
+    {.key = "features.cloudsync-storetype",
50dc83
      .voltype = "features/cloudsync",
50dc83
      .op_version = GD_OP_VERSION_5_0,
50dc83
      .flags = VOLOPT_FLAG_CLIENT_OPT},
50dc83
@@ -3721,4 +3721,9 @@ struct volopt_map_entry glusterd_volopt_map[] = {
50dc83
      .validate_fn = validate_boolean,
50dc83
      .description = "option to enforce mandatory lock on a file",
50dc83
      .flags = VOLOPT_FLAG_XLATOR_OPT},
50dc83
+    {.key = "features.cloudsync-remote-read",
50dc83
+     .voltype = "features/cloudsync",
50dc83
+     .value = "off",
50dc83
+     .op_version = GD_OP_VERSION_6_0,
50dc83
+     .flags = VOLOPT_FLAG_CLIENT_OPT},
50dc83
     {.key = NULL}};
50dc83
-- 
50dc83
1.8.3.1
50dc83