From 549231dda9769f23eebf039bc0f7c34a4c086270 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Tue, 19 Feb 2013 16:27:54 +0530 Subject: glusterd: Added the validation function for subvols-per-directory Change-Id: Ie2259023b9001311a2032792639c3093054f6750 BUG: 896431 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/4552 Reviewed-by: Jeff Darcy Tested-by: Gluster Build System --- xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-brick-ops.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 6a56432d144..2ac2699cfc2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -919,13 +919,15 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count, if (stripe_count) { volinfo->stripe_count = stripe_count; } - volinfo->dist_leaf_count = (volinfo->stripe_count * - volinfo->replica_count); + volinfo->dist_leaf_count = glusterd_get_dist_leaf_count (volinfo); /* backward compatibility */ volinfo->sub_count = ((volinfo->dist_leaf_count == 1) ? 0: volinfo->dist_leaf_count); + volinfo->subvol_count = (volinfo->brick_count / + volinfo->dist_leaf_count); + ret = glusterd_create_volfiles_and_notify_services (volinfo); if (ret) goto out; @@ -1616,8 +1618,10 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr) volinfo->replica_count, replica_count, volinfo->volname); volinfo->replica_count = replica_count; - volinfo->dist_leaf_count = (volinfo->stripe_count * - replica_count); + volinfo->dist_leaf_count = glusterd_get_dist_leaf_count (volinfo); + volinfo->subvol_count = (volinfo->brick_count / + volinfo->dist_leaf_count); + if (replica_count == 1) { if (volinfo->type == GF_CLUSTER_TYPE_REPLICATE) { volinfo->type = GF_CLUSTER_TYPE_NONE; -- cgit