From: Stefan Hajnoczi <stefanha@redhat.com>
To: Alvaro Karsz <alvaro.karsz@solid-run.com>
Cc: Jens Axboe <axboe@kernel.dk>, Paolo Bonzini <pbonzini@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] virtio_blk: add SECURE ERASE command support
Date: Wed, 24 Aug 2022 14:37:59 -0400 [thread overview]
Message-ID: <YwZwB9BlGeA08Hmn@fedora> (raw)
In-Reply-To: <CAJs=3_C9Bm=zsDUXuGXnDmZEKmSYfj-44UvuuyT1_SgbSXJoYQ@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1587 bytes --]
On Wed, Aug 24, 2022 at 09:45:57AM +0300, Alvaro Karsz wrote:
> > What about max_secure_erase_seg and secure_erase_sector_alignment?
>
> Hi Stefan,
> If I understand correctly, the Linux kernel uses the same "max
> segments" value for a discard and a secure erase command.
>
> > unsigned int blk_recalc_rq_segments(struct request *rq)
> > {
> > unsigned int nr_phys_segs = 0;
> > unsigned int bytes = 0;
> > struct req_iterator iter;
> > struct bio_vec bv;
> >
> >
> > if (!rq->bio)
> > return 0;
> >
> >
> > switch (bio_op(rq->bio)) {
> > case REQ_OP_DISCARD:
> > case REQ_OP_SECURE_ERASE:
> > if (queue_max_discard_segments(rq->q) > 1) {
> > struct bio *bio = rq->bio;
> >
> >
> > for_each_bio(bio)
> > nr_phys_segs++;
> > return nr_phys_segs;
> > }
> >
> > ....
>
>
> > struct bio *__bio_split_to_limits(struct bio *bio, struct queue_limits *lim,
> > unsigned int *nr_segs)
> > {
> > struct bio_set *bs = &bio->bi_bdev->bd_disk->bio_split;
> > struct bio *split;
> >
> >
> > switch (bio_op(bio)) {
> > case REQ_OP_DISCARD:
> > case REQ_OP_SECURE_ERASE:
> > split = bio_split_discard(bio, lim, nr_segs, bs);
> >
> > break;
> >
> > ...
>
> What do you suggest?
>
> BTW, the same happens for the write zeros command implementation.
> max_write_zeroes_seg and write_zeroes_may_unmap are ignored in the Linux kernel.
How about calculating the minimum of the limits?
Stefan
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 183 bytes --]
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2022-08-24 18:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220822162055.634854-1-alvaro.karsz@solid-run.com>
2022-08-23 19:46 ` [PATCH] virtio_blk: add SECURE ERASE command support Stefan Hajnoczi
2022-08-24 6:45 ` Alvaro Karsz
2022-08-24 18:37 ` Stefan Hajnoczi [this message]
2022-08-24 19:48 ` Alvaro Karsz
2022-08-25 13:47 ` Stefan Hajnoczi
2022-08-29 6:21 ` Alvaro Karsz
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=YwZwB9BlGeA08Hmn@fedora \
--to=stefanha@redhat.com \
--cc=alvaro.karsz@solid-run.com \
--cc=axboe@kernel.dk \
--cc=mst@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.