Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 22ad266

Browse files
committed
Apply suggested changes
1 parent ef70db1 commit 22ad266

File tree

1 file changed

+1
-3
lines changed
  • client/storage-monitor/src

1 file changed

+1
-3
lines changed

client/storage-monitor/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1818

1919
use clap::Args;
20-
use fs4::statvfs;
2120
use sc_client_db::DatabaseSource;
2221
use sp_core::traits::SpawnEssentialNamed;
2322
use std::{
@@ -118,8 +117,7 @@ impl StorageMonitorService {
118117

119118
/// Returns free space in MB, or error if statvfs failed.
120119
fn free_space(path: &Path) -> Result<u64, Error> {
121-
let amount = statvfs(path)?;
122-
Ok(amount.available_space() / (1024 * 1024))
120+
Ok(fs4::available_space(path).map(|s| s / 1_000_000)?)
123121
}
124122

125123
/// Checks if the amount of free space for given `path` is above given `threshold`.

0 commit comments

Comments
 (0)