f2fs: add a new limit for reserve root

The reserved root blocks is not enough for booting Android due to
the limit of 0.2% if the fs size too small. so we add a new mini-
mum limit is 128MB.

Change-Id: I5af3b182001d27e4d18b4090c5270bbb2ac6253b
Signed-off-by: Cliff Chen <cliff.chen@rock-chips.com>
This commit is contained in:
Cliff Chen
2019-02-21 05:06:25 -05:00
committed by Tao Huang
parent b992ad3197
commit 3f399ec8bb
2 changed files with 4 additions and 1 deletions

View File

@@ -71,6 +71,8 @@ extern const char *f2fs_fault_name[FAULT_MAX];
#define IS_FAULT_SET(fi, type) ((fi)->inject_type & (1 << (type)))
#endif
#define MIN_ROOT_RESERVED_BLOCKS (128 * 1024 * 1024U)
/*
* For mount options
*/

View File

@@ -215,7 +215,8 @@ static inline void limit_reserve_root(struct f2fs_sb_info *sbi)
{
block_t limit = (sbi->user_block_count << 1) / 1000;
/* limit is 0.2% */
/* limit is 0.2%, and cannot be too small */
limit = max(limit, MIN_ROOT_RESERVED_BLOCKS);
if (test_opt(sbi, RESERVE_ROOT) &&
F2FS_OPTION(sbi).root_reserved_blocks > limit) {
F2FS_OPTION(sbi).root_reserved_blocks = limit;