From 833a2225449d1f4873647a61c8ba481e4db1ec4b Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 3 Feb 2012 16:03:16 +0530 Subject: cluster/distribute: set the inode layout in readdirp_cbk() for files with this, inode-linking it in readdirp_cbk will be neater. Change-Id: Ie2cd646438f851e1755e9b6a3fc9898059bee359 Signed-off-by: Amar Tumballi BUG: 816140 Reviewed-on: http://review.gluster.com/2717 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Anand Avati --- xlators/cluster/dht/src/dht-common.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 7ac08c65..eaafc2bf 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -2766,6 +2766,7 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, dht_layout_t *layout = 0; dht_conf_t *conf = NULL; xlator_t *subvol = 0; + int ret = 0; INIT_LIST_HEAD (&entries.list); prev = cookie; @@ -2814,6 +2815,21 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, entry->d_type = orig_entry->d_type; entry->d_len = orig_entry->d_len; + if (orig_entry->dict) + entry->dict = dict_ref (orig_entry->dict); + + /* making sure we set the inode ctx right with layout, + currently possible only for non-directories, so for + directories don't set entry inodes */ + if (!IA_ISDIR(entry->d_stat.ia_type)) { + ret = dht_layout_preset (this, prev->this, + orig_entry->inode); + if (ret) + gf_log (this->name, GF_LOG_WARNING, + "failed to link the layout in inode"); + entry->inode = inode_ref (orig_entry->inode); + } + list_add_tail (&entry->list, &entries.list); count++; } -- cgit