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