diff options
author | Eric Sandeen <sandeen@redhat.com> | 2010-12-07 12:55:27 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2011-01-10 13:04:07 -0500 |
commit | a4ae3094869f18e26ece25ad175bbe4cd740e60b (patch) | |
tree | dea6bfdc5c0e3e34b2bd74cffae147220c4cc855 /include/linux/ext3_fs.h | |
parent | 40a063f6691ce937a3d00c9700b6964b5ec4e022 (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.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index a443965946bb..65990ef612f5 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -724,21 +724,30 @@ struct ext3_dir_entry_2 { | |||
724 | ~EXT3_DIR_ROUND) | 724 | ~EXT3_DIR_ROUND) |
725 | #define EXT3_MAX_REC_LEN ((1<<16)-1) | 725 | #define EXT3_MAX_REC_LEN ((1<<16)-1) |
726 | 726 | ||
727 | /* | ||
728 | * Tests against MAX_REC_LEN etc were put in place for 64k block | ||
729 | * sizes; if that is not possible on this arch, we can skip | ||
730 | * those tests and speed things up. | ||
731 | */ | ||
727 | static inline unsigned ext3_rec_len_from_disk(__le16 dlen) | 732 | static inline unsigned ext3_rec_len_from_disk(__le16 dlen) |
728 | { | 733 | { |
729 | unsigned len = le16_to_cpu(dlen); | 734 | unsigned len = le16_to_cpu(dlen); |
730 | 735 | ||
736 | #if (PAGE_CACHE_SIZE >= 65536) | ||
731 | if (len == EXT3_MAX_REC_LEN) | 737 | if (len == EXT3_MAX_REC_LEN) |
732 | return 1 << 16; | 738 | return 1 << 16; |
739 | #endif | ||
733 | return len; | 740 | return len; |
734 | } | 741 | } |
735 | 742 | ||
736 | static inline __le16 ext3_rec_len_to_disk(unsigned len) | 743 | static inline __le16 ext3_rec_len_to_disk(unsigned len) |
737 | { | 744 | { |
745 | #if (PAGE_CACHE_SIZE >= 65536) | ||
738 | if (len == (1 << 16)) | 746 | if (len == (1 << 16)) |
739 | return cpu_to_le16(EXT3_MAX_REC_LEN); | 747 | return cpu_to_le16(EXT3_MAX_REC_LEN); |
740 | else if (len > (1 << 16)) | 748 | else if (len > (1 << 16)) |
741 | BUG(); | 749 | BUG(); |
750 | #endif | ||
742 | return cpu_to_le16(len); | 751 | return cpu_to_le16(len); |
743 | } | 752 | } |
744 | 753 | ||