[sheepdog] [PATCH] sheep: use available size for virtual node calculation
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Wed Aug 7 10:28:18 CEST 2013
f_bfree includes reserved space for filesystem. On the other hand,
f_bavail is the actually available size and 'df' also uses this value.
f_bavail looks more appropriate for virutal node calculation.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/md.c | 2 +-
sheep/store.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sheep/md.c b/sheep/md.c
index dc243fd..6934850 100644
--- a/sheep/md.c
+++ b/sheep/md.c
@@ -238,7 +238,7 @@ static uint64_t get_path_free_size(char *path, uint64_t *used)
sd_eprintf("get disk %s space failed %m", path);
return 0;
}
- size = (int64_t)fs.f_frsize * fs.f_bfree;
+ size = (int64_t)fs.f_frsize * fs.f_bavail;
if (!used)
goto out;
diff --git a/sheep/store.c b/sheep/store.c
index 6a773d1..4e218d8 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -318,7 +318,7 @@ int init_disk_space(const char *base_path)
ret = SD_RES_EIO;
goto out;
}
- sys->disk_space = (uint64_t)fs.f_frsize * fs.f_bfree;
+ sys->disk_space = (uint64_t)fs.f_frsize * fs.f_bavail;
}
ret = set_node_space(sys->disk_space);
--
1.8.1.3.566.gaa39828
More information about the sheepdog
mailing list