Skip to content

Commit

Permalink
[EROFS] Add support for xattr reservation of the base layser rootdir
Browse files Browse the repository at this point in the history
Set the minimum inline xattr size for the root directory of the base
layer, as there may not be enough room for xattr during the incremental
build process.

Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>
  • Loading branch information
salvete committed Jul 29, 2024
1 parent b5b704b commit f96fc76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion 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 git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git
GIT_TAG 617d708925b3c5d1dd132853e47d9d9f51443e6f
GIT_TAG 599036f802d65841500f69a1d383381765e94c5c
)

FetchContent_MakeAvailable(erofs-utils)
Expand Down
5 changes: 5 additions & 0 deletions src/overlaybd/tar/erofs/liberofs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define round_down_blk(addr) ((addr) & (~(SECTOR_SIZE - 1)))
#define round_up_blk(addr) (round_down_blk((addr) + SECTOR_SIZE - 1))
#define min(a, b) (a) < (b) ? (a) : (b)
#define EROFS_ROOT_ATTR_SIZE (16 * 1024)

#define EROFS_UNIMPLEMENTED 1

Expand Down Expand Up @@ -641,6 +642,10 @@ int LibErofs::extract_tar(photon::fs::IFile *source, bool meta_only, bool first_
cfg.incremental = !first_layer;
erofs_cfg = erofs_get_configure();
erofs_cfg->c_ovlfs_strip = true;
if (first_layer)
erofs_cfg->c_root_xattr_isize = EROFS_ROOT_ATTR_SIZE;
else
erofs_cfg->c_root_xattr_isize = 0;
cfg.mp_fp = std::tmpfile();

err = erofs_mkfs(&cfg);
Expand Down

0 comments on commit f96fc76

Please sign in to comment.