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

[EROFS]: cleanup and introduce prefetch feature #344

Merged
merged 2 commits into from
Aug 21, 2024
Merged

Conversation

salvete
Copy link
Contributor

@salvete salvete commented Aug 11, 2024

What this PR does / why we need it:

  1. Remove the global variables _target and _source, and introduce struct liberofs_file to wrap the source and target files.
  2. Introduce prefetch feature.

The corresponding accelerated-container-image PR:
containerd/accelerated-container-image#299

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?

Remove the global variables `_target` and `_source`, and introduce
`struct liberofs_file` to wrap the source and target files.

Signed-off-by: Hongzhen Luo <[email protected]>
@salvete salvete changed the title [EROFS]: cleanup: get rid of the global static variables in liberofs.cpp [EROFS]: cleanup and introduce prefetch feature Aug 13, 2024
@salvete salvete force-pushed the main branch 2 times, most recently from e33fb96 to 102aba0 Compare August 14, 2024 03:14
@@ -493,7 +499,11 @@ class DynamicPrefetcher : public PrefetcherImpl {
}

virtual int replay(const IFile *imagefile) override {

if (is_erofs_fs(imagefile))
Copy link
Member

Choose a reason for hiding this comment

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

unnecessary spaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unnecessary spaces?

done.

@@ -78,3 +79,13 @@ photon::fs::IFileSystem *create_ext4fs(photon::fs::IFile *imgfile, bool mkfs,
}
return target;
}

bool is_erofs_fs(const photon::fs::IFile *imgfile)
{
Copy link
Member

Choose a reason for hiding this comment

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

shall we check if imgfile == nullptr?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shall we check if imgfile == nullptr?

done.

To support dynamic prefetching, EROFS provides the following
interfaces:
	- ErofsFileSystem:
		- open
		- stat
		- opendir
	- ErofsFile:
		- fstat
		- fiemap
	- ErofsDir:
		- get
		- next
		- closedir
		- rewinddir
		- seekdir
		- telldir

Signed-off-by: Hongzhen Luo <[email protected]>
@BigVan
Copy link
Member

BigVan commented Aug 21, 2024

thanks

@BigVan BigVan merged commit a117098 into containerd:main Aug 21, 2024
2 checks passed
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.

2 participants