Patch 1 is the main part of supporting large folio in fscache mode. It
relies on a pending patch[1] adding .prepare_ondemand_read() interface
in Cachefiles.
Patch 2 just turns the switch on and enables the feature. It enables large
folio for both fscache and the original device mode (in uncompressed
data format). And thus I think the previous patch[2] exclusively for the
device mode is not needed then.
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
Jingbo Xu (2):
erofs: support large folio in fscache mode
erofs: enable large folio support for non-compressed format
fs/erofs/fscache.c | 117 +++++++++++++++++++--------------------------
fs/erofs/inode.c | 1 +
2 files changed, 50 insertions(+), 68 deletions(-)
--
2.19.1.6.gb485710b
Enable large folio in both device and fscache mode. Then the readahead
routine will pass down large folio containing multiple pages.
Enable this feature for non-compressed format for now, until the
compression part supports large folio later.
Signed-off-by: Jingbo Xu <[email protected]>
---
fs/erofs/fscache.c | 1 +
fs/erofs/inode.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
index 0643b205c7eb..d2dd58ce312b 100644
--- a/fs/erofs/fscache.c
+++ b/fs/erofs/fscache.c
@@ -436,6 +436,7 @@ struct erofs_fscache *erofs_fscache_acquire_cookie(struct super_block *sb,
inode->i_size = OFFSET_MAX;
inode->i_mapping->a_ops = &erofs_fscache_meta_aops;
mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
+ mapping_set_large_folios(inode->i_mapping);
ctx->inode = inode;
}
diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index ad2a82f2eb4c..85932086d23f 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -295,6 +295,7 @@ static int erofs_fill_inode(struct inode *inode)
goto out_unlock;
}
inode->i_mapping->a_ops = &erofs_raw_access_aops;
+ 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;
--
2.19.1.6.gb485710b
Hi Jingbo,
On Sat, Nov 26, 2022 at 08:57:56AM +0800, Jingbo Xu wrote:
> Enable large folio in both device and fscache mode. Then the readahead
^ large folios in both iomap and fscache modes.
I tend to enable iomap/fscache large folios with two patches.
Also please see dev-test branch.
> routine will pass down large folio containing multiple pages.
>
> Enable this feature for non-compressed format for now, until the
> compression part supports large folio later.
^ large folios
>
> Signed-off-by: Jingbo Xu <[email protected]>
> ---
> fs/erofs/fscache.c | 1 +
> fs/erofs/inode.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
> index 0643b205c7eb..d2dd58ce312b 100644
> --- a/fs/erofs/fscache.c
> +++ b/fs/erofs/fscache.c
> @@ -436,6 +436,7 @@ struct erofs_fscache *erofs_fscache_acquire_cookie(struct super_block *sb,
> inode->i_size = OFFSET_MAX;
> inode->i_mapping->a_ops = &erofs_fscache_meta_aops;
> mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
> + mapping_set_large_folios(inode->i_mapping);
>
Meta inodes currently doesn't need large folios for now, and
we don't have readahead policy for these.
> ctx->inode = inode;
> }
> diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
> index ad2a82f2eb4c..85932086d23f 100644
> --- a/fs/erofs/inode.c
> +++ b/fs/erofs/inode.c
> @@ -295,6 +295,7 @@ static int erofs_fill_inode(struct inode *inode)
> goto out_unlock;
> }
> inode->i_mapping->a_ops = &erofs_raw_access_aops;
> + 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;
> --
> 2.19.1.6.gb485710b
>
On 11/26/22 10:16 AM, Gao Xiang wrote:
> Hi Jingbo,
>
> On Sat, Nov 26, 2022 at 08:57:56AM +0800, Jingbo Xu wrote:
>> Enable large folio in both device and fscache mode. Then the readahead
>
> ^ large folios in both iomap and fscache modes.
>
> I tend to enable iomap/fscache large folios with two patches.
> Also please see dev-test branch.
Got it.
>
>
>> routine will pass down large folio containing multiple pages.
>>
>> Enable this feature for non-compressed format for now, until the
>> compression part supports large folio later.
>
> ^ large folios
>
>>
>> Signed-off-by: Jingbo Xu <[email protected]>
>> ---
>> fs/erofs/fscache.c | 1 +
>> fs/erofs/inode.c | 1 +
>> 2 files changed, 2 insertions(+)
>>
>> diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
>> index 0643b205c7eb..d2dd58ce312b 100644
>> --- a/fs/erofs/fscache.c
>> +++ b/fs/erofs/fscache.c
>> @@ -436,6 +436,7 @@ struct erofs_fscache *erofs_fscache_acquire_cookie(struct super_block *sb,
>> inode->i_size = OFFSET_MAX;
>> inode->i_mapping->a_ops = &erofs_fscache_meta_aops;
>> mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
>> + mapping_set_large_folios(inode->i_mapping);
>>
>
> Meta inodes currently doesn't need large folios for now, and
> we don't have readahead policy for these.
Alright, I will fix this in a quick v2.
>
>> ctx->inode = inode;
>> }
>> diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
>> index ad2a82f2eb4c..85932086d23f 100644
>> --- a/fs/erofs/inode.c
>> +++ b/fs/erofs/inode.c
>> @@ -295,6 +295,7 @@ static int erofs_fill_inode(struct inode *inode)
>> goto out_unlock;
>> }
>> inode->i_mapping->a_ops = &erofs_raw_access_aops;
>> + 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;
>> --
>> 2.19.1.6.gb485710b
>>
--
Thanks,
Jingbo