diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 86536e9f019c..7c839f00bbd4 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -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 */ diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 9e53a5a00f8d..8149fd884352 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -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;