summaryrefslogtreecommitdiffstats
path: root/include/linux/ext3_fs.h
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2010-12-07 11:55:27 -0600
committerJan Kara <jack@suse.cz>2011-01-10 19:04:07 +0100
commita4ae3094869f18e26ece25ad175bbe4cd740e60b (patch)
treedea6bfdc5c0e3e34b2bd74cffae147220c4cc855 /include/linux/ext3_fs.h
parent40a063f6691ce937a3d00c9700b6964b5ec4e022 (diff)
ext3: speed up file creates by optimizing rec_len functions
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, thanks to page size limits. Similar changes already exist in the ext4 codebase. The directory entry checking can also be optimized a bit by sprinkling in some unlikely() conditions to move the error handling out of line. bonnie++ sequential file creates on a 512MB ramdisk speeds up from about 77,000/s to about 82,000/s, about a 6% improvement. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'include/linux/ext3_fs.h')
-rw-r--r--include/linux/ext3_fs.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index a443965946b..65990ef612f 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -724,21 +724,30 @@ struct ext3_dir_entry_2 {
~EXT3_DIR_ROUND)
#define EXT3_MAX_REC_LEN ((1<<16)-1)
+/*
+ * Tests against MAX_REC_LEN etc were put in place for 64k block
+ * sizes; if that is not possible on this arch, we can skip
+ * those tests and speed things up.
+ */
static inline unsigned ext3_rec_len_from_disk(__le16 dlen)
{
unsigned len = le16_to_cpu(dlen);
+#if (PAGE_CACHE_SIZE >= 65536)
if (len == EXT3_MAX_REC_LEN)
return 1 << 16;
+#endif
return len;
}
static inline __le16 ext3_rec_len_to_disk(unsigned len)
{
+#if (PAGE_CACHE_SIZE >= 65536)
if (len == (1 << 16))
return cpu_to_le16(EXT3_MAX_REC_LEN);
else if (len > (1 << 16))
BUG();
+#endif
return cpu_to_le16(len);
}