Skip to content

Commit

Permalink
erofs: refine managed inode stuffs
Browse files Browse the repository at this point in the history
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/[email protected]
Reviewed-by: Chao Yu <[email protected]>
Signed-off-by: Gao Xiang <[email protected]>
  • Loading branch information
hsiangkao committed Mar 16, 2022
1 parent ab474fc commit 9f2731d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 6 additions & 2 deletions fs/erofs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,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)
Expand Down Expand Up @@ -565,8 +570,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;
}
Expand Down
7 changes: 3 additions & 4 deletions fs/erofs/zdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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;
Expand Down Expand Up @@ -1350,8 +1350,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;

Expand Down

0 comments on commit 9f2731d

Please sign in to comment.