Patchwork [BUG:1508,1/2] cluster/distribute: add option 'use-readdirp' to force readdirp

login
register
Submitter Amar Tumballi
Date 2010-09-02 12:56:54
Message ID <20100902125654.GA15531@gluster.com>
Download mbox | patch
Permalink /patch/4488/
State Accepted
Headers show

Comments

Amar Tumballi - 2010-09-02 12:56:54
Signed-off-by: Amar Tumballi <amar@gluster.com>
---
 xlators/cluster/dht/src/dht-common.c |    3 +++
 xlators/cluster/dht/src/dht-common.h |    1 +
 xlators/cluster/dht/src/dht.c        |   12 +++++++++++-
 3 files changed, 15 insertions(+), 1 deletions(-)

Patch

diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index b938921..32ba718 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -2637,6 +2637,9 @@  dht_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
                 }
         }
 
+        if (conf->use_readdirp)
+                op = GF_FOP_READDIRP;
+
         dht_do_readdir (frame, this, fd, size, yoff, op);
         return 0;
 }
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
index dfdaf7e..464832c 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -155,6 +155,7 @@  struct dht_conf {
         gf_lock_t      layout_lock;
         void          *private;     /* Can be used by wrapper xlators over
                                        dht */
+        gf_boolean_t   use_readdirp;
 };
 typedef struct dht_conf dht_conf_t;
 
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c
index 13f382a..c926a1c 100644
--- a/xlators/cluster/dht/src/dht.c
+++ b/xlators/cluster/dht/src/dht.c
@@ -294,7 +294,14 @@  init (xlator_t *this)
                           &temp_str) == 0) {
 	        gf_string2boolean (temp_str, &conf->unhashed_sticky_bit);
 	}
-        
+
+	conf->use_readdirp = 0;
+
+	if (dict_get_str (this->options, "use-readdirp",
+                          &temp_str) == 0) {
+	        gf_string2boolean (temp_str, &conf->use_readdirp);
+	}
+
         conf->disk_unit = 'p';
         conf->min_free_disk = 10;
 
@@ -435,5 +442,8 @@  struct volume_options options[] = {
         { .key = {"unhashed-sticky-bit"},
           .type = GF_OPTION_TYPE_BOOL
         },
+        { .key = {"use-readdirp"},
+          .type = GF_OPTION_TYPE_BOOL
+        },
 	{ .key  = {NULL} },
 };