On 1/13/21 1:35 PM, Stefan Hajnoczi wrote:
> On Tue, Jan 12, 2021 at 11:16:11AM +0200, Laura Loghin wrote:
>> Regarding the relation between data descriptors and segments, the
>> commit that added discard and write zeroes to the spec, stated that
>> the idea is "using 16 Bytes payload to support 1 descriptor" (not, for
>> example, 32 bytes). There wasn't any mention in the spec about one data
>> descriptor corresponding to exactly one segment. Added this constraint
>> to block documentation.
>>
>> Signed-off-by: Laura Loghin <
lauralg@amazon.com>
>> ---
>> content.tex | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/content.tex b/content.tex
>> index 620c0e2..6393b68 100644
>> --- a/content.tex
>> +++ b/content.tex
>> @@ -4599,8 +4599,9 @@ \subsection{Device Operation}\label{sec:Device Types / Block Device / Device Ope
>> of 512 bytes).
>>
>> The \field{data} used for discard or write zeroes commands consists of one or
>> -more segments. The maximum number of segments is \field{max_discard_seg} for
>> -discard commands and \field{max_write_zeroes_seg} for write zeroes commands.
>> +more segments, and one data descriptor corresponds to exactly one such segment.
>> +The maximum number of segments is \field{max_discard_seg} for discard commands
>> +and \field{max_write_zeroes_seg} for write zeroes commands.
>> Each segment is of form:
> I'm not sure what this means, could you clarify?
>
> There is no concept of "descriptor" in virtio-blk write zeroes/discard.
> There is only the "segment" (struct virtio_blk_discard_write_zeroes).
>
> If you are referring to vring descriptors, then there is no relationship
> between struct virtio_blk_req::data[] and vring descriptors. The driver
> may choose any vring descriptor framing/layout (see 2.6.4 Message
> Framing).
>
> Stefan
Basically what I was trying to understand is if the specification enforces/should enforce that
`len` field from a vring descriptor that is pointing to data that belongs to a discard/write zeroes
command is always 16 bytes. So what you are saying is that something like:
struct virtq_desc {
/* Address (guest-physical). */
le64 addr;
/* Length. */
le32 32;
...
};
is totally legit for a virtq descriptor that belongs to a (large) discard/write zeroes request?
So this descriptor will point to a memory region where you have two virtio_blk_discard_write_zeroes
segments, one at `addr` address from above and the other one at `addr + 16`.
Thanks!
Laura
Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.