Skip to content

Commit

Permalink
Merge pull request #333 from salvete/erofs-io-incremental
Browse files Browse the repository at this point in the history
Fix EROFS support of TurboOCI-apply
  • Loading branch information
BigVan authored Jun 27, 2024
2 parents 6c1bf35 + f3e0d75 commit 1b5d2d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/overlaybd/tar/erofs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include(FetchContent)
FetchContent_Declare(
erofs-utils
GIT_REPOSITORY https://gitee.com/anolis/erofs-utils.git
GIT_TAG overlaybd-dev-2
GIT_TAG overlaybd-dev-3
)

FetchContent_MakeAvailable(erofs-utils)
Expand All @@ -13,7 +13,7 @@ execute_process(
WORKING_DIRECTORY ${erofs-utils_SOURCE_DIR}
)
execute_process(
COMMAND ./configure --disable-lz4 --without-liblzma --without-libzstd
COMMAND ./configure --disable-lz4 --without-liblzma --without-libzstd --without-uuid
WORKING_DIRECTORY ${erofs-utils_SOURCE_DIR}
)
execute_process(
Expand All @@ -37,7 +37,5 @@ target_include_directories(erofs_lib PRIVATE
${EROFS_LIB_INCLUDE_DIR}
)

target_link_libraries(erofs_lib PRIVATE uuid)

target_compile_options(erofs_lib PRIVATE "-include${EROFS_CONFIG_FILE}")
target_link_libraries(erofs_lib PRIVATE ${EROFS_LIB_STATIC})
14 changes: 5 additions & 9 deletions src/overlaybd/tar/erofs/liberofs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "erofs/cache.h"
#include "erofs/block_list.h"
#include "erofs/inode.h"
#include "erofs/config.h"
#include "../../lsmt/file.h"
#include "../../lsmt/index.h"
#include <photon/common/alog.h>
Expand Down Expand Up @@ -449,7 +450,6 @@ int erofs_mkfs(struct erofs_mkfs_cfg *cfg)
err = PTR_ERR(sb_bh);
goto exit;
}
//erofs_uuid_generate(sbi->uuid);
} else {
err = erofs_read_superblock(sbi);
if (err) {
Expand All @@ -475,7 +475,7 @@ int erofs_mkfs(struct erofs_mkfs_cfg *cfg)
goto exit;
}

err = erofs_rebuild_dump_tree(root, cfg->incremental, cfg->ovlfs_strip);
err = erofs_rebuild_dump_tree(root, cfg->incremental);
if (err < 0) {
LOG_ERROR("[erofs] Fail to dump tree.");
goto exit;
Expand Down Expand Up @@ -514,14 +514,8 @@ static int erofs_init_sbi(struct erofs_sb_info *sbi, photon::fs::IFile *fout,
struct erofs_vfops *ops, int blkbits)
{
int err;
struct timeval t;

sbi->blkszbits = (char)blkbits;
err = gettimeofday(&t, NULL);
if (err)
return err;
sbi->build_time = t.tv_sec;
sbi->build_time_nsec = t.tv_usec;
sbi->bdev.ops = ops;
fout->lseek(0, 0);
sbi->devsz = INT64_MAX;
Expand Down Expand Up @@ -614,6 +608,7 @@ int LibErofs::extract_tar(photon::fs::IFile *source, bool meta_only, bool first_
struct erofs_sb_info sbi = {};
struct erofs_tarfile erofstar = {};
struct erofs_mkfs_cfg cfg;
struct erofs_configure *erofs_cfg;
int err;

_target = target;
Expand Down Expand Up @@ -657,7 +652,8 @@ int LibErofs::extract_tar(photon::fs::IFile *source, bool meta_only, bool first_
cfg.sbi = &sbi;
cfg.erofstar = &erofstar;
cfg.incremental = !first_layer;
cfg.ovlfs_strip = true;
erofs_cfg = erofs_get_configure();
erofs_cfg->c_ovlfs_strip = true;

err = erofs_mkfs(&cfg);
if (err) {
Expand Down

0 comments on commit 1b5d2d8

Please sign in to comment.