erofs-utils: mkfs: support fragments deduplication
RFC PATCH 1/1 erofs-utils: mkfs: support fragments deduplication
From: Yue Hu <[email protected]>
Previously, there's no fragments deduplication when this feature is introduced. Let's support it now.
Suggested-by Gao Xiang <[email protected]>
Signed-off-by Yue Hu <[email protected]>
--- include/erofs/fragments.h | 3 +- lib/compress.c | 117 ++++++++++++++++++++---- lib/fragments.c | 188 +++++++++++++++++++++++++++++++++++++- lib/inode.c | 12 ++- 4 files changed, 299 insertions(+), 21 deletions(-)
include/erofs/fragments.h +2 -1
@@ -15,8 +15,9 @@ extern "C"extern const char *frags_packedname;#define EROFS_PACKED_INODE frags_packedname +int z_erofs_fragments_dedupe (struct erofs_inode *inode,int fd,u32 *crc);int z_erofs_pack_fragments (struct erofs_inode *inode,void *data, -unsigned int len); +unsigned int len,u32 crc);struct erofs_inode *erofs_mkfs_build_fragments (void );int erofs_fragments_init (void );void erofs_fragments_exit (void );
lib/compress.c +101 -16
209 lines not on this page · raw message
lib/fragments.c +187 -1
218 lines not on this page · raw message
lib/inode.c +9 -3
@@ -406,7 +406,7 @@ static int write_uncompressed_file_from_fd(struct erofs_inode *inode, int fd)return 0 ; } -int erofs_write_file (struct erofs_inode *inode) +static int erofs_write_file (struct erofs_inode *inode) {int ret, fd;
@@ -1196,7 +1196,10 @@ struct erofs_inode *erofs_mkfs_build_special_from_fd(int fd, const char *name)struct erofs_inode *inode;int ret; -lseek (fd,0 ,SEEK_SET ); + ret =lseek (fd,0 ,SEEK_SET ); +if (ret ==-1 ) +return ERR_PTR (-errno); + ret =fstat64 (fd, &st);if (ret)return ERR_PTR (-errno);
@@ -1223,7 +1226,10 @@ struct erofs_inode *erofs_mkfs_build_special_from_fd(int fd, const char *name) ret =erofs_write_compressed_file (inode, fd);if (ret == -ENOSPC ) { -lseek (fd,0 ,SEEK_SET ); + ret =lseek (fd,0 ,SEEK_SET ); +if (ret ==-1 ) +return ERR_PTR (-errno); + ret =write_uncompressed_file_from_fd (inode, fd); }
Signature · 1 line
2.17.1