-
Notifications
You must be signed in to change notification settings - Fork 60
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
Align with the block size of overlayBD #352
Conversation
Rename `cfg` to `mkfs_cfg` to avoid confusion, as there is also a global `cfg` in liberofs. Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>
Currently, the error code returned by the earlier part of the extract_tar() may be overwritten by value of erofs_close_sbi(). This patch introduces `err2` to address this issue. Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>
@hsiangkao PLTAL |
src/overlaybd/tar/erofs/liberofs.cpp
Outdated
@@ -580,20 +580,27 @@ static int erofs_init_tar(struct erofs_tarfile *erofstar, | |||
static int erofs_write_map_file(photon::fs::IFile *fout, uint64_t blksz, FILE *fp) | |||
{ | |||
uint64_t blkaddr, toff; | |||
uint32_t nblocks; | |||
uint32_t nblocks, zeroedlen; | |||
char line[blksz]; |
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.
why blksz?
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. getline() is used to read a line instead of fgets().
src/overlaybd/tar/erofs/liberofs.cpp
Outdated
LSMT::RemoteMapping lba; | ||
|
||
cnt = sscanf(line, "%" PRIx64" %x %" PRIx64 "%u\n", &blkaddr, &nblocks, &toff, &zeroedlen); |
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.
maybe "%" PRIx64 "%x%" PRIx64 "%u"
is enough?
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.
LSMT::RemoteMapping lba; | ||
|
||
cnt = sscanf(line, "%" PRIx64" %x%" PRIx64 "%u", &blkaddr, &nblocks, &toff, &zeroedlen); | ||
|
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.
I think you also need to bail out if (cnt < 3)
and print some error messages.
if (cnt < 3) {
some messages here.
break;
}
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.
Yes, that's better. Done.
The inconsistency in the default block sizes between OverlayBD and EROFS can lead to issues during segment mapping. This patch aligns with the block size of overlaybd for mapping (i.e., OverlayBD's 512-byte size) to overcome this inconsistency. Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>
thanks |
int nwrite = fout->ioctl(LSMT::IFileRW::RemoteData, lba); | ||
if ((unsigned) nwrite != lba.count) { | ||
LOG_ERRNO_RETURN(0, -1, "failed to write lba"); | ||
} | ||
} | ||
free(line); |
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.
if (line)
free(line);
What this PR does / why we need it:
The inconsistency in the default block sizes between OverlayBD and EROFS can lead to issues during segment mapping. This patch aligns with the block size of overlaybd for mapping (i.e., OverlayBD's 512-byte size) to overcome this inconsistency.
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: