Patchwork [BUG:1816] mgmt/glusterd: send volume options to friend

login
register
Submitter Pranith K
Date 2010-10-05 13:04:45
Message ID <20101005130445.GA24342@dev.gluster.com>
Download mbox | patch
Permalink /patch/5289/
State Accepted
Headers show

Comments

Pranith K - 2010-10-05 13:04:45
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
---
 libglusterfs/src/dict.c                    |   22 ++--
 xlators/mgmt/glusterd/src/glusterd-op-sm.c |   20 ++--
 xlators/mgmt/glusterd/src/glusterd-op-sm.h |    2 +
 xlators/mgmt/glusterd/src/glusterd-store.c |   76 +++++-----
 xlators/mgmt/glusterd/src/glusterd-store.h |    1 +
 xlators/mgmt/glusterd/src/glusterd-utils.c |  244 +++++++++++++++++-----------
 xlators/mgmt/glusterd/src/glusterd-utils.h |    9 +-
 7 files changed, 221 insertions(+), 153 deletions(-)

Patch

diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c
index 0b0d777..454a7a6 100644
--- a/libglusterfs/src/dict.c
+++ b/libglusterfs/src/dict.c
@@ -1235,18 +1235,20 @@  dict_foreach (dict_t *dict,
 			 void *data),
 	      void *data)
 {
-	if (!data) {
-		gf_log ("dict", GF_LOG_CRITICAL,
-			"@data=%p", data);
-		return;
-	}
+        if (!data || !dict) {
+                gf_log_callingfn ("dict", GF_LOG_CRITICAL,
+                        "@data=%p, @dict=%p", data, dict);
+                return;
+        }
 
-	data_pair_t *pairs = dict->members_list;
+        data_pair_t *pairs = dict->members_list;
+        data_pair_t *next = NULL;
 
-	while (pairs) {
-		fn (dict, pairs->key, pairs->value, data);
-		pairs = pairs->next;
-	}
+        while (pairs) {
+                next = pairs->next;
+                fn (dict, pairs->key, pairs->value, data);
+                pairs = next;
+        }
 }
 
 
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 7eb83a2..3b1ea09 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2920,13 +2920,13 @@  out:
 void
 _delete_reconfig_opt (dict_t *this, char *key, data_t *value, void *data)
 {
-        
+
         int            exists = 0;
-        
-        exists = glusterd_check_option_exists (key, NULL);
-        
+
+        exists = glusterd_check_option_exists(key, NULL);
+
         if (exists == 1) {
-                gf_log ("", GF_LOG_DEBUG, "deleting dict with key=%s,value=%s", 
+                gf_log ("", GF_LOG_DEBUG, "deleting dict with key=%s,value=%s",
                         key, value->data);
                 dict_del (this, key);
         }
@@ -2937,13 +2937,13 @@  int
 glusterd_options_reset (glusterd_volinfo_t *volinfo)
 {
         int                      ret = 0;
-        
+
         gf_log ("", GF_LOG_DEBUG, "Received volume set reset command");
-        
+
         GF_ASSERT (volinfo->dict);
-        
-        dict_foreach (volinfo->dict, _delete_reconfig_opt, volinfo->dict); 
-        
+
+        dict_foreach (volinfo->dict, _delete_reconfig_opt, volinfo->dict);
+
         ret = glusterd_create_volfiles (volinfo);
 
         if (ret) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
index 2314238..440154b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
@@ -225,4 +225,6 @@  set_xlator_option (dict_t *dict, char *key, char *value);
 
 void
 glusterd_do_replace_brick (void *data);
+int
+glusterd_options_reset (glusterd_volinfo_t *volinfo);
 #endif
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index b7513d8..c195600 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -274,6 +274,39 @@  out:
         return ret;
 }
 
+void _setopts (dict_t *this, char *key, data_t *value, void *data)
+{
+        int                      ret = 0;
+        glusterd_store_handle_t *shandle = NULL;
+        int                      exists = 0;
+
+
+        shandle = (glusterd_store_handle_t *) data;
+
+        GF_ASSERT (shandle);
+        if (!key)
+                return;
+        if (!value || !value->data)
+                return;
+
+        exists = glusterd_check_option_exists (key, NULL);
+        if (1 == exists) {
+                gf_log ("", GF_LOG_DEBUG, "Storing in volinfo:key= %s, val=%s",
+                        key, value->data);
+        } else {
+                gf_log ("", GF_LOG_DEBUG, "Discarding:key= %s, val=%s",
+                        key, value->data);
+                return;
+        }
+
+        ret = glusterd_store_save_value (shandle, key, value->data);
+        if (ret) {
+                gf_log ("", GF_LOG_ERROR, "Unable to write into store"
+                                " handle for path: %s", shandle->path);
+                return;
+        }
+}
+
 int32_t
 glusterd_store_create_volume (glusterd_volinfo_t *volinfo)
 {
@@ -362,6 +395,8 @@  glusterd_store_create_volume (glusterd_volinfo_t *volinfo)
                 brick_count++;
         }
 
+        dict_foreach (volinfo->dict, _setopts, volinfo->shandle);
+
         ret = 0;
 
 out:
@@ -1042,7 +1077,7 @@  glusterd_store_retrieve_volume (char    *volname)
                                 goto out;
                         }
                         if (exists) {
-                                ret = dict_set_str(volinfo->dict, key, 
+                                ret = dict_set_str(volinfo->dict, key,
                                                      gf_strdup (value));
                                 if (ret) {
                                         gf_log ("",GF_LOG_ERROR, "Error in "
@@ -1050,7 +1085,7 @@  glusterd_store_retrieve_volume (char    *volname)
                                         goto out;
                                 }
                                 gf_log ("", GF_LOG_DEBUG, "Parsed as Volume-"
-                                                "set:key=%s,value:%s", 
+                                                "set:key=%s,value:%s",
                                                                 key, value);
                         }
                         else
@@ -1133,39 +1168,6 @@  out:
         return ret;
 }
 
-void _setopts(dict_t *this, char *key, data_t *value, void *data)
-{
-        int                      ret = 0;
-        glusterd_store_handle_t *shandle = NULL;
-        int                      exists = 0;
-        
-
-        shandle = (glusterd_store_handle_t *) data;
-
-        GF_ASSERT (shandle);
-        if (!key)
-                return;
-        if (!value || !value->data)
-                return;
-
-        exists = glusterd_check_option_exists (key, NULL);
-        if (exists == 1)
-                gf_log ("", GF_LOG_DEBUG, "Storing in volinfo:key= %s, val=%s",
-                        key, value->data);
-        else {
-                gf_log ("", GF_LOG_DEBUG, "Discarding:key= %s, val=%s",
-                        key, value->data);
-                return;
-        }
-        
-        ret = glusterd_store_save_value (shandle, key, value->data);
-        if (ret) {
-                gf_log ("", GF_LOG_ERROR, "Unable to write into store"
-                                " handle for path: %s", shandle->path);
-                return;
-        }
-}
-
 int32_t
 glusterd_store_update_volume (glusterd_volinfo_t *volinfo)
 {
@@ -1227,13 +1229,13 @@  glusterd_store_update_volume (glusterd_volinfo_t *volinfo)
                 goto out;
 
         list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
-                ret = glusterd_store_create_brick (volinfo, brickinfo, 
+                ret = glusterd_store_create_brick (volinfo, brickinfo,
                                                    brick_count);
                 if (ret)
                         goto out;
                 brick_count++;
         }
-        
+
         dict_foreach (volinfo->dict, _setopts, volinfo->shandle);
 
         ret = 0;
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.h b/xlators/mgmt/glusterd/src/glusterd-store.h
index af05815..6502114 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.h
+++ b/xlators/mgmt/glusterd/src/glusterd-store.h
@@ -111,4 +111,5 @@  glusterd_store_handle_destroy (glusterd_store_handle_t *handle);
 
 int32_t
 glusterd_restore ();
+
 #endif
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 0e24aca..0b3507d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -37,6 +37,7 @@ 
 #include "statedump.h"
 #include "glusterd-mem-types.h"
 #include "glusterd.h"
+#include "glusterd-op-sm.h"
 #include "glusterd-sm.h"
 #include "glusterd-utils.h"
 #include "glusterd-store.h"
@@ -1109,11 +1110,13 @@  glusterd_volume_compute_cksum (glusterd_volinfo_t  *volinfo)
         char                    path[PATH_MAX] = {0,};
         char                    cksum_path[PATH_MAX] = {0,};
         char                    filepath[PATH_MAX] = {0,};
-        DIR                     *dir = NULL;
-        struct dirent           *entry = NULL;
         int                     fd = -1;
         uint32_t                cksum = 0;
         char                    buf[4096] = {0,};
+        char                    sort_filepath[PATH_MAX] = {0};
+        gf_boolean_t            unlink_sortfile = _gf_false;
+        char                    sort_cmd[2*PATH_MAX + 32];
+        int                     sort_fd = 0;
 
         GF_ASSERT (volinfo);
 
@@ -1134,50 +1137,34 @@  glusterd_volume_compute_cksum (glusterd_volinfo_t  *volinfo)
                 goto out;
         }
 
-
-        dir = opendir (path);
-
-        glusterd_for_each_entry (entry, dir);
-
-/*        while (entry) {
-
-                snprintf (filepath, sizeof (filepath), "%s/%s", path,
-                          entry->d_name);
-
-                if (!strcmp (entry->d_name, "bricks") ||
-                     !strcmp (entry->d_name, "run")) {
-                        glusterd_for_each_entry (entry, dir);
-                        continue;
-                }
-
-                ret = get_checksum_for_path (filepath, &cksum);
-
-                if (ret) {
-                        gf_log ("", GF_LOG_ERROR, "Unable to get checksum"
-                                " for path: %s", filepath);
-                        goto out;
-                }
-
-                snprintf (buf, sizeof (buf), "%s=%u\n", entry->d_name, cksum);
-                ret = write (fd, buf, strlen (buf));
-
-                if (ret <= 0) {
-                        ret = -1;
-                        goto out;
-                }
-
-                glusterd_for_each_entry (entry, dir);
-        }
-*/
-
         snprintf (filepath, sizeof (filepath), "%s/%s", path,
                   GLUSTERD_VOLUME_INFO_FILE);
+        snprintf (sort_filepath, sizeof (sort_filepath), "/tmp/%s.XXXXXX",
+                  volinfo->volname);
+        sort_fd = mkstemp(sort_filepath);
+        if (sort_fd < 0) {
+                gf_log ("", GF_LOG_ERROR, "Could not generate temp file, "
+                        "reason: %s for volume: %s", strerror (errno),
+                        volinfo->volname);
+                goto out;
+        } else {
+                unlink_sortfile = _gf_true;
+                close (sort_fd);
+        }
 
-        ret = get_checksum_for_path (filepath, &cksum);
+        snprintf (sort_cmd, sizeof (sort_cmd), "sort %s -o %s",
+                  filepath, sort_filepath);
+        ret = system (sort_cmd);
+        if (ret) {
+                gf_log ("", GF_LOG_ERROR, "failed to sort file %s to %s",
+                        filepath, sort_filepath);
+                goto out;
+        }
+        ret = get_checksum_for_path (sort_filepath, &cksum);
 
         if (ret) {
                 gf_log ("", GF_LOG_ERROR, "Unable to get checksum"
-                        " for path: %s", filepath);
+                        " for path: %s", sort_filepath);
                 goto out;
         }
 
@@ -1200,14 +1187,43 @@  out:
        if (fd > 0)
                close (fd);
 
-       if (dir)
-               closedir (dir);
-
+       if (unlink_sortfile)
+               unlink (sort_filepath);
        gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret);
 
        return ret;
 }
 
+void
+_add_volume_option_to_dict (dict_t *this, char *key, data_t *value, void *data)
+{
+        int                     exists = 0;
+        glusterd_volopt_ctx_t   *ctx = NULL;
+        char                    optkey[512] = {0,};
+        int                     ret = -1;
+
+        exists = glusterd_check_option_exists (key, NULL);
+        if (0 == exists)
+                return;
+
+        ctx = data;
+        snprintf (optkey, sizeof (optkey), "volume%d.key%d", ctx->count,
+                  ctx->opt_count);
+        ret = dict_set_str (ctx->dict, optkey, key);
+        if (ret)
+                gf_log ("", GF_LOG_ERROR, "option add for key%d %s",
+                        ctx->count, key);
+        snprintf (optkey, sizeof (optkey), "volume%d.value%d", ctx->count,
+                  ctx->opt_count);
+        ret = dict_set_str (ctx->dict, optkey, value->data);
+        if (ret)
+                gf_log ("", GF_LOG_ERROR, "option add for value%d %s",
+                        ctx->count, value->data);
+        ctx->opt_count++;
+
+        return;
+}
+
 int32_t
 glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo,
                              dict_t  *dict, int32_t count)
@@ -1218,6 +1234,7 @@  glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo,
         int32_t                 i = 1;
         char                    uuid_str[50] = {0,};
         char                    *volume_id_str = NULL;
+        glusterd_volopt_ctx_t   ctx = {0};
 
         GF_ASSERT (dict);
         GF_ASSERT (volinfo);
@@ -1227,37 +1244,37 @@  glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo,
         if (ret)
                 goto out;
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.type", count);
         ret = dict_set_int32 (dict, key, volinfo->type);
         if (ret)
                 goto out;
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.brick_count", count);
         ret = dict_set_int32 (dict, key, volinfo->brick_count);
         if (ret)
                 goto out;
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.version", count);
         ret = dict_set_int32 (dict, key, volinfo->version);
         if (ret)
                 goto out;
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.status", count);
         ret = dict_set_int32 (dict, key, volinfo->status);
         if (ret)
                 goto out;
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.sub_count", count);
         ret = dict_set_int32 (dict, key, volinfo->sub_count);
         if (ret)
                 goto out;
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.ckusm", count);
         ret = dict_set_int64 (dict, key, volinfo->cksum);
         if (ret)
@@ -1268,21 +1285,34 @@  glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo,
         if (!volume_id_str)
                 goto out;
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, 256, "volume%d.volume_id", count);
         ret = dict_set_dynstr (dict, key, volume_id_str);
         if (ret)
                 goto out;
 
+        ctx.dict = dict;
+        ctx.count = count;
+        ctx.opt_count = 1;
+        GF_ASSERT (volinfo->dict);
+
+        dict_foreach (volinfo->dict, _add_volume_option_to_dict, &ctx);
+        ctx.opt_count--;
+        memset (key, 0, sizeof (key));
+        snprintf (key, sizeof (key), "volume%d.opt-count", count);
+        ret = dict_set_int32 (dict, key, ctx.opt_count);
+        if (ret)
+                goto out;
+
         list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
-                memset (&key, 0, sizeof (key));
+                memset (key, 0, sizeof (key));
                 snprintf (key, sizeof (key), "volume%d.brick%d.hostname",
                           count, i);
                 ret = dict_set_str (dict, key, brickinfo->hostname);
                 if (ret)
                         goto out;
 
-                memset (&key, 0, sizeof (key));
+                memset (key, 0, sizeof (key));
                 snprintf (key, sizeof (key), "volume%d.brick%d.path",
                           count, i);
                 ret = dict_set_str (dict, key, brickinfo->path);
@@ -1363,7 +1393,7 @@  glusterd_compare_friend_volume (dict_t *vols, int32_t count, int32_t *status)
                 goto out;
         }
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.version", count);
         ret = dict_get_int32 (vols, key, &version);
         if (ret)
@@ -1384,7 +1414,7 @@  glusterd_compare_friend_volume (dict_t *vols, int32_t count, int32_t *status)
 
         //Now, versions are same, compare cksums.
         //
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.ckusm", count);
         ret = dict_get_uint32 (vols, key, &cksum);
         if (ret)
@@ -1408,6 +1438,60 @@  out:
 }
 
 int32_t
+glusterd_import_friend_volume_opts (dict_t *vols, int count,
+                                    glusterd_volinfo_t *volinfo,
+                                    int new_volinfo)
+{
+        char                    key[512] = {0,};
+        int32_t                 ret = -1;
+        int                     i = 1;
+        int                     opt_count = 0;
+        char                    *opt_key = NULL;
+        char                    *opt_val = NULL;
+        char                    *dup_opt_val = NULL;
+
+        memset (key, 0, sizeof (key));
+        snprintf (key, sizeof (key), "volume%d.opt-count", count);
+        ret = dict_get_int32 (vols, key, &opt_count);
+        if (ret)
+                goto out;
+        if (!new_volinfo) {
+                ret = glusterd_options_reset (volinfo);
+                if (ret) {
+                        gf_log ("", GF_LOG_ERROR, "options reset failed");
+                        goto out;
+                }
+        }
+        while (i <= opt_count) {
+                memset (key, 0, sizeof (key));
+                snprintf (key, sizeof (key), "volume%d.key%d",
+                          count, i);
+                ret = dict_get_str (vols, key, &opt_key);
+                if (ret)
+                        goto out;
+
+                memset (key, 0, sizeof (key));
+                snprintf (key, sizeof (key), "volume%d.value%d",
+                          count, i);
+                ret = dict_get_str (vols, key, &opt_val);
+                if (ret)
+                        goto out;
+                dup_opt_val = gf_strdup (opt_val);
+                if (!dup_opt_val) {
+                        ret = -1;
+                        goto out;
+                }
+                ret = dict_set_dynstr (volinfo->dict, opt_key, dup_opt_val);
+                if (ret)
+                        goto out;
+                i++;
+        }
+out:
+        gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret);
+        return ret;
+}
+
+int32_t
 glusterd_import_friend_volume (dict_t *vols, int count)
 {
 
@@ -1444,43 +1528,43 @@  glusterd_import_friend_volume (dict_t *vols, int count)
         }
 
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.type", count);
         ret = dict_get_int32 (vols, key, &volinfo->type);
         if (ret)
                 goto out;
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.brick_count", count);
         ret = dict_get_int32 (vols, key, &volinfo->brick_count);
         if (ret)
                 goto out;
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.version", count);
         ret = dict_get_int32 (vols, key, &volinfo->version);
         if (ret)
                 goto out;
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.status", count);
         ret = dict_get_int32 (vols, key, (int32_t *)&volinfo->status);
         if (ret)
                 goto out;
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.sub_count", count);
         ret = dict_get_int32 (vols, key, &volinfo->sub_count);
         if (ret)
                 goto out;
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.ckusm", count);
         ret = dict_get_uint32 (vols, key, &volinfo->cksum);
         if (ret)
                 goto out;
 
-        memset (&key, 0, sizeof (key));
+        memset (key, 0, sizeof (key));
         snprintf (key, sizeof (key), "volume%d.volume_id", count);
         ret = dict_get_str (vols, key, &volume_id_str);
         if (ret)
@@ -1496,14 +1580,14 @@  glusterd_import_friend_volume (dict_t *vols, int count)
 
         while (i <= volinfo->brick_count) {
 
-                memset (&key, 0, sizeof (key));
+                memset (key, 0, sizeof (key));
                 snprintf (key, sizeof (key), "volume%d.brick%d.hostname",
                           count, i);
                 ret = dict_get_str (vols, key, &hostname);
                 if (ret)
                         goto out;
 
-                memset (&key, 0, sizeof (key));
+                memset (key, 0, sizeof (key));
                 snprintf (key, sizeof (key), "volume%d.brick%d.path",
                           count, i);
                 ret = dict_get_str (vols, key, &path);
@@ -1522,6 +1606,10 @@  glusterd_import_friend_volume (dict_t *vols, int count)
                 i++;
         }
 
+        ret = glusterd_import_friend_volume_opts (vols, count, volinfo,
+                                                  new_volinfo);
+        if (ret)
+                goto out;
         if (new_volinfo) {
                 list_add_tail (&volinfo->vol_list, &priv->volumes);
                 ret = glusterd_store_create_volume (volinfo);
@@ -1613,36 +1701,6 @@  out:
         return ret;
 }
 
-int
-glusterd_file_copy (int out, int in)
-{
-        int     read_size = 0;
-        char    buffer[16 * 1024];
-        int     ret = -1;
-
-        if (out <= 0 || in < 0) {
-                gf_log ("", GF_LOG_ERROR, "Invalid File descriptors");
-                goto out;
-        }
-
-        while (1) {
-                read_size = read(in, buffer, sizeof(buffer));
-
-                if (read_size == 0) {
-                        ret = 0;
-                        break;              /* end of file */
-                }
-
-                if (read_size < 0) {
-                        ret = -1;
-                        break; /*error reading file); */
-                }
-                write (out, buffer, (unsigned int) read_size);
-        }
-out:
-        return ret;
-}
-
 gf_boolean_t
 glusterd_is_nfs_started ()
 {
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 74b8377..79a15c0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -43,6 +43,12 @@  struct glusterd_lock_ {
         time_t  timestamp;
 };
 
+typedef struct glusterd_volopt_ctx_ {
+        dict_t  *dict;
+        int     count;
+        int     opt_count;
+} glusterd_volopt_ctx_t;
+
 typedef int (*glusterd_condition_func) (glusterd_volinfo_t *volinfo,
                                         glusterd_brickinfo_t *brickinfo,
                                         void *ctx);
@@ -144,9 +150,6 @@  int32_t
 glusterd_nfs_server_stop ();
 
 int
-glusterd_file_copy (int out, int in);
-
-int
 glusterd_remote_hostname_get (rpcsvc_request_t *req,
                               char *remote_host, int len);
 int32_t