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

WIP: Improve performance #32

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ankon
Copy link

@ankon ankon commented Mar 12, 2024

I needed to use tmfs to extract about 150GiB of data from a time machine backup. While that worked, it was unbearably slow. Looking at the code there were a bunch of "low-hanging fruit".

I'll leave this as a draft for discussion, probably it would be good to clean this up a bit more and split the pure refactorings (such as using fs::path/std::string and the file renamings) from the more functional parts.

  • Use more consistent typing on the C++ side: paths are fs::path, strings are std::string
  • Implement FUSE open/release and avoid opening/closing the file for each read call (as well as the expensive get_real_path!)
  • Implement FUS opendir/releasedir
  • Reduce the number of directories that need to be lstat-ed when using readdir by remembering the real path of the root.

* Use more consistent typing on the C++ side: paths are fs::path, strings are std::string
* Implement FUSE open/release and avoid opening/closing the file for each read call (as well
  as the expensive get_real_path!)
* Implement FUS opendir/releasedir
* Reduce the number of directories that need to be lstat-ed when using readdir by remembering
  the real path of the root.
@ankon
Copy link
Author

ankon commented Mar 12, 2024

Also: Thanks for this tool! I was a bit concerned how to unfurl my backup (old long-gone computer!)

{
// get the real path
std::string real_path = get_real_path(path);

// open the file
int fd = open(real_path.c_str(), O_RDONLY);
int fd = open(real_path.c_str(), fi->flags);
Copy link
Author

Choose a reason for hiding this comment

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

Reading through this, original code was better I think and more explicit:

Suggested change
int fd = open(real_path.c_str(), fi->flags);
int fd = open(real_path.c_str(), O_RDONLY);

@abique
Copy link
Owner

abique commented Mar 12, 2024

Hi,
I don't have test data at hand, when you feel like your PR is ready and tested I'll merge it.
Thanks 👍

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