Skip to content
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

Merged
merged 3 commits into from
Nov 13, 2024
Merged

Conversation

salvete
Copy link
Contributor

@salvete salvete commented Nov 12, 2024

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:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

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>
@BigVan
Copy link
Member

BigVan commented Nov 12, 2024

@hsiangkao PLTAL

@@ -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];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why blksz?

Copy link
Contributor Author

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().

LSMT::RemoteMapping lba;

cnt = sscanf(line, "%" PRIx64" %x %" PRIx64 "%u\n", &blkaddr, &nblocks, &toff, &zeroedlen);
Copy link
Contributor

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?

Copy link
Contributor Author

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);

Copy link
Contributor

@hsiangkao hsiangkao Nov 13, 2024

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;
}

Copy link
Contributor Author

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>
@BigVan
Copy link
Member

BigVan commented Nov 13, 2024

thanks

@BigVan BigVan merged commit 2fed67e into containerd:main Nov 13, 2024
2 checks passed
int nwrite = fout->ioctl(LSMT::IFileRW::RemoteData, lba);
if ((unsigned) nwrite != lba.count) {
LOG_ERRNO_RETURN(0, -1, "failed to write lba");
}
}
free(line);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (line)
free(line);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants