Skip to content

Commit 0ee3a0d

Browse files
committed
erofs: enable sub-page compressed block support
Let's just disable cached decompression and inplace I/Os for partial pages as the first step in order to enable sub-page block initial support. In other words, currently it works primarily based on temporary short-lived pages. Don't expect too much in terms of performance. Reviewed-by: Yue Hu <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1ca0152 commit 0ee3a0d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

fs/erofs/inode.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,10 @@ static int erofs_fill_inode(struct inode *inode)
259259

260260
if (erofs_inode_is_data_compressed(vi->datalayout)) {
261261
#ifdef CONFIG_EROFS_FS_ZIP
262-
if (!erofs_is_fscache_mode(inode->i_sb) &&
263-
inode->i_sb->s_blocksize_bits == PAGE_SHIFT) {
262+
if (!erofs_is_fscache_mode(inode->i_sb)) {
263+
DO_ONCE_LITE_IF(inode->i_sb->s_blocksize != PAGE_SIZE,
264+
erofs_info, inode->i_sb,
265+
"EXPERIMENTAL EROFS subpage compressed block support in use. Use at your own risk!");
264266
inode->i_mapping->a_ops = &z_erofs_aops;
265267
err = 0;
266268
goto out_unlock;

fs/erofs/zdata.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,8 @@ static void z_erofs_bind_cache(struct z_erofs_decompress_frontend *fe)
563563
__GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN;
564564
unsigned int i;
565565

566+
if (i_blocksize(fe->inode) != PAGE_SIZE)
567+
return;
566568
if (fe->mode < Z_EROFS_PCLUSTER_FOLLOWED)
567569
return;
568570

@@ -967,12 +969,12 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
967969
struct inode *const inode = fe->inode;
968970
struct erofs_map_blocks *const map = &fe->map;
969971
const loff_t offset = page_offset(page);
972+
const unsigned int bs = i_blocksize(inode);
970973
bool tight = true, exclusive;
971974
unsigned int cur, end, len, split;
972975
int err = 0;
973976

974977
z_erofs_onlinepage_init(page);
975-
976978
split = 0;
977979
end = PAGE_SIZE;
978980
repeat:
@@ -1021,7 +1023,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
10211023
* for inplace I/O or bvpage (should be processed in a strict order.)
10221024
*/
10231025
tight &= (fe->mode > Z_EROFS_PCLUSTER_FOLLOWED_NOINPLACE);
1024-
exclusive = (!cur && ((split <= 1) || tight));
1026+
exclusive = (!cur && ((split <= 1) || (tight && bs == PAGE_SIZE)));
10251027
if (cur)
10261028
tight &= (fe->mode >= Z_EROFS_PCLUSTER_FOLLOWED);
10271029

0 commit comments

Comments
 (0)