-
Notifications
You must be signed in to change notification settings - Fork 44
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
mountinfo.Mounted: optimize by adding fast paths #20
Conversation
So, the method is not working for bind mounts, so I changed the commit to try comparing devices first, then falling back to mountinfo parsing. This way, if there is a proper (not bind) mount, we can skip parsing mountinfo. |
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.
Left some thoughts/comments
12490ee
to
fce2c1a
Compare
I have reworked it considerably, PTAL @tianon @thaJeztah @cpuguy83 |
2ebd59a
to
73fb47e
Compare
Looks like there's still a duplicate declaration for
|
Add two fast paths to avoid (slow) mountinfo parsing: 1. In case path does not exist, it is definitely NOT a mount point. 2. In case path's st.Dev differs from that of its parent, it is definitely a mount point. In all the other cases (including bind mounts, case of path="/", other errors from unix.Lstat) the code falls back to the old slow method of parsing mountinfo. Signed-off-by: Kir Kolyshkin <[email protected]>
Cross is failing;
Does it need the same trickery as we use for Lines 10 to 12 in fb9f8cf
Starting to wonder if it would be cleaner to have separate Makefiles in each module, and then call those targets from the main Makefile (also beginning to feel the pain of the submodules 😓 - do you think it causes more issues to have them in the same repository than to have to maintain two repositories?) |
Will fix
It will result in more code (same/similar |
OK we need |
2cb4baa
to
3654e7c
Compare
Separated out cross build to #23 |
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.
LGTM, thanks!
@cpuguy83 PTAL |
oh, and @tianon 🤗 |
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.
LGTM 😄
switch err { | ||
case unix.ENOENT: | ||
// Nonexistent path, so not a mount point. | ||
return false, nil |
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.
I had some concern that a "broken" FUSE mount might hit this case, but it returns ENOTCONN
. 👍
(Just including a note in case anyone else reading this has the same question/concern. 😅)
@cpuguy83 PTAL |
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.
LGTM
Add two fast paths to avoid (slow) mountinfo parsing:
In case path does not exist, it is definitely NOT a mount point.
In case path's
st.Dev
differs from that of its parent, it isdefinitely a mount point.
In all the other cases (including bind mounts, case of
path="/"
, othererrors from
unix.Lstat
) the code falls back to the old slow methodof parsing mountinfo.