[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <bf778cf7-6ae5-4f57-a40c-fbae5cbe00a7@huaweicloud.com>
Date: Sat, 23 Aug 2025 12:37:17 +0800
From: Zhang Yi <yi.zhang@...weicloud.com>
To: John Garry <john.g.garry@...cle.com>, linux-fsdevel@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-block@...r.kernel.org,
dm-devel@...ts.linux.dev, linux-nvme@...ts.infradead.org,
linux-scsi@...r.kernel.org
Cc: linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org, hch@....de,
tytso@....edu, djwong@...nel.org, bmarzins@...hat.com,
chaitanyak@...dia.com, shinichiro.kawasaki@....com, brauner@...nel.org,
martin.petersen@...cle.com, yi.zhang@...wei.com, chengzhihao1@...wei.com,
yukuai3@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH v2 1/9] block: introduce
max_{hw|user}_wzeroes_unmap_sectors to queue limits
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@...pberrypi:~ $ cat /sys/block/nvme0n1/queue/write_zeroes_max_bytes
> 2097152
> john@...pberrypi:~ $ cat /sys/block/nvme0n1/queue/write_zeroes_unmap_max_bytes
> 2097152
> john@...pberrypi:~ $ cat
> /sys/block/nvme0n1/queue/write_zeroes_unmap_max_hw_bytes
> 2097152
> john@...pberrypi:~ $
>
>
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)
Powered by blists - more mailing lists