diff options
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 58 |
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 fcdbe6a88e4..90fac564d00 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: |