diff options
author | Yue Hu <huyue2@coolpad.com> | 2022-09-23 10:11:22 +0800 |
---|---|---|
committer | Gao Xiang <hsiangkao@linux.alibaba.com> | 2022-09-26 23:55:39 +0800 |
commit | b15b2e307c3a1970d92da77a3ef57ee53d119d8e (patch) | |
tree | e2fdea78f65addf0eb8af1abc4f3746897eddee1 /fs/erofs/super.c | |
parent | fdffc091e6f94602558bba712b51bc16f79fd6d5 (diff) | |
download | lwn-b15b2e307c3a1970d92da77a3ef57ee53d119d8e.tar.gz lwn-b15b2e307c3a1970d92da77a3ef57ee53d119d8e.zip |
erofs: support on-disk compressed fragments data
Introduce on-disk compressed fragments data feature.
This approach adds a new field called `h_fragmentoff' in the per-file
compression header to indicate the fragment offset of each tail pcluster
or the whole file in the special packed inode.
Similar to ztailpacking, it will also find and record the 'headlcn'
of the tail pcluster when initializing per-inode zmap for making
follow-on requests more easy.
Signed-off-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/YzHKxcFTlHGgXeH9@B-P7TQMD6M-0146.local
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Diffstat (limited to 'fs/erofs/super.c')
-rw-r--r-- | fs/erofs/super.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 9f7fe6c04e65..ce20562ca91f 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -381,6 +381,17 @@ static int erofs_read_superblock(struct super_block *sb) #endif sbi->islotbits = ilog2(sizeof(struct erofs_inode_compact)); sbi->root_nid = le16_to_cpu(dsb->root_nid); +#ifdef CONFIG_EROFS_FS_ZIP + sbi->packed_inode = NULL; + if (erofs_sb_has_fragments(sbi) && dsb->packed_nid) { + sbi->packed_inode = + erofs_iget(sb, le64_to_cpu(dsb->packed_nid), false); + if (IS_ERR(sbi->packed_inode)) { + ret = PTR_ERR(sbi->packed_inode); + goto out; + } + } +#endif sbi->inos = le64_to_cpu(dsb->inos); sbi->build_time = le64_to_cpu(dsb->build_time); @@ -411,6 +422,8 @@ static int erofs_read_superblock(struct super_block *sb) erofs_info(sb, "EXPERIMENTAL compressed inline data feature in use. Use at your own risk!"); if (erofs_is_fscache_mode(sb)) erofs_info(sb, "EXPERIMENTAL fscache-based on-demand read feature in use. Use at your own risk!"); + if (erofs_sb_has_fragments(sbi)) + erofs_info(sb, "EXPERIMENTAL compressed fragments feature in use. Use at your own risk!"); out: erofs_put_metabuf(&buf); return ret; @@ -947,6 +960,8 @@ static void erofs_put_super(struct super_block *sb) #ifdef CONFIG_EROFS_FS_ZIP iput(sbi->managed_cache); sbi->managed_cache = NULL; + iput(sbi->packed_inode); + sbi->packed_inode = NULL; #endif erofs_fscache_unregister_fs(sb); } |