From bde1f0b8b645e3d8a4acfc859bb530af3d7dab5b Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Tue, 1 May 2012 11:40:17 +0200 Subject: storage/posix,fuse-bridge: fill the d_type attribute in READDIRP replies d_type should contain the type of the the dir-entry (man 3 readdir). Currently the d_type is always set to DT_UNKNOWN (0). The POSIX standard readdir() returns a 'struct dirent' on both Linux and NetBSD with the d_type attribute. Commit bb315cb180c3547218b5ed581d38e76aec74cf94 removed setting d_type in xlators/mount/fuse/src/fuse-bridge.c. This was using d_type_from_stat(). The stat() seems to have been removed for performance reasons. Instead of removing d_type completely, dirent->d_type could have been used. Therefore the fuse-brige can now add "fde->type = entry->d_type" back into fuse_readdir_cbk() without causing the previous performance impact. Change-Id: I4514bbc0acceb33d09c3cf50bda51e34d953efca BUG: 817785 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.com/3256 Tested-by: Gluster Build System Reviewed-by: Kaleb KEITHLEY Reviewed-by: Anand Avati --- xlators/mount/fuse/src/fuse-bridge.c | 1 + xlators/storage/posix/src/posix.c | 1 + 2 files changed, 2 insertions(+) diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 86deaea0790..401ff64955e 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -2351,6 +2351,7 @@ fuse_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, fde = (struct fuse_dirent *)(buf + size); fde->ino = entry->d_ino; fde->off = entry->d_off; + fde->type = entry->d_type; fde->namelen = strlen (entry->d_name); strncpy (fde->name, entry->d_name, fde->namelen); size += FUSE_DIRENT_SIZE (fde); diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index f9805628689..0b469ec669f 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -3578,6 +3578,7 @@ posix_fill_readdir (fd_t *fd, DIR *dir, off_t off, size_t size, } this_entry->d_off = telldir (dir); this_entry->d_ino = entry->d_ino; + this_entry->d_type = entry->d_type; list_add_tail (&this_entry->list, &entries->list); -- cgit