]> git.baikalelectronics.ru Git - kernel.git/commitdiff
f2fs: increase the limit for reserve_root
authorJaegeuk Kim <jaegeuk@kernel.org>
Tue, 23 Aug 2022 17:18:42 +0000 (10:18 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 11:22:17 +0000 (13:22 +0200)
commit dc72f8812aa6ad64ce3bfc3798bbee8eae07f4ce upstream.

This patch increases the threshold that limits the reserved root space from 0.2%
to 12.5% by using simple shift operation.

Typically Android sets 128MB, but if the storage capacity is 32GB, 0.2% which is
around 64MB becomes too small. Let's relax it.

Cc: stable@vger.kernel.org
Reported-by: Aran Dalton <arda@allwinnertech.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/f2fs/super.c

index 232c99e4a1ee9be2491ac5a3efd8621a4758f22f..3f2fe60346401911d0bc9b03cd22e065b2b8073b 100644 (file)
@@ -255,10 +255,10 @@ static int f2fs_sb_read_encoding(const struct f2fs_super_block *sb,
 
 static inline void limit_reserve_root(struct f2fs_sb_info *sbi)
 {
-       block_t limit = min((sbi->user_block_count << 1) / 1000,
+       block_t limit = min((sbi->user_block_count >> 3),
                        sbi->user_block_count - sbi->reserved_blocks);
 
-       /* limit is 0.2% */
+       /* limit is 12.5% */
        if (test_opt(sbi, RESERVE_ROOT) &&
                        F2FS_OPTION(sbi).root_reserved_blocks > limit) {
                F2FS_OPTION(sbi).root_reserved_blocks = limit;