From: Stefan Hajnoczi <stefanha@redhat.com>
To: Akihiko Odaki <akihiko.odaki@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Jens Axboe <axboe@kernel.dk>, Paolo Bonzini <pbonzini@redhat.com>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] virtio-blk: Assign discard_granularity
Date: Mon, 28 Feb 2022 10:51:56 +0000 [thread overview]
Message-ID: <YhypTNtWpcgh3gb2@stefanha-x1.localdomain> (raw)
In-Reply-To: <20220224093802.11348-1-akihiko.odaki@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1507 bytes --]
On Thu, Feb 24, 2022 at 06:38:02PM +0900, Akihiko Odaki wrote:
> Virtual I/O Device (VIRTIO) Version 1.1
> https://docs.oasis-open.org/virtio/virtio/v1.1/csprd01/virtio-v1.1-csprd01.html
> > discard_sector_alignment can be used by OS when splitting a request
> > based on alignment.
>
> According to Documentation/ABI/stable/sysfs-block, the corresponding
> field in the kernel is, confusingly, discard_granularity, not
> discard_alignment.
Good catch, struct virtio_blk_config->discard_sector_alignment is Linux
q->limits.discard_granularity.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
> ---
> drivers/block/virtio_blk.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index c443cd64fc9b..1fb3c89900e3 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -913,11 +913,9 @@ static int virtblk_probe(struct virtio_device *vdev)
> blk_queue_io_opt(q, blk_size * opt_io_size);
>
> if (virtio_has_feature(vdev, VIRTIO_BLK_F_DISCARD)) {
> - q->limits.discard_granularity = blk_size;
> -
> virtio_cread(vdev, struct virtio_blk_config,
> discard_sector_alignment, &v);
> - q->limits.discard_alignment = v ? v << SECTOR_SHIFT : 0;
Should we use struct virtio_blk_config->topology.alignment_offset
("offset of first aligned logical block" and used for Linux
blk_queue_alignment_offset()) for q->limits.discard_alignment?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-02-28 10:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-24 9:38 [PATCH] virtio-blk: Assign discard_granularity Akihiko Odaki
2022-02-28 10:51 ` Stefan Hajnoczi [this message]
2022-03-01 5:43 ` Akihiko Odaki
2022-03-01 9:06 ` Stefan Hajnoczi
2022-03-01 16:30 ` Martin K. Petersen
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=YhypTNtWpcgh3gb2@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=akihiko.odaki@gmail.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/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