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

squashfs: factor read only OpenFile into Open method on directory entry #204

Merged
merged 1 commit into from
Dec 24, 2023

Conversation

ncw
Copy link
Contributor

@ncw ncw commented Dec 23, 2023

This enables us to open the file directly from the directory listing which saves doing another directory traversal to find it again.

This uses a simple Open method modeled on the one in the zip archive File.Open

When extracting all the entries from the archive this makes a significant performance improvement as re-reading all the directory entries from the root is quite expensive.

This enables us to open the file directly from the directory listing
which saves doing another directory traversal to find it again.
// Calling this Open method is more efficient than calling
// FileSystem.OpenFile as it doesn't have to find the file by
// traversing the directory entries first.
func (d *directoryEntry) Open() (filesystem.File, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was going to ask, why not have the mode arg here... and then realized, "we are talking about a read-only filesystem, so no point to it." Looks good.

@deitch deitch merged commit d76777b into diskfs:master Dec 24, 2023
19 checks passed
@ncw ncw deleted the fix-open-method branch December 27, 2023 18:16
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