common/rc: don't rely on /proc/partitions for device size

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

Use blockdev --getsz to get the block device size.

Cc: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Johannes Thumshirn
2021-03-27 00:34:37 +09:00
committed by Eryu Guan
parent 175bb55960
commit 939acb6507
+1 -1
View File
@@ -3777,7 +3777,7 @@ _get_available_space()
# return device size in kb
_get_device_size()
{
grep -w `_short_dev $1` /proc/partitions | awk '{print $3}'
echo $(($(blockdev --getsz $1) >> 1))
}
# Make sure we actually have dmesg checking set up.