aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunling Zheng <zhengjunling@huawei.com>2016-02-23 21:43:42 +0800
committerluca020400 <luca.stefani.ge1@gmail.com>2016-04-04 17:17:55 +0200
commit6802dff20097f556a70a96b12016eeacfe639b1e (patch)
tree1a42868c9be0fabdf99d471d3ec478bd287447ce
parent65ad52cb62ee1c797d0ffb613e6ccf04ec00e5a9 (diff)
downloadandroid_external_f2fs-tools-6802dff20097f556a70a96b12016eeacfe639b1e.tar.gz
android_external_f2fs-tools-6802dff20097f556a70a96b12016eeacfe639b1e.tar.bz2
android_external_f2fs-tools-6802dff20097f556a70a96b12016eeacfe639b1e.zip
f2fs-tools: redefine MAX_SIT_BITMAP_SIZE
During mkfs, segment_count_sit is calculated using ALIGN and SEG_ALIGN, which are both upward. Then, in some extreme scenarios, such as 16TB, sit_ver_bitmap_bytesize got from segment_count_sit will exceed MAX_SIT_BITMAP_SIZE, which is calculated in a downward method. Unify the two calculating methods and redefine MAX_SIT_BITMAP_SIZE to prevent sit_ver_bitmap_bytesize overflowing. Signed-off-by: Junling Zheng <zhengjunling@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--include/f2fs_fs.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 19e9859..8c7c4ce 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -667,7 +667,9 @@ struct f2fs_nat_block {
* disk is 16 TB and it equals to 16 * 1024 * 1024 / 2 segments.
*/
#define F2FS_MAX_SEGMENT ((16 * 1024 * 1024) / 2)
-#define MAX_SIT_BITMAP_SIZE ((F2FS_MAX_SEGMENT / SIT_ENTRY_PER_BLOCK) / 8)
+#define MAX_SIT_BITMAP_SIZE (SEG_ALIGN(ALIGN(F2FS_MAX_SEGMENT, \
+ SIT_ENTRY_PER_BLOCK)) * \
+ config.blks_per_seg / 8)
/*
* Note that f2fs_sit_entry->vblocks has the following bit-field information.