summaryrefslogtreecommitdiffstats
path: root/extras/rebalance.py
diff options
context:
space:
mode:
authorKevin Vigor <kvigor@fb.com>2017-03-16 10:35:25 -0700
committerKevin Vigor <kvigor@fb.com>2017-03-16 10:35:25 -0700
commitae361e8339cc51966ebd222d7fb9046e936d56f5 (patch)
tree9c893ed88dc4086238e90e59c6ab37aee6cd308a /extras/rebalance.py
parent35cfc2853a617a8ee8ed499b6c989b5bed41b2b7 (diff)
parent68d5c0ef243a9f27939128d1d12d519167ad988a (diff)
Merge remote-tracking branch 'origin/release-3.8' into merge-3.8
Change-Id: Ib336c2ada491c2d2fcbbbe6865f9eb975a405b36
Diffstat (limited to 'extras/rebalance.py')
-rwxr-xr-xextras/rebalance.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/extras/rebalance.py b/extras/rebalance.py
index 80c614c5dfe..9579e5616ad 100755
--- a/extras/rebalance.py
+++ b/extras/rebalance.py
@@ -11,6 +11,7 @@ import subprocess
import sys
import tempfile
import volfilter
+import platform
# It's just more convenient to have named fields.
class Brick:
@@ -218,12 +219,19 @@ if __name__ == "__main__":
total = 0
for b in bricks:
info = os.statvfs(b.path)
+ # On FreeBSD f_bsize (info[0]) contains the optimal I/O size,
+ # not the block size as it's found on Linux. In this case we
+ # use f_frsize (info[1]).
+ if platform.system() == 'FreeBSD':
+ bsize = info[1]
+ else:
+ bsize = info[0]
# We want a standard unit even if different bricks use
# different block sizes. The size is chosen to avoid overflows
# for very large bricks with very small block sizes, but also
# accommodate filesystems which use very large block sizes to
# cheat on benchmarks.
- blocksper100mb = 104857600 / info[0]
+ blocksper100mb = 104857600 / bsize
if options.free_space:
size = info[3] / blocksper100mb
else: