From: Johannes Thumshirn Date: Fri, 26 Mar 2021 15:34:37 +0000 (+0900) Subject: common/rc: don't rely on /proc/partitions for device size X-Git-Tag: v2022.05.01~485 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=939acb6507579b12c53bfd7f480e454d80a57d5f;p=xfstests-dev.git 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 Signed-off-by: Johannes Thumshirn Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- diff --git a/common/rc b/common/rc index 8e5282c1..23f86ce6 100644 --- a/common/rc +++ b/common/rc @@ -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.