fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Damien Le Moal <Damien.LeMoal@wdc.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	Eryu Guan <guan@eryu.me>
Cc: "fstests@vger.kernel.org" <fstests@vger.kernel.org>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	Nikolay Borisov <nborisov@suse.com>,
	Naohiro Aota <Naohiro.Aota@wdc.com>
Subject: Re: [PATCH v2] fstests: don't relay on /proc/partitions for device size
Date: Fri, 26 Mar 2021 07:46:12 +0000	[thread overview]
Message-ID: <CH2PR04MB6522F59F0B14B2E7A2410F13E7619@CH2PR04MB6522.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20210326073846.14520-1-johannes.thumshirn@wdc.com

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@wdc.com>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> 
> ---
> 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 ?

>  }
>  
>  # Make sure we actually have dmesg checking set up.
> 


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2021-03-26  7:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26  7:38 [PATCH v2] fstests: don't relay on /proc/partitions for device size Johannes Thumshirn
2021-03-26  7:46 ` Damien Le Moal [this message]
2021-03-26  7:49   ` Johannes Thumshirn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CH2PR04MB6522F59F0B14B2E7A2410F13E7619@CH2PR04MB6522.namprd04.prod.outlook.com \
    --to=damien.lemoal@wdc.com \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=Naohiro.Aota@wdc.com \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).