summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-09-15 12:57:44 +0530
committerVijay Bellur <vijay@gluster.com>2011-09-23 06:48:32 -0700
commit76580479033087f6dde080c27618baf19b18b658 (patch)
tree89a6b37046df9dc859e7f8ac7acd3f9115c69c2f /xlators/mgmt/glusterd/src/glusterd-volume-ops.c
parent1b096c3ff0a4c25ff22a32d9594d2e289a3d67ea (diff)
glusterd: cleanup of volinfo '*_count' definitions
earlier, sub_count was having different meaning depending on the volume type. now, for replica and stripe count, one can directly access the 'replica_count' or 'stripe_count' to get the corresponding value from the volume info. 'sub_count' is preserved as is for backward compatibility. there is a new variable 'dist_leaf_count' to get info about how many bricks are present in one distribute sub volume. Change-Id: I5ea1c8f9ae08f584cca63b91ba69035c7e4350ca BUG: 3158 Reviewed-on: http://review.gluster.com/435 Reviewed-by: Krishnan Parthasarathi <kp@gluster.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 39cc02c8e..816ef9b18 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -921,7 +921,6 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
char *brick_list = NULL;
char *free_ptr = NULL;
char *saveptr = NULL;
- int32_t sub_count = 0;
char *trans_type = NULL;
char *str = NULL;
@@ -974,14 +973,19 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
goto out;
}
+ /* replica-count 1 means, no replication, file is in one brick only */
+ volinfo->replica_count = 1;
+ /* stripe-count 1 means, no striping, file is present as a whole */
+ volinfo->stripe_count = 1;
+
if (GF_CLUSTER_TYPE_REPLICATE == volinfo->type) {
ret = dict_get_int32 (dict, "replica-count",
- &sub_count);
+ &volinfo->replica_count);
if (ret)
goto out;
} else if (GF_CLUSTER_TYPE_STRIPE == volinfo->type) {
ret = dict_get_int32 (dict, "stripe-count",
- &sub_count);
+ &volinfo->stripe_count);
if (ret)
goto out;
} else if (GF_CLUSTER_TYPE_STRIPE_REPLICATE == volinfo->type) {
@@ -993,10 +997,18 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
&volinfo->replica_count);
if (ret)
goto out;
-
- sub_count = volinfo->stripe_count * volinfo->replica_count;
}
+ /* dist-leaf-count is the count of brick nodes for a given
+ subvolume of distribute */
+ volinfo->dist_leaf_count = (volinfo->stripe_count *
+ volinfo->replica_count);
+
+ /* Keep sub-count same as earlier, for the sake of backward
+ compatibility */
+ if (volinfo->dist_leaf_count > 1)
+ volinfo->sub_count = volinfo->dist_leaf_count;
+
ret = dict_get_str (dict, "transport", &trans_type);
if (ret) {
gf_log ("", GF_LOG_ERROR, "Unable to get transport");
@@ -1025,8 +1037,6 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
volinfo->nfs_transport_type = GF_DEFAULT_NFS_TRANSPORT;
}
- volinfo->sub_count = sub_count;
-
if (bricks) {
brick_list = gf_strdup (bricks);
free_ptr = brick_list;