summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2016-04-02 09:50:11 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-04-29 03:11:35 -0700
commitc2865e83d414e375443adac0791887c8adf444f2 (patch)
tree705e653a6938ef6270762224a6add1e4c54f30a6 /xlators/mgmt/glusterd/src/glusterd-volgen.c
parent72f048ae1ab893e81abff377a46570b5a12b7561 (diff)
quota/glusterd: enhance quota enable and disable process
Previously quota crawl was done from the single mount point, this is very slow process if there are huge number of files exists in the volume This RFE will now spawn crawl process for each brick in the volume, and files are looked in parallel independently for each brick. This improves the speed of crawling process for entire files-system This patch also fixes below problem * Previously, mountdir was created under '/tmp'. If someone tries to cleanup '/tmp'/ directory then it is very dangerous that we loose volume data So create a mount point under /var/run/gluster/tmp instead * Previously, file-system crawl is performed from all the nodes, which is a redundant operation and performance will degrade The problem is fixed with this patch Change-Id: Icabedeb44182139ace9c8106793803122388cab8 BUG: 1290766 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/12952 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Manikandan Selvaganesh <mselvaga@redhat.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c69
1 files changed, 61 insertions, 8 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 24e99d2be9f..23890238933 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -5081,7 +5081,7 @@ build_nfs_graph (volgen_graph_t *graph, dict_t *mod_dict)
static void
get_brick_filepath (char *filename, glusterd_volinfo_t *volinfo,
- glusterd_brickinfo_t *brickinfo)
+ glusterd_brickinfo_t *brickinfo, char *prefix)
{
char path[PATH_MAX] = {0,};
char brick[PATH_MAX] = {0,};
@@ -5092,10 +5092,14 @@ get_brick_filepath (char *filename, glusterd_volinfo_t *volinfo,
GLUSTERD_REMOVE_SLASH_FROM_PATH (brickinfo->path, brick);
GLUSTERD_GET_VOLUME_DIR (path, volinfo, priv);
- snprintf (filename, PATH_MAX, "%s/%s.%s.%s.vol",
- path, volinfo->volname,
- brickinfo->hostname,
- brick);
+ if (prefix)
+ snprintf (filename, PATH_MAX, "%s/%s.%s.%s.%s.vol",
+ path, volinfo->volname, prefix,
+ brickinfo->hostname, brick);
+ else
+ snprintf (filename, PATH_MAX, "%s/%s.%s.%s.vol",
+ path, volinfo->volname,
+ brickinfo->hostname, brick);
}
gf_boolean_t
@@ -5128,7 +5132,7 @@ glusterd_is_valid_volfpath (char *volname, char *brick)
goto out;
}
strncpy (volinfo->volname, volname, sizeof (volinfo->volname));
- get_brick_filepath (volfpath, volinfo, brickinfo);
+ get_brick_filepath (volfpath, volinfo, brickinfo, NULL);
ret = ((strlen(volfpath) < PATH_MAX) &&
strlen (strrchr(volfpath, '/')) < _POSIX_PATH_MAX);
@@ -5153,7 +5157,7 @@ glusterd_generate_brick_volfile (glusterd_volinfo_t *volinfo,
GF_ASSERT (volinfo);
GF_ASSERT (brickinfo);
- get_brick_filepath (filename, volinfo, brickinfo);
+ get_brick_filepath (filename, volinfo, brickinfo, NULL);
ret = build_server_graph (&graph, volinfo, mod_dict, brickinfo);
if (!ret)
@@ -5417,6 +5421,55 @@ generate_single_transport_client_volfile (glusterd_volinfo_t *volinfo,
return ret;
}
+int
+glusterd_generate_client_per_brick_volfile (glusterd_volinfo_t *volinfo)
+{
+ char filepath[PATH_MAX] = {0, };
+ glusterd_brickinfo_t *brick = NULL;
+ volgen_graph_t graph = {0, };
+ dict_t *dict = NULL;
+ xlator_t *xl = NULL;
+ int ret = -1;
+
+ dict = dict_new ();
+ if (!dict)
+ goto out;
+
+ ret = dict_set_uint32 (dict, "trusted-client", GF_CLIENT_TRUSTED);
+ if (ret)
+ goto out;
+
+ cds_list_for_each_entry (brick, &volinfo->bricks, brick_list) {
+ xl = volgen_graph_build_client (&graph, volinfo,
+ brick->hostname, brick->path,
+ brick->brick_id,
+ "tcp", dict);
+ if (!xl) {
+ ret = -1;
+ goto out;
+ }
+
+ get_brick_filepath (filepath, volinfo, brick, "client");
+ ret = volgen_write_volfile (&graph, filepath);
+ if (ret < 0)
+ goto out;
+
+ volgen_graph_free (&graph);
+ memset (&graph, 0, sizeof (graph));
+ }
+
+
+ ret = 0;
+out:
+ if (ret)
+ volgen_graph_free (&graph);
+
+ if (dict)
+ dict_unref (dict);
+
+ return ret;
+}
+
static void
enumerate_transport_reqs (gf_transport_type type, char **types)
{
@@ -6089,7 +6142,7 @@ glusterd_delete_volfile (glusterd_volinfo_t *volinfo,
GF_ASSERT (volinfo);
GF_ASSERT (brickinfo);
- get_brick_filepath (filename, volinfo, brickinfo);
+ get_brick_filepath (filename, volinfo, brickinfo, NULL);
ret = sys_unlink (filename);
if (ret)
gf_msg ("glusterd", GF_LOG_ERROR, errno,