From bbeec3c930766d26e582669d58879e5f88fc6f8b Mon Sep 17 00:00:00 2001 From: Gao Xiang Date: Tue, 16 Nov 2021 17:49:36 +0800 Subject: erofs-utils: mkfs: add extra blob device support In this patch, blob data from chunked-based files is redirected to another blob file. In order to achieve that, "--blobdev" should be used to specify the output blob file/device for all chunk-based files, e.g. mkfs.erofs --blobdev blob.erofs --chunksize 4096 foo.erofs foo Note that the upcoming RAFS v6 (EROFS-compatible on-disk format) [1] will make full use of EROFS multiple device feature together with Nydus [2] container image service. [1] https://sched.co/pcdL [2] https://github.com/dragonflyoss/image-service Link: https://lore.kernel.org/r/20211116094939.32246-4-hsiangkao@linux.alibaba.com Signed-off-by: Gao Xiang --- include/erofs/blobchunk.h | 3 ++- include/erofs/cache.h | 5 +++++ include/erofs/config.h | 1 + include/erofs/internal.h | 5 ++++- 4 files changed, 12 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/erofs/blobchunk.h b/include/erofs/blobchunk.h index b418227..59a4701 100644 --- a/include/erofs/blobchunk.h +++ b/include/erofs/blobchunk.h @@ -13,6 +13,7 @@ int erofs_blob_write_chunk_indexes(struct erofs_inode *inode, erofs_off_t off); int erofs_blob_write_chunked_file(struct erofs_inode *inode); int erofs_blob_remap(void); void erofs_blob_exit(void); -int erofs_blob_init(void); +int erofs_blob_init(const char *blobfile_path); +int erofs_generate_devtable(void); #endif diff --git a/include/erofs/cache.h b/include/erofs/cache.h index e324d92..b19d54e 100644 --- a/include/erofs/cache.h +++ b/include/erofs/cache.h @@ -19,6 +19,8 @@ struct erofs_buffer_block; #define INODE 2 /* shared xattrs */ #define XATTR 3 +/* device table */ +#define DEVT 4 struct erofs_bhops { bool (*preflush)(struct erofs_buffer_head *bh); @@ -56,6 +58,9 @@ static inline const int get_alignsize(int type, int *type_ret) } else if (type == XATTR) { *type_ret = META; return sizeof(struct erofs_xattr_entry); + } else if (type == DEVT) { + *type_ret = META; + return EROFS_DEVT_SLOT_SIZE; } if (type == META) diff --git a/include/erofs/config.h b/include/erofs/config.h index a18c883..8d459c6 100644 --- a/include/erofs/config.h +++ b/include/erofs/config.h @@ -51,6 +51,7 @@ struct erofs_configure { /* related arguments for mkfs.erofs */ char *c_img_path; char *c_src_path; + char *c_blobdev_path; char *c_compress_hints_file; char *c_compr_alg_master; int c_compr_level_master; diff --git a/include/erofs/internal.h b/include/erofs/internal.h index 974c069..f22a016 100644 --- a/include/erofs/internal.h +++ b/include/erofs/internal.h @@ -93,7 +93,10 @@ struct erofs_sb_info { u32 checksum; u16 extra_devices; - u16 device_id_mask; + union { + u16 devt_slotoff; /* used for mkfs */ + u16 device_id_mask; /* used for others */ + }; }; /* global sbi */ -- cgit v1.2.3