From: Benjamin Marzinski <bmarzins@redhat.com>
To: Zhang Yi <yi.zhang@huaweicloud.com>
Cc: 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,
linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
hch@lst.de, tytso@mit.edu, djwong@kernel.org,
john.g.garry@oracle.com, chaitanyak@nvidia.com,
shinichiro.kawasaki@wdc.com, yi.zhang@huawei.com,
chengzhihao1@huawei.com, yukuai3@huawei.com,
yangerkun@huawei.com
Subject: Re: [RFC PATCH -next v3 06/10] dm: add BLK_FEAT_WRITE_ZEROES_UNMAP support
Date: Wed, 19 Mar 2025 15:50:27 -0400 [thread overview]
Message-ID: <Z9sgAxM-hZZJtZu9@redhat.com> (raw)
In-Reply-To: <20250318073545.3518707-7-yi.zhang@huaweicloud.com>
On Tue, Mar 18, 2025 at 03:35:41PM +0800, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@huawei.com>
>
> Set the BLK_FEAT_WRITE_ZEROES_UNMAP feature on stacking queue limits by
> default. This feature shall be disabled if any underlying device does
> not support it.
>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
> ---
> drivers/md/dm-table.c | 7 +++++--
> drivers/md/dm.c | 1 +
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
> index 453803f1edf5..d4a483287e26 100644
> --- a/drivers/md/dm-table.c
> +++ b/drivers/md/dm-table.c
> @@ -598,7 +598,8 @@ int dm_split_args(int *argc, char ***argvp, char *input)
> static void dm_set_stacking_limits(struct queue_limits *limits)
> {
> blk_set_stacking_limits(limits);
> - limits->features |= BLK_FEAT_IO_STAT | BLK_FEAT_NOWAIT | BLK_FEAT_POLL;
> + limits->features |= BLK_FEAT_IO_STAT | BLK_FEAT_NOWAIT | BLK_FEAT_POLL |
> + BLK_FEAT_WRITE_ZEROES_UNMAP;
> }
>
> /*
> @@ -1848,8 +1849,10 @@ int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
> limits->discard_alignment = 0;
> }
>
> - if (!dm_table_supports_write_zeroes(t))
> + if (!dm_table_supports_write_zeroes(t)) {
> limits->max_write_zeroes_sectors = 0;
> + limits->features &= ~BLK_FEAT_WRITE_ZEROES_UNMAP;
> + }
>
> if (!dm_table_supports_secure_erase(t))
> limits->max_secure_erase_sectors = 0;
> diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> index 5ab7574c0c76..b59c3dbeaaf1 100644
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -1096,6 +1096,7 @@ void disable_write_zeroes(struct mapped_device *md)
>
> /* device doesn't really support WRITE ZEROES, disable it */
> limits->max_write_zeroes_sectors = 0;
> + limits->features &= ~BLK_FEAT_WRITE_ZEROES_UNMAP;
> }
>
> static bool swap_bios_limit(struct dm_target *ti, struct bio *bio)
> --
> 2.46.1
next prev parent reply other threads:[~2025-03-19 19:50 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 7:35 [RFC PATCH -next v3 00/10] fallocate: introduce FALLOC_FL_WRITE_ZEROES flag Zhang Yi
2025-03-18 7:35 ` [RFC PATCH -next v3 01/10] block: introduce BLK_FEAT_WRITE_ZEROES_UNMAP to queue limits features Zhang Yi
2025-04-09 10:31 ` Christoph Hellwig
2025-04-10 3:52 ` Zhang Yi
2025-04-10 7:15 ` Christoph Hellwig
2025-04-10 8:20 ` Keith Busch
2025-04-10 9:35 ` Zhang Yi
2025-04-10 9:15 ` Zhang Yi
2025-03-18 7:35 ` [RFC PATCH -next v3 02/10] nvme: set BLK_FEAT_WRITE_ZEROES_UNMAP if device supports DEAC bit Zhang Yi
2025-03-18 7:35 ` [RFC PATCH -next v3 03/10] nvme-multipath: add BLK_FEAT_WRITE_ZEROES_UNMAP support Zhang Yi
2025-03-18 7:35 ` [RFC PATCH -next v3 04/10] nvmet: set WZDS and DRB if device supports BLK_FEAT_WRITE_ZEROES_UNMAP Zhang Yi
2025-04-09 10:34 ` Christoph Hellwig
2025-03-18 7:35 ` [RFC PATCH -next v3 05/10] scsi: sd: set BLK_FEAT_WRITE_ZEROES_UNMAP if device supports unmap zeroing mode Zhang Yi
2025-03-18 7:35 ` [RFC PATCH -next v3 06/10] dm: add BLK_FEAT_WRITE_ZEROES_UNMAP support Zhang Yi
2025-03-19 19:50 ` Benjamin Marzinski [this message]
2025-03-18 7:35 ` [RFC PATCH -next v3 07/10] fs: introduce FALLOC_FL_WRITE_ZEROES to fallocate Zhang Yi
2025-04-09 10:35 ` Christoph Hellwig
2025-04-09 10:50 ` Christian Brauner
2025-04-18 6:44 ` Zhang Yi
2025-03-18 7:35 ` [RFC PATCH -next v3 08/10] block: add FALLOC_FL_WRITE_ZEROES support Zhang Yi
2025-03-18 7:35 ` [RFC PATCH -next v3 09/10] block: factor out common part in blkdev_fallocate() Zhang Yi
2025-04-09 10:36 ` Christoph Hellwig
2025-04-09 10:36 ` Christoph Hellwig
2025-03-18 7:35 ` [RFC PATCH -next v3 10/10] ext4: add FALLOC_FL_WRITE_ZEROES support 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=Z9sgAxM-hZZJtZu9@redhat.com \
--to=bmarzins@redhat.com \
--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=shinichiro.kawasaki@wdc.com \
--cc=tytso@mit.edu \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yi.zhang@huaweicloud.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).