Re: [PATCH] virtio_blk: add SECURE ERASE command support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: PGP signature

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux