Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

f2fs: remove unreachable code in f2fs_encrypt_one_page()

Since commit 52e7e0d88933 ("fscrypt: Switch to sync_skcipher and
on-stack requests") eliminated the dynamic allocation of crypto
requests, the only remaining dynamic memory allocation done by
fscrypt_encrypt_pagecache_blocks() is the bounce page allocation.

The bounce page is allocated from a mempool. Mempool allocations with
GFP_NOFS never fail. Therefore, fscrypt_encrypt_pagecache_blocks() can
no longer return -ENOMEM when passed GFP_NOFS.

Remove the now-unreachable code from f2fs_encrypt_one_page().

Suggested-by: Vlastimil Babka <vbabka@suse.cz>
Link: https://lore.kernel.org/all/d9dc2ee1-283d-4467-ad36-a6a4aa557589@suse.cz/
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

authored by

Eric Biggers and committed by
Jaegeuk Kim
d69ee59d e3c33bc7

+2 -12
+2 -12
fs/f2fs/data.c
··· 2787 2787 struct inode *inode = fio_inode(fio); 2788 2788 struct folio *mfolio; 2789 2789 struct page *page; 2790 - gfp_t gfp_flags = GFP_NOFS; 2791 2790 2792 2791 if (!f2fs_encrypted_file(inode)) 2793 2792 return 0; ··· 2796 2797 if (fscrypt_inode_uses_inline_crypto(inode)) 2797 2798 return 0; 2798 2799 2799 - retry_encrypt: 2800 2800 fio->encrypted_page = fscrypt_encrypt_pagecache_blocks(page_folio(page), 2801 - PAGE_SIZE, 0, gfp_flags); 2802 - if (IS_ERR(fio->encrypted_page)) { 2803 - /* flush pending IOs and wait for a while in the ENOMEM case */ 2804 - if (PTR_ERR(fio->encrypted_page) == -ENOMEM) { 2805 - f2fs_flush_merged_writes(fio->sbi); 2806 - memalloc_retry_wait(GFP_NOFS); 2807 - gfp_flags |= __GFP_NOFAIL; 2808 - goto retry_encrypt; 2809 - } 2801 + PAGE_SIZE, 0, GFP_NOFS); 2802 + if (IS_ERR(fio->encrypted_page)) 2810 2803 return PTR_ERR(fio->encrypted_page); 2811 - } 2812 2804 2813 2805 mfolio = filemap_lock_folio(META_MAPPING(fio->sbi), fio->old_blkaddr); 2814 2806 if (!IS_ERR(mfolio)) {