d1681e
From a81170eca4848c6bd2d0fa9e8a2c9fc9803b868e Mon Sep 17 00:00:00 2001
d1681e
From: Poornima G <pgurusid@redhat.com>
d1681e
Date: Thu, 4 Jan 2018 19:39:05 +0530
d1681e
Subject: [PATCH 212/212] readdir-ahead: Cleanup the xattr request code
d1681e
d1681e
upstream master: https://review.gluster.org/#/c/19172/
d1681e
d1681e
> Change-Id: Ia0c697583751290a455da3cd1894e0c5685d1bd8
d1681e
> updates: #297
d1681e
> Signed-off-by: Poornima G <pgurusid@redhat.com>
d1681e
d1681e
BUG: 1559884
d1681e
Change-Id: Ia0c697583751290a455da3cd1894e0c5685d1bd8
d1681e
Signed-off-by: Poornima G <pgurusid@redhat.com>
d1681e
Reviewed-on: https://code.engineering.redhat.com/gerrit/134500
d1681e
Tested-by: RHGS Build Bot <nigelb@redhat.com>
d1681e
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
d1681e
---
d1681e
 .../performance/readdir-ahead/src/readdir-ahead.c  | 42 ++--------------------
d1681e
 1 file changed, 2 insertions(+), 40 deletions(-)
d1681e
d1681e
diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead.c b/xlators/performance/readdir-ahead/src/readdir-ahead.c
d1681e
index c2ceda4..0d3bdbd 100644
d1681e
--- a/xlators/performance/readdir-ahead/src/readdir-ahead.c
d1681e
+++ b/xlators/performance/readdir-ahead/src/readdir-ahead.c
d1681e
@@ -474,31 +474,6 @@ err:
d1681e
 	return -1;
d1681e
 }
d1681e
 
d1681e
-
d1681e
-static int
d1681e
-rda_unpack_mdc_loaded_keys_to_dict(char *payload, dict_t *dict)
d1681e
-{
d1681e
-        int      ret = -1;
d1681e
-        char    *mdc_key = NULL;
d1681e
-
d1681e
-        if (!payload || !dict) {
d1681e
-                goto out;
d1681e
-        }
d1681e
-
d1681e
-        mdc_key = strtok(payload, " ");
d1681e
-        while (mdc_key != NULL) {
d1681e
-                ret = dict_set_int8 (dict, mdc_key, 0);
d1681e
-                if (ret) {
d1681e
-                        goto out;
d1681e
-                }
d1681e
-                mdc_key = strtok(NULL, " ");
d1681e
-        }
d1681e
-
d1681e
-out:
d1681e
-        return ret;
d1681e
-}
d1681e
-
d1681e
-
d1681e
 static int32_t
d1681e
 rda_opendir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
d1681e
 		    int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
d1681e
@@ -528,9 +503,7 @@ static int32_t
d1681e
 rda_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
d1681e
 		dict_t *xdata)
d1681e
 {
d1681e
-        int                  ret = -1;
d1681e
         int                  op_errno = 0;
d1681e
-        char                *payload = NULL;
d1681e
         struct rda_local    *local = NULL;
d1681e
         dict_t              *xdata_from_req = NULL;
d1681e
 
d1681e
@@ -552,21 +525,10 @@ rda_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
d1681e
                  * Retrieve list of keys set by md-cache xlator and store it
d1681e
                  * in local to be consumed in rda_opendir_cbk
d1681e
                  */
d1681e
-                ret = dict_get_str (xdata, GF_MDC_LOADED_KEY_NAMES, &payload);
d1681e
-                if (ret)
d1681e
-                        goto wind;
d1681e
-                ret = rda_unpack_mdc_loaded_keys_to_dict((char *) payload,
d1681e
-                                                         xdata_from_req);
d1681e
-                if (ret)
d1681e
-                        goto wind;
d1681e
-
d1681e
-                dict_copy (xdata, xdata_from_req);
d1681e
-                dict_del (xdata_from_req, GF_MDC_LOADED_KEY_NAMES);
d1681e
-
d1681e
-                local->xattrs = xdata_from_req;
d1681e
+                local->xattrs = dict_ref (xdata);
d1681e
                 frame->local = local;
d1681e
         }
d1681e
-wind:
d1681e
+
d1681e
         STACK_WIND(frame, rda_opendir_cbk, FIRST_CHILD(this),
d1681e
                    FIRST_CHILD(this)->fops->opendir, loc, fd, xdata);
d1681e
         return 0;
d1681e
-- 
d1681e
1.8.3.1
d1681e