All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: fstests@vger.kernel.org,
	 "Martin K. Petersen" <martin.petersen@oracle.com>,
	Kanchan Joshi <joshi.k@samsung.com>,
	 Anuj Gupta <anuj20.g@samsung.com>,
	John Garry <john.g.garry@oracle.com>,
	 "Darrick J. Wong" <djwong@kernel.org>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2/6] common: factor out a _bdev_disk_name helper
Date: Sun, 13 Sep 2026 20:55:10 +0800	[thread overview]
Message-ID: <aqadFscVWs2U_mvr@zlang-mailbox> (raw)
In-Reply-To: <20260911070831.1760646-3-hch@lst.de>

On Fri, Sep 11, 2026 at 09:08:20AM +0200, Christoph Hellwig wrote:
> This will be reused to look for the integrity subdirectory soon.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
> ---

Good to me,

Reviewed-by: Zorro Lang <zlang@kernel.org>

>  common/rc | 27 +++++++++++++++++----------
>  1 file changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 8add0eedf942..2fa7ddebd8fd 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -5233,28 +5233,35 @@ _sysfs_dev()
>  	echo /sys/dev/block/$maj:$min
>  }
>  
> -# Get the sysfs queue path for a block device, handling partitions correctly.
> -_sysfs_queue_path()
> +#
> +# Get the name for the main disk block device given an arbitrary blockdevice
> +# /dev/ entry
> +#
> +_bdev_disk_name()
>  {
> -	local dev parent
> -	dev=$(_short_dev "$1")
> +	local dev=$(_short_dev "$1")
>  
>  	# For partitions, queue details are in the parent device's sysfs dir
>  	if [ -e "/sys/class/block/$dev/partition" ]; then
> -		parent=$(basename "$(readlink -f /sys/class/block/$dev/..)")
> -	else
> -		parent="$dev"
> +		dev=$(basename "$(readlink -f /sys/class/block/$dev/..)")
>  	fi
>  
> -	local queue_path="/sys/block/$parent/queue"
> +	echo "$dev"
> +}
> +
> +# Get the sysfs queue path for a block device, handling partitions correctly.
> +_sysfs_queue_path()
> +{
> +	local disk=$(_bdev_disk_name "$1")
> +	local queue_path="/sys/block/$disk/queue"
>  
>  	# Verify the path exists before returning
>  	if [ -e "$queue_path" ]; then
>  		echo "$queue_path"
>  		return 0
> -	else
> -		return 1
>  	fi
> +
> +	return 1
>  }
>  
>  # Get the minimum block size of a file.  Usually this is the
> -- 
> 2.53.0
> 

  reply	other threads:[~2026-09-13 12:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20260911070839epcas5p47f2a530a45e293ba4f18b6add13c8222@epcas5p4.samsung.com>
2026-09-11  7:08 ` add tests for file system on devices using protection information v5 Christoph Hellwig
2026-09-11  7:08   ` [PATCH 1/6] common/scsi_debug: don't slow down I/O Christoph Hellwig
2026-09-13 12:23     ` Zorro Lang
2026-09-11  7:08   ` [PATCH 2/6] common: factor out a _bdev_disk_name helper Christoph Hellwig
2026-09-13 12:55     ` Zorro Lang [this message]
2026-09-11  7:08   ` [PATCH 3/6] common: add a _sysfs_block_integrity_path helper Christoph Hellwig
2026-09-11  7:08   ` [PATCH 4/6] add a "pi" group Christoph Hellwig
2026-09-11  7:08   ` [PATCH 5/6] generic: test I/O on devices with T10 protection information Christoph Hellwig
2026-09-13 14:04     ` Zorro Lang
2026-09-11  7:08   ` [PATCH 6/6] generic: test corruption detection using " Christoph Hellwig
2026-09-11 15:07   ` add tests for file system on devices using protection information v5 Johannes Thumshirn
2026-09-11 15:26   ` Anuj Gupta/Anuj Gupta
2026-09-07  7:58 add tests for file system on devices using protection information v4 Christoph Hellwig
2026-09-07  7:58 ` [PATCH 2/6] common: factor out a _bdev_disk_name helper Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2026-08-31  6:45 add tests for file system on devices using protection information v3 Christoph Hellwig
2026-08-31  6:45 ` [PATCH 2/6] common: factor out a _bdev_disk_name helper Christoph Hellwig
2026-08-31 17:03   ` Darrick J. Wong

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=aqadFscVWs2U_mvr@zlang-mailbox \
    --to=zlang@kernel.org \
    --cc=anuj20.g@samsung.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=hch@lst.de \
    --cc=john.g.garry@oracle.com \
    --cc=joshi.k@samsung.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.