21ab4e
From 193898e3ad26f01c1339893e205dd86d1dbef616 Mon Sep 17 00:00:00 2001
21ab4e
From: Krutika Dhananjay <kdhananj@redhat.com>
21ab4e
Date: Thu, 9 Feb 2017 21:12:17 +0530
21ab4e
Subject: [PATCH 414/426] cluster/dht: Use int8 instead of string to pass
21ab4e
 DHT_IATT_IN_XDATA_KEY
21ab4e
21ab4e
        Backport of: https://review.gluster.org/16591
21ab4e
21ab4e
It is sufficient to pass an int value as opposed to a "yes" against the
21ab4e
DHT_IATT_IN_XDATA_KEY key since all posix cares about is whether the
21ab4e
key is present in the dict or not. Also note that this patch does not
21ab4e
violate backward compatibility since the handling of the key in posix
21ab4e
remains untouched.
21ab4e
21ab4e
Change-Id: I2d2f2240cf19f2e2a985c61b765ab3acb446ffb4
21ab4e
BUG: 1434653
21ab4e
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/105208
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 xlators/cluster/dht/src/dht-common.c   | 12 ++++--------
21ab4e
 xlators/cluster/dht/src/dht-selfheal.c |  2 +-
21ab4e
 xlators/cluster/dht/src/tier-common.c  |  3 +--
21ab4e
 3 files changed, 6 insertions(+), 11 deletions(-)
21ab4e
21ab4e
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
21ab4e
index 81afabe..4512e29 100644
21ab4e
--- a/xlators/cluster/dht/src/dht-common.c
21ab4e
+++ b/xlators/cluster/dht/src/dht-common.c
21ab4e
@@ -3850,8 +3850,7 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
21ab4e
 
21ab4e
                 xdata = xdata ? dict_ref (xdata) : dict_new ();
21ab4e
                 if (xdata)
21ab4e
-                        ret = dict_set_dynstr_with_alloc (xdata,
21ab4e
-                                        DHT_IATT_IN_XDATA_KEY, "yes");
21ab4e
+                        ret = dict_set_int8 (xdata, DHT_IATT_IN_XDATA_KEY, 1);
21ab4e
                 if (ret) {
21ab4e
                         gf_msg_debug (this->name, 0,
21ab4e
                                       "Failed to set dictionary key %s for fd=%p",
21ab4e
@@ -4259,8 +4258,7 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
21ab4e
 
21ab4e
                 xdata = xdata ? dict_ref (xdata) : dict_new ();
21ab4e
                 if (xdata)
21ab4e
-                        ret = dict_set_dynstr_with_alloc (xdata,
21ab4e
-                                              DHT_IATT_IN_XDATA_KEY, "yes");
21ab4e
+                        ret = dict_set_int8 (xdata, DHT_IATT_IN_XDATA_KEY, 1);
21ab4e
 
21ab4e
                 STACK_WIND_COOKIE (frame, dht_file_setxattr_cbk, subvol,
21ab4e
                                    subvol, subvol->fops->setxattr, loc, xattr,
21ab4e
@@ -4502,8 +4500,7 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
21ab4e
                 local->call_cnt = 1;
21ab4e
                 xdata = xdata ? dict_ref (xdata) : dict_new ();
21ab4e
                 if (xdata)
21ab4e
-                        ret = dict_set_dynstr_with_alloc (xdata,
21ab4e
-                                 DHT_IATT_IN_XDATA_KEY, "yes");
21ab4e
+                        ret = dict_set_int8 (xdata, DHT_IATT_IN_XDATA_KEY, 1);
21ab4e
                 if (ret) {
21ab4e
                         gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
21ab4e
                                 DHT_MSG_DICT_SET_FAILED, "Failed to "
21ab4e
@@ -4592,8 +4589,7 @@ dht_fremovexattr (call_frame_t *frame, xlator_t *this,
21ab4e
                 local->call_cnt = 1;
21ab4e
                 xdata = xdata ? dict_ref (xdata) : dict_new ();
21ab4e
                 if (xdata)
21ab4e
-                        ret = dict_set_dynstr_with_alloc (xdata,
21ab4e
-                                 DHT_IATT_IN_XDATA_KEY, "yes");
21ab4e
+                        ret = dict_set_int8 (xdata, DHT_IATT_IN_XDATA_KEY, 1);
21ab4e
                 if (ret) {
21ab4e
                         gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
21ab4e
                                 DHT_MSG_DICT_SET_FAILED, "Failed to "
21ab4e
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
21ab4e
index 267eb55..c2d1c14 100644
21ab4e
--- a/xlators/cluster/dht/src/dht-selfheal.c
21ab4e
+++ b/xlators/cluster/dht/src/dht-selfheal.c
21ab4e
@@ -700,7 +700,7 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,
21ab4e
                 goto err;
21ab4e
         }
21ab4e
 
21ab4e
-        ret = dict_set_dynstr_with_alloc (xdata, DHT_IATT_IN_XDATA_KEY, "yes");
21ab4e
+        ret = dict_set_int8 (xdata, DHT_IATT_IN_XDATA_KEY, 1);
21ab4e
         if (ret < 0) {
21ab4e
                 gf_msg (this->name, GF_LOG_WARNING, 0, DHT_MSG_DICT_SET_FAILED,
21ab4e
                         "%s: Failed to set dictionary value: key = %s,"
21ab4e
diff --git a/xlators/cluster/dht/src/tier-common.c b/xlators/cluster/dht/src/tier-common.c
21ab4e
index 3b22d0a..1cb56ea 100644
21ab4e
--- a/xlators/cluster/dht/src/tier-common.c
21ab4e
+++ b/xlators/cluster/dht/src/tier-common.c
21ab4e
@@ -735,8 +735,7 @@ tier_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
21ab4e
                  */
21ab4e
                 xdata = xdata ? dict_ref (xdata) : dict_new ();
21ab4e
                 if (xdata) {
21ab4e
-                        ret = dict_set_dynstr_with_alloc (xdata,
21ab4e
-                                DHT_IATT_IN_XDATA_KEY, "yes");
21ab4e
+                        ret = dict_set_int8 (xdata, DHT_IATT_IN_XDATA_KEY, 1);
21ab4e
                         if (ret) {
21ab4e
                                 gf_msg_debug (this->name, 0,
21ab4e
                                         "Failed to set dictionary key %s",
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e