Patchwork [BRANCH:release-3.0,BUG:1508] cluster/distribute: add option 'use-readdirp' to force readdirp

login
register
Submitter Amar Tumballi
Date 2010-10-14 17:59:11
Message ID <20101014175911.GA31941@dev.gluster.com>
Download mbox | patch
Permalink /patch/5504/
State Accepted
Headers show

Comments

Amar Tumballi - 2010-10-14 17:59:11
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Vijay Bellur <vijay@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 b0674f1..82c3d63 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -2314,6 +2314,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 ca047ef..bcbf002 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -142,6 +142,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 d7f1874..72207b9 100644
--- a/xlators/cluster/dht/src/dht.c
+++ b/xlators/cluster/dht/src/dht.c
@@ -272,7 +272,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;
 
@@ -421,5 +428,8 @@  struct volume_options options[] = {
         { .key = {"unhashed-sticky-bit"},
           .type = GF_OPTION_TYPE_BOOL
         },
+        { .key = {"use-readdirp"},
+          .type = GF_OPTION_TYPE_BOOL
+        },
 	{ .key  = {NULL} },
 };