summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2019-07-25 23:36:56 +0300
committerAtin Mukherjee <amukherj@redhat.com>2019-07-29 04:06:10 +0000
commit26b9c85861f058a4a8335b28f49410ba061e7c1a (patch)
treedb6e03bfda990057e6ce20e6f3d1c6d60ea21613 /xlators
parent11d52142f67638209be43007d993dc137412aa42 (diff)
glusterd: write voldir once in glusterd-store and don't attempt again.
glusterd_store_brickinfos() is calling per each brick the function glusterd_store_brickinfo(). In it, we call: ret = glusterd_store_create_brick_dir(volinfo); However, volinfo is the same for all those bricks - no need to again and again call it (which tries to mkdir that dir). We can do it once above the loops in glusterd_store_brickinfos() While at, combine two similar functions that write additional dirs. Change-Id: I5858cf7783f088ea13a8fa20115118efa816f4cb updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index ee1c01d39ba..b7246e2dad5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -571,10 +571,6 @@ glusterd_store_brickinfo(glusterd_volinfo_t *volinfo,
if (ret)
goto out;
- ret = glusterd_store_create_brick_dir(volinfo);
- if (ret)
- goto out;
-
ret = glusterd_store_create_brick_shandle_on_absence(volinfo, brickinfo);
if (ret)
goto out;
@@ -1046,36 +1042,26 @@ glusterd_store_piddirpath_set(glusterd_volinfo_t *volinfo, char *piddirpath)
}
static int32_t
-glusterd_store_create_volume_dir(glusterd_volinfo_t *volinfo)
-{
- int32_t ret = -1;
- char voldirpath[PATH_MAX] = {
- 0,
- };
-
- GF_ASSERT(volinfo);
-
- glusterd_store_voldirpath_set(volinfo, voldirpath);
- ret = gf_store_mkdir(voldirpath);
-
- gf_msg_debug(THIS->name, 0, "Returning with %d", ret);
- return ret;
-}
-
-static int32_t
-glusterd_store_create_volume_run_dir(glusterd_volinfo_t *volinfo)
+glusterd_store_create_volume_dirs(glusterd_volinfo_t *volinfo)
{
int32_t ret = -1;
- char piddirpath[PATH_MAX] = {
+ char dirpath[PATH_MAX] = {
0,
};
GF_ASSERT(volinfo);
- glusterd_store_piddirpath_set(volinfo, piddirpath);
+ glusterd_store_voldirpath_set(volinfo, dirpath);
+ ret = gf_store_mkdir(dirpath);
+ if (ret)
+ goto out;
- ret = gf_store_mkdir(piddirpath);
+ glusterd_store_piddirpath_set(volinfo, dirpath);
+ ret = gf_store_mkdir(dirpath);
+ if (ret)
+ goto out;
+out:
gf_msg_debug(THIS->name, 0, "Returning with %d", ret);
return ret;
}
@@ -1476,6 +1462,10 @@ glusterd_store_perform_volume_store(glusterd_volinfo_t *volinfo)
if (ret)
goto out;
+ ret = glusterd_store_create_brick_dir(volinfo);
+ if (ret)
+ goto out;
+
ret = glusterd_store_brickinfos(volinfo, fd);
if (ret)
goto out;
@@ -1671,11 +1661,8 @@ glusterd_store_volinfo(glusterd_volinfo_t *volinfo,
pthread_mutex_lock(&volinfo->store_volinfo_lock);
{
glusterd_perform_volinfo_version_action(volinfo, ac);
- ret = glusterd_store_create_volume_dir(volinfo);
- if (ret)
- goto unlock;
- ret = glusterd_store_create_volume_run_dir(volinfo);
+ ret = glusterd_store_create_volume_dirs(volinfo);
if (ret)
goto unlock;