aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2011-02-03 11:19:38 -0500
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2011-03-08 00:58:30 -0500
commitae191838b0251d73b9d0a7254c6938406f5f6320 (patch)
tree5f2b08f5ab421c3644a988acc5ec7a1c65a631bd /include
parent4138ec23820012009aecc2b02856c62872dd3c34 (diff)
nilfs2: optimize rec_len functions
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/nilfs2_fs.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index fdcd1bc7f61f..3a65e5aa2d76 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -326,17 +326,21 @@ static inline unsigned nilfs_rec_len_from_disk(__le16 dlen)
326{ 326{
327 unsigned len = le16_to_cpu(dlen); 327 unsigned len = le16_to_cpu(dlen);
328 328
329#if !defined(__KERNEL__) || (PAGE_CACHE_SIZE >= 65536)
329 if (len == NILFS_MAX_REC_LEN) 330 if (len == NILFS_MAX_REC_LEN)
330 return 1 << 16; 331 return 1 << 16;
332#endif
331 return len; 333 return len;
332} 334}
333 335
334static inline __le16 nilfs_rec_len_to_disk(unsigned len) 336static inline __le16 nilfs_rec_len_to_disk(unsigned len)
335{ 337{
338#if !defined(__KERNEL__) || (PAGE_CACHE_SIZE >= 65536)
336 if (len == (1 << 16)) 339 if (len == (1 << 16))
337 return cpu_to_le16(NILFS_MAX_REC_LEN); 340 return cpu_to_le16(NILFS_MAX_REC_LEN);
338 else if (len > (1 << 16)) 341 else if (len > (1 << 16))
339 BUG(); 342 BUG();
343#endif
340 return cpu_to_le16(len); 344 return cpu_to_le16(len);
341} 345}
342 346