small lstat() performance patch, 2.1.50

Ingo Molnar (mingo@pc7537.hil.siemens.at)
Sat, 16 Aug 1997 11:22:20 +0200 (MET DST)


Here is a patch that improves lstat() performance. x86 latencies for a
cached lstat("test",&buff):

2.1.50 2.1.50+patch
---------- ------------
906 cycles 826 cycles

as a result, an ls -aR on the 2.1.50 Linux source tree dropped from 0.16
seconds to 0.15 seconds, what a joy =B-)

-- mingo

--- linux/include/asm-i386/.stat.h.original Sat Aug 16 12:48:20 1997
+++ linux/include/asm-i386/stat.h Sat Aug 16 12:50:20 1997
@@ -38,4 +38,13 @@
unsigned long __unused5;
};

+#define STAT_PAD_ZERO(x) \
+ (x).__pad1 = 0; \
+ (x).__pad2 = 0; \
+ (x).__unused1 = 0; \
+ (x).__unused2 = 0; \
+ (x).__unused3 = 0; \
+ (x).__unused4 = 0; \
+ (x).__unused5 = 0;
+
#endif
--- linux/include/asm-alpha/.stat.h.original Sat Aug 16 12:54:21 1997
+++ linux/include/asm-alpha/stat.h Sat Aug 16 12:55:15 1997
@@ -37,4 +37,6 @@
unsigned int st_gen;
};

+#define STAT_PAD_ZERO(x) do { } while (0)
+
#endif
--- linux/fs/.stat.c.original Sat Aug 16 12:50:28 1997
+++ linux/fs/stat.c Sat Aug 16 12:53:28 1997
@@ -61,7 +61,13 @@
struct stat tmp;
unsigned int blocks, indirect;

+#if !defined(STAT_PAD_ZERO)
+# warning ** please implement this and remove this message
+# warning ** if you are the last remaining platform
memset(&tmp, 0, sizeof(tmp));
+#else
+ STAT_PAD_ZERO(tmp);
+#endif
tmp.st_dev = kdev_t_to_nr(inode->i_dev);
tmp.st_ino = inode->i_ino;
tmp.st_mode = inode->i_mode;