Commit 9f2731d6 authored by Gao Xiang's avatar Gao Xiang

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.comReviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
parent ab474fcc
...@@ -532,6 +532,11 @@ static int erofs_managed_cache_releasepage(struct page *page, gfp_t gfp_mask) ...@@ -532,6 +532,11 @@ static int erofs_managed_cache_releasepage(struct page *page, gfp_t gfp_mask)
return ret; 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, static void erofs_managed_cache_invalidatepage(struct page *page,
unsigned int offset, unsigned int offset,
unsigned int length) unsigned int length)
...@@ -565,8 +570,7 @@ static int erofs_init_managed_cache(struct super_block *sb) ...@@ -565,8 +570,7 @@ static int erofs_init_managed_cache(struct super_block *sb)
inode->i_size = OFFSET_MAX; inode->i_size = OFFSET_MAX;
inode->i_mapping->a_ops = &managed_cache_aops; inode->i_mapping->a_ops = &managed_cache_aops;
mapping_set_gfp_mask(inode->i_mapping, mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
GFP_NOFS | __GFP_HIGHMEM | __GFP_MOVABLE);
sbi->managed_cache = inode; sbi->managed_cache = inode;
return 0; return 0;
} }
......
...@@ -1091,10 +1091,10 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io, ...@@ -1091,10 +1091,10 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,
static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl, static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl,
unsigned int nr, unsigned int nr,
struct page **pagepool, struct page **pagepool,
struct address_space *mc, struct address_space *mc)
gfp_t gfp)
{ {
const pgoff_t index = pcl->obj.index; const pgoff_t index = pcl->obj.index;
gfp_t gfp = mapping_gfp_mask(mc);
bool tocache = false; bool tocache = false;
struct address_space *mapping; struct address_space *mapping;
...@@ -1350,8 +1350,7 @@ static void z_erofs_submit_queue(struct super_block *sb, ...@@ -1350,8 +1350,7 @@ static void z_erofs_submit_queue(struct super_block *sb,
struct page *page; struct page *page;
page = pickup_page_for_submission(pcl, i++, pagepool, page = pickup_page_for_submission(pcl, i++, pagepool,
MNGD_MAPPING(sbi), MNGD_MAPPING(sbi));
GFP_NOFS);
if (!page) if (!page)
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment