fix the f2fs mount failed issue in low memory case
authorhuangzq2 <huangzq2@motorola.com>
Thu, 13 Jun 2019 06:34:20 +0000 (14:34 +0800)
committerlingsen1 <lingsen1@lenovo.com>
Sun, 7 Feb 2021 09:37:03 +0000 (17:37 +0800)
On the RACK test, the SDcard often mount failed becuase of the
page allocation failure. After checked with f2fs owner, we can
use kvzmalloc to alloc non-continuous memory in case continuous
memory allocation failed.

Change-Id: Ifd83e8b9a6bff241ed851007a3b7aec49b413eb3
Signed-off-by: huangzq2 <huangzq2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1370212
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Wei Deng <dengwei1@motorola.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key

fs/f2fs/node.c

index a4290c79fb246bffa85c6ded2421e3e97bc83a2c..6edd9eb211e396c27e1036ee94f72a4c3eebd813 100644 (file)
@@ -2776,7 +2776,7 @@ static int init_free_nid_cache(struct f2fs_sb_info *sbi)
        struct f2fs_nm_info *nm_i = NM_I(sbi);
        int i;
 
-       nm_i->free_nid_bitmap = f2fs_kzalloc(sbi, nm_i->nat_blocks *
+       nm_i->free_nid_bitmap = f2fs_kvzalloc(sbi, nm_i->nat_blocks *
                                sizeof(unsigned char *), GFP_KERNEL);
        if (!nm_i->free_nid_bitmap)
                return -ENOMEM;
@@ -2883,7 +2883,7 @@ void destroy_node_manager(struct f2fs_sb_info *sbi)
 
                for (i = 0; i < nm_i->nat_blocks; i++)
                        kvfree(nm_i->free_nid_bitmap[i]);
-               kfree(nm_i->free_nid_bitmap);
+               kvfree(nm_i->free_nid_bitmap);
        }
        kvfree(nm_i->free_nid_count);