diff options
author | Chao Yu <chao2.yu@samsung.com> | 2015-12-31 14:35:37 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-01-03 21:40:04 -0800 |
commit | e0afc4d6d0d3e7e5a99f691bc64ae7c74bea790e (patch) | |
tree | 76cdea35b5c446a7b0137c1a4849f47d7d801e35 /fs/f2fs/super.c | |
parent | 3a9e6433a367211a172cb7b4d5b727c720bd0de0 (diff) | |
download | op-kernel-dev-e0afc4d6d0d3e7e5a99f691bc64ae7c74bea790e.zip op-kernel-dev-e0afc4d6d0d3e7e5a99f691bc64ae7c74bea790e.tar.gz |
f2fs: introduce max_file_blocks in sbi
Introduce max_file_blocks in sbi to store max block index of file in f2fs,
it could be used to avoid unneeded calculation of max block index in
runtime.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
[Jaegeuk Kim: fix overflow of sbi->max_file_blocks]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r-- | fs/f2fs/super.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index a2e3a8f..0bbd756 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -907,7 +907,7 @@ static const struct export_operations f2fs_export_ops = { .get_parent = f2fs_get_parent, }; -loff_t max_file_size(unsigned bits) +static loff_t max_file_blocks(void) { loff_t result = (DEF_ADDRS_PER_INODE - F2FS_INLINE_XATTR_ADDRS); loff_t leaf_count = ADDRS_PER_BLOCK; @@ -923,7 +923,6 @@ loff_t max_file_size(unsigned bits) leaf_count *= NIDS_PER_BLOCK; result += leaf_count; - result <<= bits; return result; } @@ -1278,7 +1277,9 @@ try_onemore: if (err) goto free_options; - sb->s_maxbytes = max_file_size(le32_to_cpu(raw_super->log_blocksize)); + sbi->max_file_blocks = max_file_blocks(); + sb->s_maxbytes = sbi->max_file_blocks << + le32_to_cpu(raw_super->log_blocksize); sb->s_max_links = F2FS_LINK_MAX; get_random_bytes(&sbi->s_next_generation, sizeof(u32)); |