summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2015-01-07 11:14:31 +0530
committerVijay Bellur <vbellur@redhat.com>2015-03-24 07:56:32 -0700
commit84db9f8271f150fbb6024186f7f681e941731280 (patch)
treec9a3fe9dceeac5f00714362af4c7f6c706b539b2
parenta37f3ca2b286732fff18f0b0897d8bb1713c89b7 (diff)
mgmt/glusterd: generate volfile for BitD
* Implement the skeleton of bit-rot xlator. Original-Author: Raghavendra Bhat <raghavendra@redhat.com> Signed-off-by: Venky Shankar <vshankar@redhat.com> Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> Signed-off-by: Anand Nekkunti <anekkunt@redhat.com> Change-Id: If33218bdc694f5f09cb7b8097c4fdb74d7a23b2d BUG: 1170075 Reviewed-on: http://review.gluster.org/9710 Reviewed-by: Vijay Bellur <vbellur@redhat.com> Tested-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--xlators/features/bit-rot/src/Makefile.am17
-rw-r--r--xlators/features/bit-rot/src/bit-rot-mem-types.h24
-rw-r--r--xlators/features/bit-rot/src/bit-rot.c89
-rw-r--r--xlators/features/bit-rot/src/bit-rot.h33
-rw-r--r--xlators/mgmt/glusterd/src/Makefile.am5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-bitd-svc.c116
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-bitd-svc.h42
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-svc-helper.c16
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c18
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c101
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.h6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h2
14 files changed, 488 insertions, 3 deletions
diff --git a/xlators/features/bit-rot/src/Makefile.am b/xlators/features/bit-rot/src/Makefile.am
index 7581732c7d9..1f59a71ebea 100644
--- a/xlators/features/bit-rot/src/Makefile.am
+++ b/xlators/features/bit-rot/src/Makefile.am
@@ -1 +1,18 @@
+
SUBDIRS = stub
+
+xlator_LTLIBRARIES = bit-rot.la
+xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features
+
+bit_rot_la_LDFLAGS = -module -avoid-version
+
+bit_rot_la_SOURCES = bit-rot.c
+bit_rot_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
+
+noinst_HEADERS = bit-rot.h bit-rot-mem-types.h
+
+AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src
+
+AM_CFLAGS = -Wall $(GF_CFLAGS)
+
+CLEANFILES =
diff --git a/xlators/features/bit-rot/src/bit-rot-mem-types.h b/xlators/features/bit-rot/src/bit-rot-mem-types.h
new file mode 100644
index 00000000000..19c2aca0f8a
--- /dev/null
+++ b/xlators/features/bit-rot/src/bit-rot-mem-types.h
@@ -0,0 +1,24 @@
+/*
+ Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com>
+ This file is part of GlusterFS.
+
+ This file is licensed to you under your choice of the GNU Lesser
+ General Public License, version 3 or any later version (LGPLv3 or
+ later), or the GNU General Public License, version 2 (GPLv2), in all
+ cases as published by the Free Software Foundation.
+*/
+
+#ifndef _BR_MEM_TYPES_H
+#define _BR_MEM_TYPES_H
+
+#include "mem-types.h"
+
+enum br_mem_types {
+ gf_br_mt_br_private_t = gf_common_mt_end + 1,
+ gf_br_mt_br_local_t,
+ gf_br_mt_br_inode_t,
+ gf_br_mt_br_fd_t,
+ gf_br_mt_end
+};
+
+#endif
diff --git a/xlators/features/bit-rot/src/bit-rot.c b/xlators/features/bit-rot/src/bit-rot.c
new file mode 100644
index 00000000000..0ba8b80825b
--- /dev/null
+++ b/xlators/features/bit-rot/src/bit-rot.c
@@ -0,0 +1,89 @@
+/*
+ Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com>
+ This file is part of GlusterFS.
+
+ This file is licensed to you under your choice of the GNU Lesser
+ General Public License, version 3 or any later version (LGPLv3 or
+ later), or the GNU General Public License, version 2 (GPLv2), in all
+ cases as published by the Free Software Foundation.
+*/
+
+#include <ctype.h>
+#include <sys/uio.h>
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+#include "config.h"
+#endif
+
+#include "glusterfs.h"
+#include "xlator.h"
+#include "logging.h"
+
+#include "bit-rot.h"
+#include "bit-rot-mem-types.h"
+
+int32_t
+mem_acct_init (xlator_t *this)
+{
+ int32_t ret = -1;
+
+ if (!this)
+ return ret;
+
+ ret = xlator_mem_acct_init (this, gf_br_mt_end + 1);
+
+ if (ret != 0) {
+ gf_log (this->name, GF_LOG_WARNING, "Memory accounting"
+ " init failed");
+ return ret;
+ }
+
+ return ret;
+}
+
+int32_t
+init (xlator_t *this)
+{
+ br_private_t *priv = NULL;
+ int32_t ret = -1;
+
+ if (!this->children) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "FATAL: no children");
+ goto out;
+ }
+
+ priv = GF_CALLOC (1, sizeof (*priv), gf_br_mt_br_private_t);
+ if (!priv)
+ goto out;
+
+ this->private = priv;
+
+ ret = 0;
+
+out:
+ gf_log (this->name, GF_LOG_DEBUG, "bit-rot xlator loaded");
+ return ret;
+}
+
+void
+fini (xlator_t *this)
+{
+ br_private_t *priv = this->private;
+
+ if (!priv)
+ return;
+ this->private = NULL;
+ GF_FREE (priv);
+
+ return;
+}
+
+struct xlator_fops fops;
+
+struct xlator_cbks cbks;
+
+struct volume_options options[] = {
+ { .key = {NULL} },
+};
diff --git a/xlators/features/bit-rot/src/bit-rot.h b/xlators/features/bit-rot/src/bit-rot.h
new file mode 100644
index 00000000000..b275c0e9535
--- /dev/null
+++ b/xlators/features/bit-rot/src/bit-rot.h
@@ -0,0 +1,33 @@
+ /*
+ Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com>
+ This file is part of GlusterFS.
+
+ This file is licensed to you under your choice of the GNU Lesser
+ General Public License, version 3 or any later version (LGPLv3 or
+ later), or the GNU General Public License, version 2 (GPLv2), in all
+ cases as published by the Free Software Foundation.
+*/
+#ifndef __BIT_ROT_H__
+#define __BIT_ROT_H__
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+#include "config.h"
+#endif
+
+#include "glusterfs.h"
+#include "logging.h"
+#include "dict.h"
+#include "xlator.h"
+#include "defaults.h"
+#include "bit-rot-mem-types.h"
+#include "syncop.h"
+
+struct br_private {
+ xlator_t *xl;
+ gf_lock_t lock;
+};
+
+typedef struct br_private br_private_t;
+
+#endif /* __BIR_ROT_H__ */
diff --git a/xlators/mgmt/glusterd/src/Makefile.am b/xlators/mgmt/glusterd/src/Makefile.am
index 7792f12bae9..90afa4f298b 100644
--- a/xlators/mgmt/glusterd/src/Makefile.am
+++ b/xlators/mgmt/glusterd/src/Makefile.am
@@ -15,7 +15,8 @@ glusterd_la_SOURCES = glusterd.c glusterd-handler.c glusterd-sm.c \
glusterd-snapshot-utils.c glusterd-conn-mgmt.c \
glusterd-proc-mgmt.c glusterd-svc-mgmt.c glusterd-shd-svc.c \
glusterd-nfs-svc.c glusterd-quotad-svc.c glusterd-svc-helper.c \
- glusterd-conn-helper.c glusterd-snapd-svc.c glusterd-snapd-svc-helper.c
+ glusterd-conn-helper.c glusterd-snapd-svc.c glusterd-snapd-svc-helper.c \
+ glusterd-bitd-svc.c
glusterd_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
@@ -35,7 +36,7 @@ noinst_HEADERS = glusterd.h glusterd-utils.h glusterd-op-sm.h \
glusterd-conn-mgmt.h glusterd-conn-helper.h glusterd-proc-mgmt.h \
glusterd-svc-mgmt.h glusterd-shd-svc.h glusterd-nfs-svc.h \
glusterd-quotad-svc.h glusterd-svc-helper.h glusterd-snapd-svc.h \
- glusterd-snapd-svc-helper.h glusterd-rcu.h \
+ glusterd-snapd-svc-helper.h glusterd-rcu.h glusterd-bitd-svc.h \
$(CONTRIBDIR)/userspace-rcu/rculist-extra.h
AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \
diff --git a/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c b/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c
new file mode 100644
index 00000000000..ab06ab64db0
--- /dev/null
+++ b/xlators/mgmt/glusterd/src/glusterd-bitd-svc.c
@@ -0,0 +1,116 @@
+/*
+ Copyright (c) 2006-2012 Red Hat, Inc. <http://www.redhat.com>
+ This file is part of GlusterFS.
+
+ This file is licensed to you under your choice of the GNU Lesser
+ General Public License, version 3 or any later version (LGPLv3 or
+ later), or the GNU General Public License, version 2 (GPLv2), in all
+ cases as published by the Free Software Foundation.
+*/
+
+#include "globals.h"
+#include "run.h"
+#include "glusterd.h"
+#include "glusterd-utils.h"
+#include "glusterd-volgen.h"
+#include "glusterd-bitd-svc.h"
+
+int
+glusterd_bitdsvc_init (glusterd_svc_t *svc)
+{
+ return glusterd_svc_init (svc, bitd_svc_name,
+ glusterd_bitdsvc_manager,
+ glusterd_bitdsvc_start,
+ glusterd_bitdsvc_stop);
+}
+
+static int
+glusterd_bitdsvc_create_volfile ()
+{
+ char filepath[PATH_MAX] = {0,};
+ int ret = -1;
+ glusterd_conf_t *conf = NULL;
+ dict_t *mod_dict = NULL;
+ xlator_t *this = NULL;
+
+ this = THIS;
+ conf = this->private;
+ GF_ASSERT (conf);
+
+
+ mod_dict = dict_new ();
+ if (!mod_dict) {
+ gf_log (this->name, GF_LOG_ERROR, "failed to allocate new "
+ "dict");
+ goto out;
+ }
+
+ ret = dict_set_uint32 (mod_dict, "trusted-client", GF_CLIENT_TRUSTED);
+ if (ret)
+ goto free_dict;
+
+ glusterd_svc_build_volfile_path (bitd_svc_name, conf->workdir,
+ filepath, sizeof (filepath));
+
+ ret = glusterd_create_global_volfile (build_bitd_graph,
+ filepath, mod_dict);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to create volfile");
+ goto free_dict;
+ }
+
+free_dict:
+ dict_unref (mod_dict);
+out:
+ gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
+
+ return ret;
+}
+
+int
+glusterd_bitdsvc_manager (glusterd_svc_t *svc, void *data, int flags)
+{
+ int ret = -1;
+
+ if (glusterd_are_all_volumes_stopped ()) {
+ ret = svc->stop (svc, SIGKILL);
+ } else {
+ ret = glusterd_bitdsvc_create_volfile ();
+ if (ret)
+ goto out;
+
+ ret = svc->stop (svc, SIGKILL);
+ if (ret)
+ goto out;
+
+ ret = svc->start (svc, flags);
+ if (ret)
+ goto out;
+
+ ret = glusterd_conn_connect (&(svc->conn));
+ if (ret)
+ goto out;
+ }
+out:
+ gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret);
+
+ return ret;
+}
+
+int
+glusterd_bitdsvc_start (glusterd_svc_t *svc, int flags)
+{
+ return glusterd_svc_start (svc, flags, NULL);
+}
+
+int
+glusterd_bitdsvc_stop (glusterd_svc_t *svc, int sig)
+{
+ return glusterd_svc_stop (svc, sig);
+}
+
+int
+glusterd_bitdsvc_reconfigure ()
+{
+ return glusterd_svc_reconfigure (glusterd_bitdsvc_create_volfile);
+}
diff --git a/xlators/mgmt/glusterd/src/glusterd-bitd-svc.h b/xlators/mgmt/glusterd/src/glusterd-bitd-svc.h
new file mode 100644
index 00000000000..e6f5d51c7cc
--- /dev/null
+++ b/xlators/mgmt/glusterd/src/glusterd-bitd-svc.h
@@ -0,0 +1,42 @@
+/*
+ Copyright (c) 2006-2012 Red Hat, Inc. <http://www.redhat.com>
+ This file is part of GlusterFS.
+
+ This file is licensed to you under your choice of the GNU Lesser
+ General Public License, version 3 or any later version (LGPLv3 or
+ later), or the GNU General Public License, version 2 (GPLv2), in all
+ cases as published by the Free Software Foundation.
+*/
+
+#ifndef _GLUSTERD_BITD_SVC_H_
+#define _GLUSTERD_BITD_SVC_H_
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+#include "config.h"
+#endif
+
+#include "glusterd-svc-mgmt.h"
+
+#define bitd_svc_name "bitd"
+
+int
+glusterd_bitdsvc_init (glusterd_svc_t *svc);
+
+int
+glusterd_bitdsvc_manager (glusterd_svc_t *svc, void *data, int flags);
+
+int
+glusterd_bitdsvc_start (glusterd_svc_t *svc, int flags);
+
+int
+glusterd_bitdsvc_stop (glusterd_svc_t *svc, int sig);
+
+int
+glusterd_bitdsvc_reconfigure ();
+
+void
+glusterd_bitdsvc_build_volfile_path (char *server, char *workdir,
+ char *volfile, size_t len);
+
+#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 5696229572d..07f47cf9d6e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -1703,7 +1703,7 @@ glusterd_store_volinfo (glusterd_volinfo_t *volinfo, glusterd_volinfo_ver_ac_t a
if (ret)
goto out;
- //checksum should be computed at the end
+ /* checksum should be computed at the end */
ret = glusterd_compute_cksum (volinfo, _gf_false);
if (ret)
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
index f17f34c3530..39384545c86 100644
--- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
@@ -17,6 +17,7 @@
#include "glusterd-shd-svc.h"
#include "glusterd-quotad-svc.h"
#include "glusterd-nfs-svc.h"
+#include "glusterd-bitd-svc.h"
int
glusterd_svcs_reconfigure (glusterd_volinfo_t *volinfo)
@@ -50,6 +51,10 @@ glusterd_svcs_reconfigure (glusterd_volinfo_t *volinfo)
ret = glusterd_quotadsvc_reconfigure ();
if (ret)
goto out;
+
+ ret = glusterd_bitdsvc_reconfigure ();
+ if (ret)
+ goto out;
out:
return ret;
}
@@ -78,6 +83,10 @@ glusterd_svcs_stop ()
ret = glusterd_svc_stop (&(priv->quotad_svc), SIGTERM);
if (ret)
goto out;
+
+ ret = glusterd_svc_stop (&(priv->bitd_svc), SIGTERM);
+ if (ret)
+ goto out;
out:
return ret;
}
@@ -118,6 +127,13 @@ glusterd_svcs_manager (glusterd_volinfo_t *volinfo)
ret = 0;
if (ret)
goto out;
+
+ ret = conf->bitd_svc.manager (&(conf->bitd_svc), volinfo,
+ PROC_START_NO_WAIT);
+ if (ret == -EINVAL)
+ ret = 0;
+ if (ret)
+ goto out;
out:
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 27357955fe8..02d2cfb0932 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -60,6 +60,7 @@
#include "glusterd-nfs-svc.h"
#include "glusterd-quotad-svc.h"
#include "glusterd-snapd-svc.h"
+#include "glusterd-bitd-svc.h"
#include "xdr-generic.h"
#include <sys/resource.h>
@@ -6868,6 +6869,23 @@ out:
}
int
+glusterd_get_bitd_filepath (char *filepath, glusterd_volinfo_t *volinfo)
+{
+ int ret = 0;
+ char path[PATH_MAX] = {0,};
+ glusterd_conf_t *priv = NULL;
+
+ priv = THIS->private;
+
+ GLUSTERD_GET_VOLUME_DIR (path, volinfo, priv);
+
+ snprintf (filepath, PATH_MAX,
+ "%s/%s-bitd.vol", path, volinfo->volname);
+
+ return ret;
+}
+
+int
glusterd_get_client_filepath (char *filepath, glusterd_volinfo_t *volinfo,
gf_transport_type type)
{
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index d7709750129..ea00eea432f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -848,6 +848,8 @@ _xl_link_children (xlator_t *parent, xlator_t *children, size_t child_count)
for (trav = children; --seek; trav = trav->next);
for (; child_count--; trav = trav->prev) {
ret = volgen_xlator_link (parent, trav);
+ gf_log (THIS->name, GF_LOG_DEBUG, "%s:%s", parent->name,
+ trav->name);
if (ret)
goto out;
}
@@ -4306,7 +4308,10 @@ build_quotad_graph (volgen_graph_t *graph, dict_t *mod_dict)
char *skey = NULL;
this = THIS;
+ GF_ASSERT (this);
+
priv = this->private;
+ GF_ASSERT (priv);
set_dict = dict_new ();
if (!set_dict) {
@@ -4708,6 +4713,102 @@ glusterd_snapdsvc_generate_volfile (volgen_graph_t *graph,
}
int
+build_bitd_graph (volgen_graph_t *graph, dict_t *mod_dict)
+{
+ volgen_graph_t cgraph = {0};
+ glusterd_volinfo_t *voliter = NULL;
+ xlator_t *this = NULL;
+ glusterd_conf_t *priv = NULL;
+ dict_t *set_dict = NULL;
+ int ret = 0;
+ xlator_t *bitd_xl = NULL;
+ xlator_t *xl = NULL;
+ xlator_t *trav = NULL;
+ xlator_t *txl = NULL;
+ char *skey = NULL;
+ char transt[16] = {0,};
+ glusterd_brickinfo_t *brickinfo = NULL;
+ char *br_args[] = {"features/bit-rot",
+ "bit-rot"};
+ int32_t count = 0;
+
+ this = THIS;
+ GF_ASSERT (this);
+
+ priv = this->private;
+ GF_ASSERT (priv);
+
+ set_dict = dict_new ();
+ if (!set_dict) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ if (mod_dict)
+ dict_copy (mod_dict, set_dict);
+
+ list_for_each_entry (voliter, &priv->volumes, vol_list) {
+ if (voliter->status != GLUSTERD_STATUS_STARTED)
+ continue;
+
+ memset (transt, '\0', 16);
+
+ get_transport_type (voliter, set_dict, transt, _gf_false);
+ if (!strcmp (transt, "tcp,rdma"))
+ strcpy (transt, "tcp");
+
+
+ list_for_each_entry (brickinfo, &voliter->bricks, brick_list) {
+ if (!glusterd_is_local_brick (this, voliter, brickinfo))
+ continue;
+ /*To do: check whether bitd is enable or not if "
+ * "not then continue;
+ * Since bitd is a service running within the "
+ * trusted storage pool, it is treated as a trusted
+ * client.
+ */
+ xl = volgen_graph_build_client (graph, voliter,
+ brickinfo->hostname,
+ brickinfo->path,
+ brickinfo->brick_id, transt,
+ set_dict);
+ if (!xl) {
+ ret = -1;
+ goto out;
+ }
+
+ count++;
+ }
+ }
+
+ bitd_xl = volgen_graph_add_nolink (graph, br_args[0], br_args[1]);
+ if (!bitd_xl) {
+ ret = -1;
+ goto out;
+ }
+
+ txl = first_of (graph);
+ for (trav = txl; count; trav = trav->next)
+ count--;
+
+ for (; trav != txl; trav = trav->prev) {
+ ret = volgen_xlator_link (bitd_xl, trav);
+ if (ret)
+ goto out;
+ }
+
+ ret = 0;
+
+out:
+ if (set_dict)
+ dict_unref (set_dict);
+
+ gf_log(this->name, GF_LOG_DEBUG, "Returning %d", ret);
+
+ return ret;
+}
+
+int
glusterd_snapdsvc_create_volfile (glusterd_volinfo_t *volinfo)
{
volgen_graph_t graph = {0,};
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h
index 9b6c8c20146..93381fd03eb 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.h
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h
@@ -182,6 +182,9 @@ int
build_quotad_graph (volgen_graph_t *graph, dict_t *mod_dict);
int
+build_bitd_graph (volgen_graph_t *graph, dict_t *mod_dict);
+
+int
glusterd_delete_volfile (glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *brickinfo);
int
@@ -265,10 +268,13 @@ gd_is_xlator_option (char *key);
gf_boolean_t
gd_is_boolean_option (char *key);
+
char*
volgen_get_shd_key (glusterd_volinfo_t *volinfo);
int
glusterd_volopt_validate (glusterd_volinfo_t *volinfo, dict_t *dict, char *key,
char *value, char **op_errstr);
+
+
#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 979ae7ab328..223ee98d0a4 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -41,6 +41,7 @@
#include "glusterd-svc-mgmt.h"
#include "glusterd-shd-svc.h"
#include "glusterd-nfs-svc.h"
+#include "glusterd-bitd-svc.h"
#include "glusterd-quotad-svc.h"
#include "glusterd-snapd-svc.h"
#include "common-utils.h"
@@ -1218,6 +1219,16 @@ glusterd_svc_init_all ()
}
gf_log (THIS->name, GF_LOG_DEBUG, "quotad service initialized");
+ /* Init BitD svc */
+ ret = glusterd_bitdsvc_init (&(priv->bitd_svc));
+ if (ret) {
+ gf_log (THIS->name, GF_LOG_ERROR, "Failed to initialized BitD "
+ "service");
+ goto out;
+ }
+ gf_log (THIS->name, GF_LOG_DEBUG, "BitD service initialized");
+
+
out:
return ret;
}
@@ -1377,6 +1388,15 @@ init (xlator_t *this)
exit (1);
}
+ snprintf (storedir, PATH_MAX, "%s/bitd", workdir);
+ ret = mkdir (storedir, 0777);
+ if ((-1 == ret) && (errno != EEXIST)) {
+ gf_log (this->name, GF_LOG_CRITICAL,
+ "Unable to create bitrot directory %s"
+ " ,errno = %d", storedir, errno);
+ exit (1);
+ }
+
snprintf (storedir, PATH_MAX, "%s/glustershd", workdir);
ret = mkdir (storedir, 0777);
if ((-1 == ret) && (errno != EEXIST)) {
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 2dd6348ac7f..e7a4a13d3ec 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -33,6 +33,7 @@
#include "rpcsvc.h"
#include "glusterd-sm.h"
#include "glusterd-snapd-svc.h"
+#include "glusterd-bitd-svc.h"
#include "glusterd1-xdr.h"
#include "protocol-common.h"
#include "glusterd-pmap.h"
@@ -133,6 +134,7 @@ typedef struct {
rpcsvc_t *rpc;
glusterd_svc_t shd_svc;
glusterd_svc_t nfs_svc;
+ glusterd_svc_t bitd_svc;
glusterd_svc_t quotad_svc;
struct pmap_registry *pmap;
struct cds_list_head volumes;