Michael S. Tsirkin
2022-Sep-28 13:15 UTC
[PATCH v3] virtio_blk: add SECURE ERASE command support
On Wed, Sep 28, 2022 at 01:48:43PM +0300, Alvaro Karsz wrote:> > What I worry about is that down the road we might want to add > > special meaning to currently unused values. > > If doing that just clears VIRTIO_BLK_F_SECURE_ERASE then > > we have forward compatibility. If it fails probe then we > > won't be able to do use these values. > > > They are not exactly unused, we are using them to calculate the > "discard sector alignment" and the "max discard sectors" values. > The values are even used directly if VIRTIO_BLK_F_DISCARD is not negotiated.Could you explain this last part? Why are they used without VIRTIO_BLK_F_DISCARD? -- MST
Alvaro Karsz
2022-Sep-29 07:13 UTC
[PATCH v3] virtio_blk: add SECURE ERASE command support
> Could you explain this last part? Why are they used without > VIRTIO_BLK_F_DISCARD?Sure, If both VIRTIO_BLK_F_DISCARD and VIRTIO_BLK_F_SECURE_ERASE are negotiated: q->limits.max_discard_segments min(virtio_blk_config->max_discard_seg, virtio_blk_config->max_secure_erase_seg) If VIRTIO_BLK_F_DISCARD is negotiated and VIRTIO_BLK_F_SECURE_ERASE isn't q->limits.max_discard_segments = virtio_blk_config->max_discard_seg If VIRTIO_BLK_F_SECURE_ERASE is negotiated and VIRTIO_BLK_F_DISCARD isn't q->limits.max_discard_segments = virtio_blk_config->max_secure_erase_seg