fs/erofs: Introduce new features including ztailpacking, fragments and dedupe
This patch updates erofs driver code to catch up with the latest code of
erofs_utils (commit e4939f9eaa177e05d697ace85d8dc283e25dc2ed).
LZMA will be supported in the separate patch later.
Signed-off-by: Yifan Zhao <zhaoyifan@sjtu.edu.cn>
Reviewed-by: Huang Jianan <jnhuang95@gmail.com>
diff --git a/fs/erofs/fs.c b/fs/erofs/fs.c
index 8926975..7bd2e8f 100644
--- a/fs/erofs/fs.c
+++ b/fs/erofs/fs.c
@@ -25,8 +25,8 @@
int erofs_blk_read(void *buf, erofs_blk_t start, u32 nblocks)
{
- return erofs_dev_read(0, buf, blknr_to_addr(start),
- blknr_to_addr(nblocks));
+ return erofs_dev_read(0, buf, erofs_pos(start),
+ erofs_pos(nblocks));
}
int erofs_probe(struct blk_desc *fs_dev_desc,
@@ -52,7 +52,7 @@
struct fs_dirent dirent;
struct erofs_inode inode;
- char dblk[EROFS_BLKSIZ];
+ char dblk[EROFS_MAX_BLOCK_SIZE];
unsigned int maxsize, de_end;
erofs_off_t pos;
};
@@ -125,7 +125,7 @@
return 1;
if (!dirs->maxsize) {
- dirs->maxsize = min_t(unsigned int, EROFS_BLKSIZ,
+ dirs->maxsize = min_t(unsigned int, EROFS_MAX_BLOCK_SIZE,
dirs->inode.i_size - pos);
err = erofs_pread(&dirs->inode, dirs->dblk,
@@ -136,7 +136,7 @@
de = (struct erofs_dirent *)dirs->dblk;
dirs->de_end = le16_to_cpu(de->nameoff);
if (dirs->de_end < sizeof(struct erofs_dirent) ||
- dirs->de_end >= EROFS_BLKSIZ) {
+ dirs->de_end >= EROFS_MAX_BLOCK_SIZE) {
erofs_err("invalid de[0].nameoff %u @ nid %llu",
dirs->de_end, de->nid | 0ULL);
return -EFSCORRUPTED;
@@ -183,7 +183,7 @@
pos += sizeof(*de);
if (erofs_blkoff(pos) >= dirs->de_end) {
- pos = blknr_to_addr(erofs_blknr(pos) + 1);
+ pos = erofs_pos(erofs_blknr(pos) + 1);
dirs->maxsize = 0;
}
dirs->pos = pos;