summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2016-01-06 14:30:08 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-07-25 23:47:33 -0700
commitd2bd17e5a53d0ffa375df1a5ad957556be2f2b83 (patch)
tree872633e25252817ee332d0b64a92cd64eba7464b /xlators/cluster
parent558a45fa527b01ec81904150532a8b661c06ae8a (diff)
dict: Don't expose get_new_dict/dict_destroy
get_new_dict/dict_destroy is causing confusion where, dict_new/dict_destroy or get_new_dict/dict_unref are used instead of dict_new/dict_unref. Change-Id: I4cc69f5b6711d720823395e20fd624a0c6c1168c BUG: 1296043 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/13183 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c6
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-name.c2
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c16
-rw-r--r--xlators/cluster/dht/src/dht-shared.c2
4 files changed, 12 insertions, 14 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index a4c0e89e434..0ad4b644c42 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -1132,13 +1132,13 @@ afr_selfheal_unlocked_lookup_on (call_frame_t *frame, inode_t *parent,
dict_copy (xattr, xattr_req);
if (afr_xattr_req_prepare (frame->this, xattr_req) != 0) {
- dict_destroy (xattr_req);
+ dict_unref (xattr_req);
return NULL;
}
inode = inode_new (parent->table);
if (!inode) {
- dict_destroy (xattr_req);
+ dict_unref (xattr_req);
return NULL;
}
@@ -1176,7 +1176,7 @@ afr_selfheal_unlocked_discover_on (call_frame_t *frame, inode_t *inode,
return -ENOMEM;
if (afr_xattr_req_prepare (frame->this, xattr_req) != 0) {
- dict_destroy (xattr_req);
+ dict_unref (xattr_req);
return -ENOMEM;
}
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c
index 3445ecccf9c..b11285ca54e 100644
--- a/xlators/cluster/afr/src/afr-self-heal-name.c
+++ b/xlators/cluster/afr/src/afr-self-heal-name.c
@@ -576,7 +576,7 @@ afr_selfheal_name_do (call_frame_t *frame, xlator_t *this, inode_t *parent,
ret = dict_set_int32 (xattr, GF_GFIDLESS_LOOKUP, 1);
if (ret) {
- dict_destroy (xattr);
+ dict_unref (xattr);
return -1;
}
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index d3de1b76795..d197117b838 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -680,7 +680,7 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,
conf = this->private;
- xattr = get_new_dict ();
+ xattr = dict_new ();
if (!xattr) {
goto err;
}
@@ -726,7 +726,6 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,
"Directory self heal xattr failed:"
"%s: (subvol %s) Failed to set xattr dictionary,"
" gfid = %s", loc->path, subvol->name, gfid);
- GF_FREE (disk_layout);
goto err;
}
disk_layout = NULL;
@@ -736,7 +735,6 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,
" for %s", layout->list[i].start, layout->list[i].stop,
layout->type, subvol->name, loc->path);
- dict_ref (xattr);
if (local->xattr) {
data = dict_get (local->xattr, QUOTA_LIMIT_KEY);
if (data) {
@@ -776,7 +774,7 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,
err:
if (xattr)
- dict_destroy (xattr);
+ dict_unref (xattr);
if (xdata)
dict_unref (xdata);
@@ -2411,7 +2409,7 @@ dht_update_commit_hash_for_layout_resume (call_frame_t *frame, void *cookie,
goto err;
}
- xattr[i] = get_new_dict ();
+ xattr[i] = dict_new ();
if (!xattr[i]) {
local->op_errno = errno;
@@ -2452,22 +2450,22 @@ dht_update_commit_hash_for_layout_resume (call_frame_t *frame, void *cookie,
local->op_ret = 0;
local->op_errno = 0;
for (i = 0; i < count; i++) {
- dict_ref (xattr[i]);
-
STACK_WIND (frame, dht_update_commit_hash_for_layout_cbk,
conf->local_subvols[i],
conf->local_subvols[i]->fops->setxattr,
&local->loc, xattr[i], 0, NULL);
- dict_unref (xattr[i]);
}
+ for (i = 0; i < count; i++)
+ dict_unref (xattr[i]);
+ GF_FREE (xattr);
return 0;
err:
if (xattr) {
for (i = 0; i < count; i++) {
if (xattr[i])
- dict_destroy (xattr[i]);
+ dict_unref (xattr[i]);
}
GF_FREE (xattr);
diff --git a/xlators/cluster/dht/src/dht-shared.c b/xlators/cluster/dht/src/dht-shared.c
index 0fea1d58e58..873ced53eec 100644
--- a/xlators/cluster/dht/src/dht-shared.c
+++ b/xlators/cluster/dht/src/dht-shared.c
@@ -235,7 +235,7 @@ dht_fini (xlator_t *this)
GF_FREE (conf->file_layouts);
}
- dict_destroy(conf->leaf_to_subvol);
+ dict_unref(conf->leaf_to_subvol);
GF_FREE (conf->subvolumes);