]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
nilfs2: optimize rec_len functions
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Thu, 3 Feb 2011 16:19:38 +0000 (01:19 +0900)
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Tue, 8 Mar 2011 05:58:30 +0000 (14:58 +0900)
This is a similar change to those in ext2/ext3 codebase (commit
40a063f6691ce937 and a4ae3094869f18e2, respectively).

The addition of 64k block capability in the rec_len_from_disk and
rec_len_to_disk functions added a bit of math overhead which slows
down file create workloads needlessly when the architecture cannot
even support 64k blocks.  This will cut the corner.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
fs/nilfs2/ioctl.c
include/linux/nilfs2_fs.h

index d89173edd7fed24f1e37ddac61cba678705b25b9..5471eed5eccb1e8e0c4f78ed3f410cc923f916f2 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/vmalloc.h>
 #include <linux/compat.h>      /* compat_ptr() */
 #include <linux/mount.h>       /* mnt_want_write(), mnt_drop_write() */
+#include <linux/buffer_head.h>
 #include <linux/nilfs2_fs.h>
 #include "nilfs.h"
 #include "segment.h"
index fdcd1bc7f61fec506e4aa4abf3ebe308869b577e..3a65e5aa2d765770e4c33a6613f56a19ce3a5666 100644 (file)
@@ -326,17 +326,21 @@ static inline unsigned nilfs_rec_len_from_disk(__le16 dlen)
 {
        unsigned len = le16_to_cpu(dlen);
 
+#if !defined(__KERNEL__) || (PAGE_CACHE_SIZE >= 65536)
        if (len == NILFS_MAX_REC_LEN)
                return 1 << 16;
+#endif
        return len;
 }
 
 static inline __le16 nilfs_rec_len_to_disk(unsigned len)
 {
+#if !defined(__KERNEL__) || (PAGE_CACHE_SIZE >= 65536)
        if (len == (1 << 16))
                return cpu_to_le16(NILFS_MAX_REC_LEN);
        else if (len > (1 << 16))
                BUG();
+#endif
        return cpu_to_le16(len);
 }