Re: [PATCH v2] fstests: don't relay on /proc/partitions for device size

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On 26/03/2021 08:46, Damien Le Moal wrote:
> On 2021/03/26 16:39, Johannes Thumshirn wrote:
>> 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 blockdev --getsz to get the block device size.
>>
>> Cc: Naohiro Aota <naohiro.aota@xxxxxxx>
>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
>>
>> ---
>> Changes to v1:
>> - Use blockdev --getsz instead of sysfs (Nikolay/Damien)
>> ---
>>  common/rc | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/common/rc b/common/rc
>> index 1c814b9aabf1..40a9bfac31da 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}'
>> +	blockdev --getsz $1
> 
> That is 512B sectors unit... This should be KB, no ?
>

Right...

Should be 'echo $(($(blockdev --getsz $1) >> 1))'




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux