[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [PATCH 3/4] virtio-blk: clarify units for sector and data length
For reads and writes, the sector is the offset divided by 512, not multiplied. For everything else, it is zero. Mention VIRTIO_BLK_F_BLK_SIZE in the normative section. The data length need not be a multiple of 512, so do not express that requirement in the virtio_blk_req struct. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- content.tex | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/content.tex b/content.tex index fd3a3c2..b7d0bea 100644 --- a/content.tex +++ b/content.tex @@ -3711,7 +3711,7 @@ struct virtio_blk_req { le32 type; le32 reserved; le64 sector; - u8 data[][512]; + u8 data[]; u8 status; }; @@ -3737,7 +3737,7 @@ The type of the request is either a read (VIRTIO_BLK_T_IN), a write #define VIRTIO_BLK_T_WRITE_ZEROES 13 \end{lstlisting} -The \field{sector} number indicates the offset (multiplied by 512) where +The \field{sector} number indicates the offset (in 512-byte units) where the read or write is to occur. This field is unused and set to 0 for commands other than read or write. @@ -3766,9 +3766,15 @@ A driver SHOULD NOT submit a request which has more than \field{seg_max} descriptors in the data portion, or which has more than \field{size_max} bytes in a single descriptor in the data portion. +The byte offset of each operation (sector number multiplied by +512) and data length SHOULD be aligned to the block size if the +VIRTIO_BLK_F_BLK_SIZE feature is negotiated. + A driver SHOULD accept the VIRTIO_BLK_F_RO feature if offered. -A driver MUST set \field{sector} to 0 for a VIRTIO_BLK_T_FLUSH request. +A driver MUST set \field{sector} to 0 for a VIRTIO_BLK_T_FLUSH, +VIRTIO_BLK_T_DISCARD or VIRTIO_BLK_T_WRITE_ZEROES request. + A driver SHOULD NOT include any data in a VIRTIO_BLK_T_FLUSH request. If the VIRTIO_BLK_F_CONFIG_WCE feature is negotiated, the driver MAY -- 2.17.1
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]