From e4142724f491c52f1ce6549964cc2359d655330a Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Thu, 13 May 2010 12:42:35 +0000 Subject: fuse, dht: use readdir by default. dht - switch over to readdirp based algo if one subvolume is down Signed-off-by: Anand V. Avati Signed-off-by: Anand V. Avati Signed-off-by: Anand V. Avati BUG: 898 (small file performance enhancements) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=898 --- xlators/cluster/dht/src/dht-common.c | 17 +++++++++++++++-- xlators/mount/fuse/src/fuse-bridge.c | 5 ++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 02557a005a4..b0674f18e91 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -2194,7 +2194,7 @@ dht_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, subvol = dht_layout_search (this, layout, orig_entry->d_name); - if (!subvol || (subvol != prev->this)) { + if (!subvol || (subvol == prev->this)) { entry = gf_dirent_for_name (orig_entry->d_name); if (!entry) { gf_log (this->name, GF_LOG_ERROR, @@ -2301,7 +2301,20 @@ int dht_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t yoff) { - dht_do_readdir (frame, this, fd, size, yoff, GF_FOP_READDIR); + int op = GF_FOP_READDIR; + dht_conf_t *conf = NULL; + int i = 0; + + conf = this->private; + + for (i = 0; i < conf->subvolume_cnt; i++) { + if (!conf->subvolume_status[i]) { + op = GF_FOP_READDIRP; + break; + } + } + + dht_do_readdir (frame, this, fd, size, yoff, op); return 0; } diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index af310271a6c..682eb447e31 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -2216,7 +2216,6 @@ fuse_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, fde = (struct fuse_dirent *)(buf + size); fde->ino = entry->d_ino; fde->off = entry->d_off; - fde->type = d_type_from_stat (&entry->d_stat); fde->namelen = strlen (entry->d_name); strncpy (fde->name, entry->d_name, fde->namelen); size += FUSE_DIRENT_SIZE (fde); @@ -2252,8 +2251,8 @@ fuse_readdir (xlator_t *this, fuse_in_header_t *finh, void *msg) "%"PRIu64": READDIR (%p, size=%"PRIu32", offset=%"PRId64")", finh->unique, fd, fri->size, fri->offset); - FUSE_FOP (state, fuse_readdir_cbk, GF_FOP_READDIRP, - readdirp, fd, fri->size, fri->offset); + FUSE_FOP (state, fuse_readdir_cbk, GF_FOP_READDIR, + readdir, fd, fri->size, fri->offset); } -- cgit