From: "Darrick J. Wong" <djwong@kernel.org>
To: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Cc: Zorro Lang <zlang@redhat.com>,
fstests@vger.kernel.org, Disha Goel <disgoel@linux.ibm.com>
Subject: Re: [PATCH 2/4] generic/765: Fix sysfs path for nvme partitions
Date: Wed, 1 Apr 2026 07:08:29 -0700 [thread overview]
Message-ID: <20260401140829.GG6212@frogsfrogsfrogs> (raw)
In-Reply-To: <7fe6154353d38b2dc308db16d8125b83a8ed7daf.1775039135.git.ojaswin@linux.ibm.com>
On Wed, Apr 01, 2026 at 04:10:48PM +0530, Ojaswin Mujoo wrote:
> This tests checks atomic write limits reported by statx() are same as
> the ones reported by sysfs, however nvme partitions don't have the
> /sys/block/nvme0n1p1 style entry and also use the namespace's queue
> limits for atomic writes. This causes the test to fail because it
> expects /sys/block/nvme0n*p* to be present.
>
> Hence, in this case, just check against the parent namespace.
>
> Reported-by: Disha Goel <disgoel@linux.ibm.com>
> Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
> ---
> tests/generic/765 | 23 +++++++++++++++++++----
> 1 file changed, 19 insertions(+), 4 deletions(-)
>
> diff --git a/tests/generic/765 b/tests/generic/765
> index 8c4e0bd0..4c768783 100755
> --- a/tests/generic/765
> +++ b/tests/generic/765
> @@ -94,16 +94,31 @@ test_atomic_writes()
> _scratch_unmount
> }
>
> -sys_min_write=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/atomic_write_unit_min_bytes")
> -sys_max_write=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/atomic_write_unit_max_bytes")
I see this show up in a few other places:
$ git grep /sys/block
common/dmlogwrites:64: local sysfs="/sys/block/$(_short_dev $1)"
common/rc:2567: local sysfs="/sys/block/$(_short_dev $SCRATCH_DEV)"
common/rc:2631: if [ -e /sys/block/${sdev}/queue/zoned ]; then
common/rc:2632: cat /sys/block/${sdev}/queue/zoned
common/scsi_debug:67: device=`grep -wl scsi_debug /sys/block/sd*/device/model | awk -F / '{print $4}'`
tests/btrfs/076:31: zone_append_max=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/zone_append_max_bytes")
tests/btrfs/237:48:zone_size=$(($(cat /sys/block/${sdev}/queue/chunk_sectors) << 9))
tests/btrfs/283:29: zone_append_max=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/zone_append_max_bytes")
vests/generic/108:20: echo running > /sys/block/`_short_dev $SCSI_DEBUG_DEV`/device/state
tests/generic/108:81:echo offline > /sys/block/`_short_dev $SCSI_DEBUG_DEV`/device/state
tests/generic/730:56:echo 1 > /sys/block/$(_short_dev $SCSI_DEBUG_DEV)/device/delete
tests/generic/731:49:echo 1 > /sys/block/`_short_dev $SCSI_DEBUG_DEV`/device/delete
tests/generic/765:97:sys_min_write=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/atomic_write_unit_min_bytes")
tests/generic/765:98:sys_max_write=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/atomic_write_unit_max_bytes")
So I wonder if the same problem exists there as well?
(Well, maybe not the scsi-debug users)
> +# Get the right sysfs dev for the atomic write device
> +get_aw_dev() {
> + local dev
> + dev=$(_short_dev "$1")
> +
> + # Special case: nvme partitions don't have the /sys/block/nvme0n1p1 style
> + # entry and also use the namespace's queue limits for atomic writes, hence
> + # just return the parent namespace.
> + if [[ $dev == nvme* ]]; then
> + echo "${dev%%p[0-9]*}"
> + else
> + echo "$dev"
> + fi
> +}
Perhaps this ought to turn into a common helper to fix them all?
_sys_block_path() {
local dev=$(_short_dev "$1")
# Special case: nvme partitions don't have the /sys/block/nvme0n1p1 style
# entry and also use the namespace's queue limits for atomic writes, hence
# just return the parent namespace.
if [[ $dev == nvme* ]]; then
echo "/sys/block/${dev%%p[0-9]*}"
else
echo "/sys/block/$dev"
fi
}
sys_min_write=$(_sys_block_path $SCRATCH_DEV)/queue/<whatever>)
Also, don't some of the other block devices follow this "partition has
pXXX suffix" pattern as well? Not that I have a clue why scsi doesn't
follow that pattern or even which part of sd.c triggers the sdaX
behavior. :/
--D
> +
> +sys_min_write=$(cat "/sys/block/$(get_aw_dev $SCRATCH_DEV)/queue/atomic_write_unit_min_bytes")
> +sys_max_write=$(cat "/sys/block/$(get_aw_dev $SCRATCH_DEV)/queue/atomic_write_unit_max_bytes")
>
> bdev_min_write=$(_get_atomic_write_unit_min $SCRATCH_DEV)
> bdev_max_write=$(_get_atomic_write_unit_max $SCRATCH_DEV)
>
> echo "sysfs awu_min $sys_min_write" >> $seqres.full
> -echo "sysfs awu_min $sys_max_write" >> $seqres.full
> +echo "sysfs awu_max $sys_max_write" >> $seqres.full
> echo "bdev awu_min $bdev_min_write" >> $seqres.full
> -echo "bdev awu_min $bdev_max_write" >> $seqres.full
> +echo "bdev awu_max $bdev_max_write" >> $seqres.full
>
> # Test that statx atomic values are the same as sysfs values
> if [ "$sys_min_write" -ne "$bdev_min_write" ]; then
> --
> 2.53.0
>
>
next prev parent reply other threads:[~2026-04-01 14:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 10:40 [PATCH 1/4] ext4/061,062: Minor fixes and refactoring Ojaswin Mujoo
2026-04-01 10:40 ` [PATCH 2/4] generic/765: Fix sysfs path for nvme partitions Ojaswin Mujoo
2026-04-01 14:08 ` Darrick J. Wong [this message]
2026-04-05 15:07 ` Ojaswin Mujoo
2026-04-06 15:43 ` Darrick J. Wong
2026-04-07 14:48 ` Ojaswin Mujoo
2026-04-01 10:40 ` [PATCH 3/4] generic/765: Ignore mkfs warning Ojaswin Mujoo
2026-04-01 14:30 ` Darrick J. Wong
2026-04-05 14:10 ` Ojaswin Mujoo
2026-04-01 10:40 ` [PATCH 4/4] generic/775: Fix an infinite loop due to variable name clash Ojaswin Mujoo
2026-04-01 14:32 ` Darrick J. Wong
2026-04-05 14:07 ` Ojaswin Mujoo
2026-04-06 15:39 ` Darrick J. Wong
2026-04-01 14:33 ` [PATCH 1/4] ext4/061,062: Minor fixes and refactoring 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=20260401140829.GG6212@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=disgoel@linux.ibm.com \
--cc=fstests@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=zlang@redhat.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