From 91604e7edd778ff7556e6020d9c5489afcd3fc98 Mon Sep 17 00:00:00 2001 From: szaka Date: Thu, 27 Sep 2007 22:15:03 +0000 Subject: [PATCH] optimization: find(1) is 20-200% faster for disk based and 300-600% faster for memory cache based directory traversals --- src/ntfs-3g.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index 0a50ef92..ab63eb31 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -568,7 +568,14 @@ static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx, if (MREF(mref) == FILE_root || MREF(mref) >= FILE_first_user || ctx->show_sys_files) { - struct stat st = { .st_ino = MREF(mref) }; + struct stat st = {}; + + st.st_ino = MREF(mref); + + if (dt_type == NTFS_DT_REG) + st.st_mode = S_IFREG | (0777 & ~ctx->fmask); + else if (dt_type == NTFS_DT_DIR) + st.st_mode = S_IFDIR | (0777 & ~ctx->dmask); ret = fill_ctx->filler(fill_ctx->buf, filename, &st, 0); }