From 84952d98750165f211d632940fbbd95059553dc2 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Tue, 28 Sep 2010 06:21:44 +0000 Subject: Changing readdir calls to readdirp calls in DHT Changing readdir calls to readdirp calls to handle layout issues seen in dht. Also, changing posix readdir call to do stat after dir read for readdirp. Signed-off-by: shishir gowda Signed-off-by: Vijay Bellur BUG: 1690 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1690 --- xlators/storage/posix/src/posix.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'xlators/storage/posix/src/posix.c') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 81969ed4e0a..65ff6418eb3 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -3864,6 +3864,7 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, struct posix_private *priv = NULL; struct iatt stbuf = {0, }; char base_path[PATH_MAX] = {0,}; + gf_dirent_t *tmp_entry = NULL; VALIDATE_OR_GOTO (frame, out); VALIDATE_OR_GOTO (this, out); @@ -3962,24 +3963,8 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, break; } - if (whichop == GF_FOP_READDIRP) { - strcpy (entry_path + real_path_len + 1, entry->d_name); - /* Don't check for return value of below function. - * because, if there is some data already existing, - * (before gfid changes), this function fails to fill - * gfid info (but gets the 'struct iatt' properly). - */ - posix_lstat_with_gfid (this, entry_path, &stbuf); - } else - stbuf.ia_ino = entry->d_ino; - - /* So at this point stbuf ino is either: - * a. the original inode number got from entry, in case this - * was a readdir fop or if device spanning was disabled. - * - * b. the scaled inode number, if device spanning was enabled - * or this was a readdirp fop. - */ + stbuf.ia_ino = entry->d_ino; + entry->d_ino = stbuf.ia_ino; this_entry = gf_dirent_for_name (entry->d_name); @@ -3992,8 +3977,6 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, } this_entry->d_off = telldir (dir); this_entry->d_ino = entry->d_ino; - this_entry->d_stat = stbuf; - uuid_copy (this_entry->d_stat.ia_gfid, stbuf.ia_gfid); list_add_tail (&this_entry->list, &entries.list); @@ -4001,6 +3984,14 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, count ++; } + if (whichop == GF_FOP_READDIRP) { + list_for_each_entry (tmp_entry, &entries.list, list) { + strcpy (entry_path + real_path_len + 1, + tmp_entry->d_name); + posix_lstat_with_gfid (this, entry_path, &stbuf); + tmp_entry->d_stat = stbuf; + } + } op_ret = count; errno = 0; if ((!readdir (dir) && (errno == 0))) -- cgit