Skip to contentSkip to conversation

erofs: enable large folios for iomap mode

PATCH In review Jingbo Xu 2 participants 3 messages Nov 30, 2022 – Dec 6, 2022 EROFS file system

lore
Share & tools
lore

Jingbo Xu

author
#0 lore raw

PATCH v2 1/1 erofs: enable large folios for iomap mode

Enable large folios for iomap mode. Then the readahead routine will pass down large folios containing multiple pages.

Let's enable this for non-compressed format for now, until the compression part supports large folios later.

When large folios supported, the iomap routine will allocate iomap_page for each large folio and thus we need iomap_release_folio() and iomap_invalidate_folio() to free iomap_page when these folios get recalimed or invalidated.

---
v2:
- add calling for iomap_release_folio() and iomap_invalidate_folio() to support large folios

v1: https://lore.kernel.org/all/[email protected]/

---
 fs/erofs/data.c  | 2 ++
 fs/erofs/inode.c | 2 ++
 2 files changed, 4 insertions(+)
fs/erofs/data.c +2 -0
index fe8ac0e163f7..c9526c627dda 100644
@@ -403,6 +403,8 @@ const struct address_space_operations erofs_raw_access_aops = {
 	.readahead = erofs_readahead,
 	.bmap = erofs_bmap,
 	.direct_IO = noop_direct_IO,
+	.release_folio = iomap_release_folio,
+	.invalidate_folio = iomap_invalidate_folio,
 };
 
 #ifdef CONFIG_FS_DAX
fs/erofs/inode.c +2 -0
index ad2a82f2eb4c..e457b8a59ee7 100644
@@ -295,6 +295,8 @@ static int erofs_fill_inode(struct inode *inode)
 		goto out_unlock;
 	}
 	inode->i_mapping->a_ops = &erofs_raw_access_aops;
+	if (!erofs_is_fscache_mode(inode->i_sb))
+		mapping_set_large_folios(inode->i_mapping);
 #ifdef CONFIG_EROFS_FS_ONDEMAND
 	if (erofs_is_fscache_mode(inode->i_sb))
 		inode->i_mapping->a_ops = &erofs_fscache_access_aops;
Signature · 1 line
2.19.1.6.gb485710b
author
#1 lore raw
Quoted 10 lines · Jingbo Xu

Enable large folios for iomap mode. Then the readahead routine will pass down large folios containing multiple pages.

Let's enable this for non-compressed format for now, until the compression part supports large folios later.

When large folios supported, the iomap routine will allocate iomap_page for each large folio and thus we need iomap_release_folio() and iomap_invalidate_folio() to free iomap_page when these folios get
recalimed or invalidated. ^

reclaimed

Signature · 2 lines
Thanks,
Jingbo
maintainer Reviewed-by on v2 1/1
#2 lore raw
In reply to Jingbo Xu
Quoted 6 lines · Jingbo Xu

Enable large folios for iomap mode. Then the readahead routine will pass down large folios containing multiple pages.

Let's enable this for non-compressed format for now, until the compression part supports large folios later.

Quoted 6 lines

When large folios supported, the iomap routine will allocate iomap_page for each large folio and thus we need iomap_release_folio() and iomap_invalidate_folio() to free iomap_page when these folios get recalimed or invalidated.

Thanks,