From 22ad2668b32bad075796cae98dfbeeb97347a5f4 Mon Sep 17 00:00:00 2001 From: Arseniy Lyashenko Date: Mon, 27 Feb 2023 19:32:55 +0300 Subject: [PATCH] Apply suggested changes --- client/storage-monitor/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/client/storage-monitor/src/lib.rs b/client/storage-monitor/src/lib.rs index 94c0cc14eb58b..277a74de08baf 100644 --- a/client/storage-monitor/src/lib.rs +++ b/client/storage-monitor/src/lib.rs @@ -17,7 +17,6 @@ // along with this program. If not, see . use clap::Args; -use fs4::statvfs; use sc_client_db::DatabaseSource; use sp_core::traits::SpawnEssentialNamed; use std::{ @@ -118,8 +117,7 @@ impl StorageMonitorService { /// Returns free space in MB, or error if statvfs failed. fn free_space(path: &Path) -> Result { - let amount = statvfs(path)?; - Ok(amount.available_space() / (1024 * 1024)) + Ok(fs4::available_space(path).map(|s| s / 1_000_000)?) } /// Checks if the amount of free space for given `path` is above given `threshold`.