Non-partitionable devices, like zoned block devices, aren't showing up in in
/proc/partitions and therefore we cannot relay on it to get a device's
size.

Use sysfs' size attribute to get the block device size.

Cc: Naohiro Aota <naohiro.a...@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumsh...@wdc.com>
---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/rc b/common/rc
index 1c814b9aabf1..c99fff824087 100644
--- a/common/rc
+++ b/common/rc
@@ -3778,7 +3778,7 @@ _get_available_space()
 # return device size in kb
 _get_device_size()
 {
-       grep -w `_short_dev $1` /proc/partitions | awk '{print $3}'
+       echo $(($(cat /sys/block/`_short_dev $1`/size) >> 1))
 }
 
 # Make sure we actually have dmesg checking set up.
-- 
2.30.0

Reply via email to