summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2010-02-23 02:52:46 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-02-23 01:42:19 -0800
commit24309c6e131a5bf84b05ae26d10838b94ffd28c4 (patch)
tree6ee5374161d81cb51b169974b648b87b33b1f95a /xlators/cluster
parentfa598e1bbb33125f0463f4cfc382206fbabb352d (diff)
dht: fix READDIR semantics which got broken in 512dcad823feb199d78f5b66a09bc404ccb899e8
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 584 (automatically configure 'lookup-unhashed' option) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=584
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/dht/src/dht-common.c58
1 files changed, 24 insertions, 34 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index fcdbe6a88..90fac564d 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -2121,9 +2121,9 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
goto done;
if (!local->layout)
- local->layout = layout = dht_layout_get (this, local->fd->inode);
- else
- layout = local->layout;
+ local->layout = dht_layout_get (this, local->fd->inode);
+
+ layout = local->layout;
list_for_each_entry (orig_entry, (&orig_entries->list), list) {
next_offset = orig_entry->d_off;
@@ -2225,46 +2225,36 @@ dht_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0)
goto done;
- layout = dht_layout_get (this, local->fd->inode);
+ if (!local->layout)
+ local->layout = dht_layout_get (this, local->fd->inode);
+
+ layout = local->layout;
list_for_each_entry (orig_entry, (&orig_entries->list), list) {
next_offset = orig_entry->d_off;
- if (check_is_linkfile (NULL, (&orig_entry->d_stat), NULL)
- || (check_is_dir (NULL, (&orig_entry->d_stat), NULL)
- && (prev->this != dht_first_up_subvol (this)))) {
- continue;
- }
-
- entry = gf_dirent_for_name (orig_entry->d_name);
- if (!entry) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
- goto unwind;
- }
+ subvol = dht_layout_search (this, layout, orig_entry->d_name);
- /* Do this if conf->search_unhashed is set to "auto" */
- if (conf->search_unhashed == GF_DHT_LOOKUP_UNHASHED_AUTO) {
- subvol = dht_layout_search (this, layout,
- orig_entry->d_name);
- if (!subvol || (subvol != prev->this)) {
- /* TODO: Count the number of entries which need
- linkfile to prove its existance in fs */
- layout->search_unhashed++;
+ if (!subvol || (subvol != prev->this)) {
+ entry = gf_dirent_for_name (orig_entry->d_name);
+ if (!entry) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "memory allocation failed :(");
+ goto unwind;
}
- }
- dht_itransform (this, prev->this, orig_entry->d_ino,
- &entry->d_ino);
- dht_itransform (this, prev->this, orig_entry->d_off,
- &entry->d_off);
+ dht_itransform (this, prev->this, orig_entry->d_ino,
+ &entry->d_ino);
+ dht_itransform (this, prev->this, orig_entry->d_off,
+ &entry->d_off);
- entry->d_type = orig_entry->d_type;
- entry->d_len = orig_entry->d_len;
+ entry->d_type = orig_entry->d_type;
+ entry->d_len = orig_entry->d_len;
- list_add_tail (&entry->list, &entries.list);
- count++;
- }
+ list_add_tail (&entry->list, &entries.list);
+ count++;
+ }
+ }
op_ret = count;
done: