From 2308de27c03d8ed75b28dab2354eb02c5f8e69be Mon Sep 17 00:00:00 2001 From: Jiucheng Xu Date: Fri, 10 Oct 2025 10:45:50 +0000 Subject: [PATCH] f2fs: Use mapping->gfp_mask to get file cache for writing On 32-bit architectures, when GFP_NOFS is used, the file cache for write operations cannot be allocated from the highmem and CMA. Since mapping->gfp_mask is set to GFP_HIGHUSER_MOVABLE during inode allocation, using mapping_gfp_mask(mapping) as the GFP flag of getting file cache for writing is more efficient for 32-bit architectures. Additionally, use FGP_NOFS to avoid potential deadlock issues caused by GFP_FS in GFP_HIGHUSER_MOVABLE Signed-off-by: Jiucheng Xu Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fs/f2fs/data.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 775aa4f63aa30..16a7130134274 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3570,7 +3570,8 @@ repeat: * Will wait that below with our IO control. */ folio = __filemap_get_folio(mapping, index, - FGP_LOCK | FGP_WRITE | FGP_CREAT, GFP_NOFS); + FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_NOFS, + mapping_gfp_mask(mapping)); if (IS_ERR(folio)) { err = PTR_ERR(folio); goto fail; -- 2.47.3