-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix FileSize to return correct disk usage recursively #5384
Conversation
e631ed3
to
53bfa6d
Compare
53bfa6d
to
16d07d3
Compare
b73c93b
to
50f07d9
Compare
50f07d9
to
834a614
Compare
I think this should be correct now. On my miner all the before
after
(both before and after keep 2 sectors in the sealing directory) |
return err | ||
} | ||
if !info.IsDir() { | ||
stat := info.Sys().(*syscall.Stat_t) |
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.
Given that this is a _unix.go
file, I think we must always have a value in Sys()
, so I don't think we need to check for nil pointer here.
Closes #3124 |
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)
At the moment
FileSize
is not recursive and doesn't calculate correctly the disk usage of various paths.This PR is fixing it, by recursively walking the path and adding together all file sizes.
Ultimately this is fixing a bug in the
stores
package, where we iterate over all storage reservations and then check how much disk space is used per sector:sp
in this case has the form of./cache/s-t0127896-36
which is actually a directory with many.dat
files, and not a single file.TODO:
lotus-miner