summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2012-05-01 11:40:17 +0200
committerAnand Avati <avati@redhat.com>2012-05-18 20:33:01 -0700
commitbde1f0b8b645e3d8a4acfc859bb530af3d7dab5b (patch)
treefa05508b113bb42b138738ef31124ef4db8402b5 /xlators
parentfa90243e20eeef91eda5a5bb249bed05066852e3 (diff)
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 <ndevos@redhat.com> Reviewed-on: http://review.gluster.com/3256 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c1
-rw-r--r--xlators/storage/posix/src/posix.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 86deaea07..401ff6495 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 f98056286..0b469ec66 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);