From 2296fa4c8f7d50bbdad4e8a737e9da68aa105441 Mon Sep 17 00:00:00 2001 From: Gao Xiang Date: Fri, 11 Mar 2022 02:27:43 +0800 Subject: [PATCH] UPSTREAM: erofs: refine managed inode stuffs Set up the correct gfp mask and use it instead of hard coding. Also add comments about .invalidatepage() to show more details. Link: https://lore.kernel.org/r/20220310182743.102365-2-hsiangkao@linux.alibaba.com Reviewed-by: Chao Yu Signed-off-by: Gao Xiang Bug: 297961372 (cherry picked from commit 9f2731d6338a072b60ab1d9340847bde3306614b) Change-Id: I9331cb53a7a8ff0ae7bc00c2ef09cc70715cf162 Signed-off-by: Edward Wu --- fs/erofs/super.c | 8 ++++++-- fs/erofs/zdata.c | 7 +++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/fs/erofs/super.c b/fs/erofs/super.c index b84394da5ae5..306c34331fe6 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -582,6 +582,11 @@ static int erofs_managed_cache_releasepage(struct page *page, gfp_t gfp_mask) return ret; } +/* + * It will be called only on inode eviction. In case that there are still some + * decompression requests in progress, wait with rescheduling for a bit here. + * We could introduce an extra locking instead but it seems unnecessary. + */ static void erofs_managed_cache_invalidatepage(struct page *page, unsigned int offset, unsigned int length) @@ -615,8 +620,7 @@ static int erofs_init_managed_cache(struct super_block *sb) inode->i_size = OFFSET_MAX; inode->i_mapping->a_ops = &managed_cache_aops; - mapping_set_gfp_mask(inode->i_mapping, - GFP_NOFS | __GFP_HIGHMEM | __GFP_MOVABLE); + mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); sbi->managed_cache = inode; return 0; } diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 61e924151996..6a0ee43d68de 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1205,10 +1205,10 @@ static void z_erofs_decompressqueue_work(struct work_struct *work) static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl, unsigned int nr, struct page **pagepool, - struct address_space *mc, - gfp_t gfp) + struct address_space *mc) { const pgoff_t index = pcl->obj.index; + gfp_t gfp = mapping_gfp_mask(mc); bool tocache = false; struct address_space *mapping; @@ -1438,8 +1438,7 @@ static void z_erofs_submit_queue(struct super_block *sb, struct page *page; page = pickup_page_for_submission(pcl, i++, pagepool, - MNGD_MAPPING(sbi), - GFP_NOFS); + MNGD_MAPPING(sbi)); if (!page) continue;