From dc321571317b911faa31eed8b3bd4ce396963179 Mon Sep 17 00:00:00 2001 From: "Anand V. Avati" Date: Wed, 24 Jun 2009 18:31:10 +0000 Subject: dht_readdir_cbk: use stat attributes in the READDIRPLUS dirents to Signed-off-by: Anand V. Avati --- xlators/cluster/dht/src/dht-common.c | 43 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index d367d26a293..62f3822a5e1 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -2110,10 +2110,8 @@ dht_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_dirent_t *orig_entry = NULL; gf_dirent_t *entry = NULL; call_frame_t *prev = NULL; - xlator_t *subvol = NULL; xlator_t *next_subvol = NULL; off_t next_offset = 0; - dht_layout_t *layout = NULL; int count = 0; @@ -2124,31 +2122,32 @@ 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); + list_for_each_entry (orig_entry, (&orig_entries->list), list) { + next_offset = orig_entry->d_off; - list_for_each_entry (orig_entry, &orig_entries->list, list) { - subvol = dht_layout_search (this, layout, orig_entry->d_name); + 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; + } - if (!subvol || subvol == prev->this) { - entry = gf_dirent_for_name (orig_entry->d_name); - if (!entry) { - gf_log (this->name, GF_LOG_ERROR, - "Out of memory"); - goto unwind; - } + entry = gf_dirent_for_name (orig_entry->d_name); + if (!entry) { + gf_log (this->name, GF_LOG_ERROR, + "Out of memory"); + 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++; - } - next_offset = orig_entry->d_off; + list_add_tail (&entry->list, &entries.list); + count++; } op_ret = count; -- cgit