summaryrefslogtreecommitdiffstats
path: root/fs/erofs/zmap.c
diff options
context:
space:
mode:
authorGao Xiang <hsiangkao@linux.alibaba.com>2022-09-23 09:49:15 +0800
committerGao Xiang <hsiangkao@linux.alibaba.com>2022-09-26 23:55:43 +0800
commit5c2a64252c5dc4cfe78e5b2a531c118894e3d155 (patch)
tree356748bce348364c288493b9eeb9de8994b1a95e /fs/erofs/zmap.c
parentb15b2e307c3a1970d92da77a3ef57ee53d119d8e (diff)
downloadlinux-5c2a64252c5dc4cfe78e5b2a531c118894e3d155.tar.bz2
erofs: introduce partial-referenced pclusters
Due to deduplication for compressed data, pclusters can be partially referenced with their prefixes. Together with the user-space implementation, it enables EROFS variable-length global compressed data deduplication with rolling hash. Link: https://lore.kernel.org/r/20220923014915.4362-1-hsiangkao@linux.alibaba.com Reviewed-by: Yue Hu <huyue2@coolpad.com> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Diffstat (limited to 'fs/erofs/zmap.c')
-rw-r--r--fs/erofs/zmap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index d1723910251c..ccdddb755be8 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -163,6 +163,7 @@ struct z_erofs_maprecorder {
u16 delta[2];
erofs_blk_t pblk, compressedblks;
erofs_off_t nextpackoff;
+ bool partialref;
};
static int z_erofs_reload_indexes(struct z_erofs_maprecorder *m,
@@ -221,6 +222,8 @@ static int legacy_load_cluster_from_disk(struct z_erofs_maprecorder *m,
case Z_EROFS_VLE_CLUSTER_TYPE_PLAIN:
case Z_EROFS_VLE_CLUSTER_TYPE_HEAD1:
case Z_EROFS_VLE_CLUSTER_TYPE_HEAD2:
+ if (advise & Z_EROFS_VLE_DI_PARTIAL_REF)
+ m->partialref = true;
m->clusterofs = le16_to_cpu(di->di_clusterofs);
m->pblk = le32_to_cpu(di->di_u.blkaddr);
break;
@@ -684,7 +687,8 @@ static int z_erofs_do_map_blocks(struct inode *inode,
err = -EOPNOTSUPP;
goto unmap_out;
}
-
+ if (m.partialref)
+ map->m_flags |= EROFS_MAP_PARTIAL_REF;
map->m_llen = end - map->m_la;
if (flags & EROFS_GET_BLOCKS_FINDTAIL) {