Skip to content

Commit 2308de2

Browse files
Jiucheng XuJaegeuk Kim
authored andcommitted
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 <jiucheng.xu@amlogic.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent e438454 commit 2308de2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/f2fs/data.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3570,7 +3570,8 @@ static int f2fs_write_begin(const struct kiocb *iocb,
35703570
* Will wait that below with our IO control.
35713571
*/
35723572
folio = __filemap_get_folio(mapping, index,
3573-
FGP_LOCK | FGP_WRITE | FGP_CREAT, GFP_NOFS);
3573+
FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_NOFS,
3574+
mapping_gfp_mask(mapping));
35743575
if (IS_ERR(folio)) {
35753576
err = PTR_ERR(folio);
35763577
goto fail;

0 commit comments

Comments
 (0)