-
Notifications
You must be signed in to change notification settings - Fork 169
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
Implement statfs with synthetic values #1118
Conversation
5708c16
to
89df80a
Compare
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.
Nice! Awesome to see this working.
There are a few comments inline.
Can you add some tests for this, just to verify these values make it out of the file system? I'd recommend creating a new file in mountpoint-s3/tests/fuse_tests/
named statfs_test.rs
, and write some tests that test end-to-end. statvfs
isn't actually in the Rust standard library, but we have some example of using a crate named nix
for querying this information.
mountpoint-s3/mountpoint-s3/src/data_cache/disk_data_cache.rs
Lines 308 to 321 in 9206ed4
CacheLimit::AvailableSpace { min_ratio } => { | |
let stats = match nix::sys::statvfs::statvfs(&self.cache_directory) { | |
Ok(stats) if stats.blocks() == 0 => { | |
warn!("unable to determine available space (0 blocks reported)"); | |
return false; | |
} | |
Ok(stats) => stats, | |
Err(error) => { | |
warn!(?error, "unable to determine available space"); | |
return false; | |
} | |
}; | |
(stats.blocks_free() as f64) < min_ratio * (stats.blocks() as f64) | |
} |
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.
@c-hagem The rebase appears to have included changes unrelated to this PR, can you fix?
Signed-off-by: Christian Hagemeier <[email protected]>
Signed-off-by: Christian Hagemeier <[email protected]>
Signed-off-by: Christian Hagemeier <[email protected]>
Signed-off-by: Christian Hagemeier <[email protected]>
Signed-off-by: Christian Hagemeier <[email protected]>
Signed-off-by: Christian Hagemeier <[email protected]>
Signed-off-by: Christian Hagemeier <[email protected]>
d7ffc96
to
dc019d5
Compare
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, ship it! 🎉
Released in Mountpoint v1.12.0! 🚀 |
Description of change
This PR adds support for calling
statfs
on virtual file system created using mountpoint.Some applications depend on the filesystem reporting non-zero available space; currently mountpoint reports 0 as number of available blocks, which can cause these applications to not work as expected.
This PR (building on #871) implements statfs with synthetic values (4611686018427387904 free blocks).
For example, the DF output now is:
Thus, checks for available space should no longer fail.
Relevant issues: #710.
Does this change impact existing behavior?
This change impacts existing behaviour, as Mountpoint will report non-zero value for total blocks, free blocks, free inodes and maximum file name length.
Does this change need a changelog entry?
Yes, addressed.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).