From: Zhang Yi <yi.zhang@huaweicloud.com>
To: John Garry <john.g.garry@oracle.com>,
linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-block@vger.kernel.org, dm-devel@lists.linux.dev,
linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org
Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
hch@lst.de, tytso@mit.edu, djwong@kernel.org,
bmarzins@redhat.com, chaitanyak@nvidia.com,
shinichiro.kawasaki@wdc.com, brauner@kernel.org,
martin.petersen@oracle.com, yi.zhang@huawei.com,
chengzhihao1@huawei.com, yukuai3@huawei.com,
yangerkun@huawei.com
Subject: Re: [PATCH v2 1/9] block: introduce max_{hw|user}_wzeroes_unmap_sectors to queue limits
Date: Sat, 23 Aug 2025 12:37:17 +0800 [thread overview]
Message-ID: <bf778cf7-6ae5-4f57-a40c-fbae5cbe00a7@huaweicloud.com> (raw)
In-Reply-To: <803a2183-a0bb-4b7a-92f1-afc5097630d2@oracle.com>
On 8/21/2025 8:55 PM, John Garry wrote:
> On 19/06/2025 12:17, Zhang Yi wrote:
>> }
>> @@ -333,6 +335,12 @@ int blk_validate_limits(struct queue_limits *lim)
>> if (!lim->max_segments)
>> lim->max_segments = BLK_MAX_SEGMENTS;
>> + if (lim->max_hw_wzeroes_unmap_sectors &&
>> + lim->max_hw_wzeroes_unmap_sectors != lim->max_write_zeroes_sectors)
>> + return -EINVAL;
>
> JFYI, I noticed that I am failing this check in raid0_set_limits() -> queue_limits_set() -> queue_limits_commit_update() -> blk_validate_limits() for v6.17-rc2
>
> The raid0 array consists of NVMe partitions. Here lim->max_hw_wzeroes_unmap_sectors = 4096 and lim->max_write_zeroes_sectors = 0 values for the failure, above.
>
> john@raspberrypi:~ $ cat /sys/block/nvme0n1/queue/write_zeroes_max_bytes
> 2097152
> john@raspberrypi:~ $ cat /sys/block/nvme0n1/queue/write_zeroes_unmap_max_bytes
> 2097152
> john@raspberrypi:~ $ cat
> /sys/block/nvme0n1/queue/write_zeroes_unmap_max_hw_bytes
> 2097152
> john@raspberrypi:~ $
>
>
Thank you for checking on this!
The problem is that raid0_set_limits() only sets max_write_zeroes_sectors
without synchronously setting max_hw_wzeroes_unmap_sectors. It appears
that all stacked drivers that call blk_set_stacking_limits() to
initialize stacked limits but independently adjust
max_write_zeroes_sectors are problematic, including all md drivers and
drbd. These drivers need to update max_hw_wzeroes_unmap_sectors as well, I
will send out a fix soon.
Thanks,
Yi.
>
>> + lim->max_wzeroes_unmap_sectors = min(lim->max_hw_wzeroes_unmap_sectors,
>> + lim->max_user_wzeroes_unmap_sectors);
>> +
>> lim->max_discard_sectors =
>> min(lim->max_hw_discard_sectors, lim->max_user_discard_sectors);
>> @@ -418,10 +426,11 @@ int blk_set_default_limits(struct queue_limits *lim)
next prev parent reply other threads:[~2025-08-23 9:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 11:17 [PATCH v2 0/9] fallocate: introduce FALLOC_FL_WRITE_ZEROES flag Zhang Yi
2025-06-19 11:17 ` [PATCH v2 1/9] block: introduce max_{hw|user}_wzeroes_unmap_sectors to queue limits Zhang Yi
2025-06-23 5:39 ` Christoph Hellwig
2025-08-21 12:55 ` John Garry
2025-08-23 4:37 ` Zhang Yi [this message]
2025-06-19 11:17 ` [PATCH v2 2/9] nvme: set max_hw_wzeroes_unmap_sectors if device supports DEAC bit Zhang Yi
2025-06-23 5:40 ` Christoph Hellwig
2025-06-19 11:18 ` [PATCH v2 3/9] nvmet: set WZDS and DRB if device enables unmap write zeroes operation Zhang Yi
2025-06-23 5:40 ` Christoph Hellwig
2025-06-19 11:18 ` [PATCH v2 4/9] scsi: sd: set max_hw_wzeroes_unmap_sectors if device supports SD_ZERO_*_UNMAP Zhang Yi
2025-06-19 11:18 ` [PATCH v2 5/9] dm: clear unmap write zeroes limits when disabling write zeroes Zhang Yi
2025-06-19 11:18 ` [PATCH v2 6/9] fs: introduce FALLOC_FL_WRITE_ZEROES to fallocate Zhang Yi
2025-06-19 11:18 ` [PATCH v2 7/9] block: factor out common part in blkdev_fallocate() Zhang Yi
2025-06-19 11:18 ` [PATCH v2 8/9] block: add FALLOC_FL_WRITE_ZEROES support Zhang Yi
2025-06-19 11:18 ` [PATCH v2 9/9] ext4: " Zhang Yi
2025-06-23 10:46 ` [PATCH v2 0/9] fallocate: introduce FALLOC_FL_WRITE_ZEROES flag Christian Brauner
2025-07-03 3:35 ` Zhang Yi
2025-07-04 8:39 ` Christian Brauner
2025-06-23 15:08 ` Martin K. Petersen
2025-06-26 13:57 ` Zhang Yi
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=bf778cf7-6ae5-4f57-a40c-fbae5cbe00a7@huaweicloud.com \
--to=yi.zhang@huaweicloud.com \
--cc=bmarzins@redhat.com \
--cc=brauner@kernel.org \
--cc=chaitanyak@nvidia.com \
--cc=chengzhihao1@huawei.com \
--cc=djwong@kernel.org \
--cc=dm-devel@lists.linux.dev \
--cc=hch@lst.de \
--cc=john.g.garry@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=shinichiro.kawasaki@wdc.com \
--cc=tytso@mit.edu \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.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).