Re: [virtio-dev] virtio-blk: the nature of discard_sector_alignment

From
Paolo Bonzini <>
Date
2019-02-22T13:59:50+00:00
ID
Thread
Re: [virtio-dev] virtio-blk: the nature of discard_sector_alignment
On 22/02/19 10:41, Jakub Jermar wrote:
> Hi Paolo!
> 
> On 2/22/19 10:21 AM, Paolo Bonzini wrote:
>> On 21/02/19 17:38, Jakub Jermar wrote:
>>>
>>> my device enforces the discard_sector_alignment on the request (both
>>> sector and num_sectors), but for some reason the blkdiscard command and
>>> Linux driver issue requests that do not honor this alignment.
>>>
>>> Does discard_sector_alignment represent a strict requirement that must
>>> be always honored or is it rather a hint to the driver?
>>
>> It's a hint that misaligned requests might not result in any discard
>> happening at all.
> 
> In that case, would the failure to discard anything be silent? In other
> words, would the request complete with VIRTIO_BLK_S_OK or rather any of
> VIRTIO_BLK_S_IOERR or VIRTIO_BLK_S_UNSUPP?

Yes, it would be silent.  The same is true for NVMe, SCSI etc.

Paolo