f2fs: more reasonable mem_size calculating of ino_entry
authorKinglong Mee <kinglongmee@gmail.com>
Sat, 18 Mar 2017 01:26:13 +0000 (09:26 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 22 Mar 2017 02:34:37 +0000 (22:34 -0400)
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/node.c

index 3bfffd7..b52c9c0 100644 (file)
@@ -63,8 +63,9 @@ bool available_free_memory(struct f2fs_sb_info *sbi, int type)
                int i;
 
                for (i = 0; i <= UPDATE_INO; i++)
-                       mem_size += (sbi->im[i].ino_num *
-                               sizeof(struct ino_entry)) >> PAGE_SHIFT;
+                       mem_size += sbi->im[i].ino_num *
+                                               sizeof(struct ino_entry);
+               mem_size >>= PAGE_SHIFT;
                res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1);
        } else if (type == EXTENT_CACHE) {
                mem_size = (atomic_read(&sbi->total_ext_tree) *