Skip to content

Commit 9f2731d

Browse files
committed
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 <chao@kernel.org> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
1 parent ab474fc commit 9f2731d

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

fs/erofs/super.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,11 @@ static int erofs_managed_cache_releasepage(struct page *page, gfp_t gfp_mask)
532532
return ret;
533533
}
534534

535+
/*
536+
* It will be called only on inode eviction. In case that there are still some
537+
* decompression requests in progress, wait with rescheduling for a bit here.
538+
* We could introduce an extra locking instead but it seems unnecessary.
539+
*/
535540
static void erofs_managed_cache_invalidatepage(struct page *page,
536541
unsigned int offset,
537542
unsigned int length)
@@ -565,8 +570,7 @@ static int erofs_init_managed_cache(struct super_block *sb)
565570
inode->i_size = OFFSET_MAX;
566571

567572
inode->i_mapping->a_ops = &managed_cache_aops;
568-
mapping_set_gfp_mask(inode->i_mapping,
569-
GFP_NOFS | __GFP_HIGHMEM | __GFP_MOVABLE);
573+
mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
570574
sbi->managed_cache = inode;
571575
return 0;
572576
}

fs/erofs/zdata.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,10 +1091,10 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,
10911091
static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl,
10921092
unsigned int nr,
10931093
struct page **pagepool,
1094-
struct address_space *mc,
1095-
gfp_t gfp)
1094+
struct address_space *mc)
10961095
{
10971096
const pgoff_t index = pcl->obj.index;
1097+
gfp_t gfp = mapping_gfp_mask(mc);
10981098
bool tocache = false;
10991099

11001100
struct address_space *mapping;
@@ -1350,8 +1350,7 @@ static void z_erofs_submit_queue(struct super_block *sb,
13501350
struct page *page;
13511351

13521352
page = pickup_page_for_submission(pcl, i++, pagepool,
1353-
MNGD_MAPPING(sbi),
1354-
GFP_NOFS);
1353+
MNGD_MAPPING(sbi));
13551354
if (!page)
13561355
continue;
13571356

0 commit comments

Comments
 (0)