-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for tarerofs for TurboOCI #320
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments.
#include <photon/fs/fiemap.h> | ||
#include "../lsmt/file.h" | ||
#include "../lsmt/index.h" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be better to add
#define TAREROFS_BLOCK_SIZE 4096
#define __stringify(s) #s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/overlaybd/tar/tarerofs.cpp
Outdated
struct stat st; | ||
char buf[128*1024]; | ||
char base_path[64] = "/tmp/tarerofs_base_XXXXXX"; | ||
char command_line[256] = "mkfs.erofs --tar=0,upper.map,1073741824 --aufs"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
char command_line[256] = "mkfs.erofs --tar=0,upper.map,1073741824 -b" __stringify(TAREROFS_BLOCK_SIZE) " --aufs";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/overlaybd/tar/tarerofs.cpp
Outdated
} | ||
while (fscanf(fp, "%" PRIx64" %x %" PRIx64 "\n", &blkaddr, &nblocks, &toff) >= 3) { | ||
LSMT::RemoteMapping lba; | ||
lba.offset = blkaddr * 4096; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4096 -> TAREROFS_BLOCK_SIZE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/overlaybd/tar/tarerofs.cpp
Outdated
while (fscanf(fp, "%" PRIx64" %x %" PRIx64 "\n", &blkaddr, &nblocks, &toff) >= 3) { | ||
LSMT::RemoteMapping lba; | ||
lba.offset = blkaddr * 4096; | ||
lba.count = nblocks * 4096; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4096 -> TAREROFS_BLOCK_SIZE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/overlaybd/tar/tarerofs.cpp
Outdated
char buf[128*1024]; | ||
char base_path[64] = "/tmp/tarerofs_base_XXXXXX"; | ||
char command_line[256] = "mkfs.erofs --tar=0,upper.map,1073741824 --aufs"; | ||
char command_line2[] = " upper.erofs"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const char command_line2[] = " upper.erofs";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/overlaybd/tar/tarerofs.cpp
Outdated
} | ||
|
||
while ((read = file->read(buf, sizeof(buf))) > 0) { | ||
if (fwrite(buf, read, 1, fp) != 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to fix indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/overlaybd/tar/tarerofs.cpp
Outdated
std::strcat(command_line, " --base "); | ||
std::strcat(command_line, base_path); | ||
|
||
for (int i = 0; i < 800; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
800 here is quite hard-coded. But I'm not sure how we could detect the real written data in the first segment(extent) since we don't need the following LSMT::IFileRW::RemoteData
ranges.
b3e2cfc
to
4289d9b
Compare
Currently erofs-utils is integrated into overlaybd by using `mkfs.erofs` executable file. It's not optimial since raw data needs to be dumped first and output data needs to be write into overlaybd then. Later API integration may be a better form but it needs more work. Signed-off-by: Hongzhen Luo <hongzhen.lhz@linux.alibaba.com>
thanks @hsiangkao |
What this PR does / why we need it:
Currently erofs-utils is integrated into overlaybd by using
mkfs.erofs
executable file. It's not optimial since raw data needs to be dumped first and output data needs to be write into overlaybd then.Later API integration may be a better form but it needs more work.
The corresponding accelerated-container-image PR:
containerd/accelerated-container-image#272
The corresponding erofs-utils for test can be found at:
git clone https://gitee.com/anolis/erofs-utils.git -b overlaybd-dev
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Please check the following list: