-
Notifications
You must be signed in to change notification settings - Fork 58
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
[EROFS] Align with the block size of overlayBD #351
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -580,20 +580,29 @@ 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]; | ||
int cnt; | ||
|
||
if (fp == NULL) { | ||
LOG_ERROR("unable to get upper.map, ignored"); | ||
return -1; | ||
} | ||
rewind(fp); | ||
while (fscanf(fp, "%" PRIx64" %x %" PRIx64 "\n", &blkaddr, &nblocks, &toff) | ||
>= 3) | ||
{ | ||
|
||
while (fgets(line, sizeof(line), fp)) { | ||
LSMT::RemoteMapping lba; | ||
|
||
cnt = sscanf(line, "%" PRIx64" %x %" PRIx64 "%08u\n", &blkaddr, &nblocks, &toff, &zeroedlen); | ||
if (!(cnt == 3 || cnt == 4)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should ignore if cnt > 4 (e.g. more hints which we don't care) |
||
LOG_ERRNO_RETURN(0, -1, "fail to read block list"); | ||
|
||
lba.offset = blkaddr * blksz; | ||
lba.count = nblocks * blksz; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lba.count = nblocks * blksz - round_down_blk(zeroedlen); ? Are you sure that is round_up_blk? |
||
lba.roffset = toff; | ||
if (cnt > 3) | ||
lba.count = round_up_blk(lba.count - zeroedlen); | ||
|
||
int nwrite = fout->ioctl(LSMT::IFileRW::RemoteData, lba); | ||
if ((unsigned) nwrite != lba.count) { | ||
LOG_ERRNO_RETURN(0, -1, "failed to write lba"); | ||
|
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.
zeroedlen = 0?