summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-store.c
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2013-08-25 15:11:54 +0530
committerKrutika Dhananjay <kdhananj@redhat.com>2013-08-25 15:12:34 +0530
commit637b185e55eca1e0c6e2b8c6e5b2244909361104 (patch)
tree70f454d130abfaa8796415d042c40e601cf365ac /xlators/mgmt/glusterd/src/glusterd-store.c
parent95f338ef6a575b431cad3a6ce7baaa70ff04b8ad (diff)
glusterd: Implement persistent store for quota
Setting quota limits on a given directory will cause glusterd to persist the gfid of the path in WD/vols/<volname>/quota.conf. Also, executing 'quota remove' will cause glusterd to remove the gfid of the given path. This is needed for implementing the 'list-all' variant of 'quota list' command. To-Do: 1. Exchange quota.conf when a new node is added into the cluster; 2. Unlink quota.conf on disabling quota (?) Change-Id: I7d75a9cdb43e4e1389ddb08ffe09b294d36f87d8 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-store.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 71c8428e..b9f4792d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -683,6 +683,21 @@ glusterd_store_node_state_path_set (glusterd_volinfo_t *volinfo,
GLUSTERD_NODE_STATE_FILE);
}
+static void
+glusterd_store_quota_conf_path_set (glusterd_volinfo_t *volinfo,
+ char *quota_conf_path, size_t len)
+{
+ char voldirpath[PATH_MAX] = {0,};
+ GF_ASSERT (volinfo);
+ GF_ASSERT (quota_conf_path);
+ GF_ASSERT (len <= PATH_MAX);
+
+ glusterd_store_voldirpath_set (volinfo, voldirpath,
+ sizeof (voldirpath));
+ snprintf (quota_conf_path, len, "%s/%s", voldirpath,
+ GLUSTERD_VOLUME_QUOTA_CONFIG);
+}
+
int32_t
glusterd_store_create_rbstate_shandle_on_absence (glusterd_volinfo_t *volinfo)
{
@@ -728,6 +743,22 @@ glusterd_store_create_nodestate_sh_on_absence (glusterd_volinfo_t *volinfo)
}
int32_t
+glusterd_store_create_quota_conf_sh_on_absence (glusterd_volinfo_t *volinfo)
+{
+ char quota_conf_path[PATH_MAX] = {0};
+ int32_t ret = 0;
+
+ GF_ASSERT (volinfo);
+
+ glusterd_store_quota_conf_path_set (volinfo, quota_conf_path,
+ sizeof (quota_conf_path));
+ ret =
+ gf_store_handle_create_on_absence (&volinfo->quota_conf_shandle,
+ quota_conf_path);
+
+ return ret;
+}
+int32_t
glusterd_store_brickinfos (glusterd_volinfo_t *volinfo, int vol_fd)
{
int32_t ret = 0;