Skip to contentSkip to conversation

blkif.h: enhance comments related to the discard feature

PATCH Superseded Olaf Hering 4 participants 9 messages Jan 14, 2014 – Jan 27, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blkif.h: enhance comments related to the discard feature

Also fix the name of the discard-alignment property, add the missing 'n'.

---
 xen/include/public/io/blkif.h | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
xen/include/public/io/blkif.h +12 -4
index 84eb7fd..515ea90 100644
@@ -175,7 +175,7 @@
  *
  *------------------------- Backend Device Properties -------------------------
  *
- * discard-aligment
+ * discard-alignment
  *      Values:         <uint32_t>
  *      Default Value:  0
  *      Notes:          4, 5
@@ -194,6 +194,7 @@
  * discard-secure
  *      Values:         0/1 (boolean)
  *      Default Value:  0
+ *      Notes:          10
  *
  *      A value of "1" indicates that the backend can process BLKIF_OP_DISCARD
  *      requests with the BLKIF_DISCARD_SECURE flag set.
@@ -323,9 +324,14 @@
  *     For full interoperability, block front and backends should publish
  *     identical ring parameters, adjusted for unit differences, to the
  *     XenStore nodes used in both schemes.
- * (4) Devices that support discard functionality may internally allocate
- *     space (discardable extents) in units that are larger than the
- *     exported logical block size.
+ * (4) Devices that support discard functionality may internally allocate space
+ *     (discardable extents) in units that are larger than the exported logical
+ *     block size. If the backing device has such discardable extents the
+ *     backend must provide both discard-granularity and discard-alignment.
+ *     Backends supporting discard should include discard-granularity and
+ *     discard-alignment even if it supports discarding individual sectors.
+ *     Frontends should assume discard-alignment == 0 and discard-granularity ==
+ *     sector size if these keys are missing.
  * (5) The discard-alignment parameter allows a physical device to be
  *     partitioned into virtual devices that do not necessarily begin or
  *     end on a discardable extent boundary.
@@ -344,6 +350,8 @@
  *     grants that can be persistently mapped in the frontend driver, but
  *     due to the frontent driver implementation it should never be bigger
  *     than RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST.
+ *(10) The discard-secure property may be present and will be set to 1 if the
+ *     backing device supports secure discard.
  */
 
 /*
#1 lore raw
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Olaf Hering

Also fix the name of the discard-alignment property, add the missing 'n'.

Konrad,

you have been working on the discard stuff quite a bit iirc - any chance you could take a look and send and ack/review?

Jan

Quoted 62 lines
---
 xen/include/public/io/blkif.h | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
xen/include/public/io/blkif.h +2 -1
index 84eb7fd..515ea90 100644
@@ -175,7 +175,7 @@
  *
  *------------------------- Backend Device Properties -------------------------
  *
- * discard-aligment
+ * discard-alignment
  *      Values:         <uint32_t>
  *      Default Value:  0
  *      Notes:          4, 5
@@ -194,6 +194,7 @@
  * discard-secure
  *      Values:         0/1 (boolean)
  *      Default Value:  0
+ *      Notes:          10
  *
  *      A value of "1" indicates that the backend can process 

BLKIF_OP_DISCARD
* requests with the BLKIF_DISCARD_SECURE flag set.

xen/include/public/io/blkif.h +1 -3
@@ -323,9 +324,14 @@
  *     For full interoperability, block front and backends should publish
  *     identical ring parameters, adjusted for unit differences, to the
  *     XenStore nodes used in both schemes.
- * (4) Devices that support discard functionality may internally allocate
- *     space (discardable extents) in units that are larger than the
- *     exported logical block size.
+ * (4) Devices that support discard functionality may internally allocate 

space
+ * (discardable extents) in units that are larger than the exported
logical

+ *     block size. If the backing device has such discardable extents the
+ *     backend must provide both discard-granularity and discard-alignment.
+ *     Backends supporting discard should include discard-granularity and
+ *     discard-alignment even if it supports discarding individual sectors.
+ *     Frontends should assume discard-alignment == 0 and discard-granularity 

==
+ * sector size if these keys are missing.
* (5) The discard-alignment parameter allows a physical device to be
* partitioned into virtual devices that do not necessarily begin or
* end on a discardable extent boundary.

xen/include/public/io/blkif.h +1 -0
@@ -344,6 +350,8 @@
  *     grants that can be persistently mapped in the frontend driver, but
  *     due to the frontent driver implementation it should never be bigger
  *     than RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST.
+ *(10) The discard-secure property may be present and will be set to 1 if 

the
+ * backing device supports secure discard.
*/

/*

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
Quoted 43 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Olaf Hering

Also fix the name of the discard-alignment property, add the missing 'n'.

Konrad,

you have been working on the discard stuff quite a bit iirc - any chance you could take a look and send and ack/review?

Jan

Quoted 31 lines
---
 xen/include/public/io/blkif.h | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
xen/include/public/io/blkif.h +2 -1
index 84eb7fd..515ea90 100644
@@ -175,7 +175,7 @@
  *
  *------------------------- Backend Device Properties -------------------------
  *
- * discard-aligment
+ * discard-alignment
  *      Values:         <uint32_t>
  *      Default Value:  0
  *      Notes:          4, 5
@@ -194,6 +194,7 @@
  * discard-secure
  *      Values:         0/1 (boolean)
  *      Default Value:  0
+ *      Notes:          10
  *
  *      A value of "1" indicates that the backend can process 

BLKIF_OP_DISCARD
* requests with the BLKIF_DISCARD_SECURE flag set.

xen/include/public/io/blkif.h +0 -1
@@ -323,9 +324,14 @@
  *     For full interoperability, block front and backends should publish
  *     identical ring parameters, adjusted for unit differences, to the
  *     XenStore nodes used in both schemes.
- * (4) Devices that support discard functionality may internally allocate
Quoted 8 lines
Quoted 8 lines
xen/include/public/io/blkif.h +1 -2
- *     space (discardable extents) in units that are larger than the
- *     exported logical block size.
+ * (4) Devices that support discard functionality may internally allocate 

space
+ * (discardable extents) in units that are larger than the exported
logical
+ * block size. If the backing device has such discardable extents the
+ * backend must provide both discard-granularity and discard-alignment.

                    ^^^^ - MAY
Quoted 1 line
Quoted 1 line

+ * Backends supporting discard should include discard-granularity and

                                        ^^^^^ - MAY
Quoted 25 lines
Quoted 22 lines

+ * discard-alignment even if it supports discarding individual sectors.
+ * Frontends should assume discard-alignment == 0 and discard-granularity
==
+ * sector size if these keys are missing.
* (5) The discard-alignment parameter allows a physical device to be
* partitioned into virtual devices that do not necessarily begin or
* end on a discardable extent boundary.

xen/include/public/io/blkif.h +1 -0
@@ -344,6 +350,8 @@
  *     grants that can be persistently mapped in the frontend driver, but
  *     due to the frontent driver implementation it should never be bigger
  *     than RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST.
+ *(10) The discard-secure property may be present and will be set to 1 if 

the
+ * backing device supports secure discard.
*/

/*

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 17 lines
Quoted 1 line
Quoted 1 line · Konrad Rzeszutek Wilk
Quoted 14 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
xen/include/public/io/blkif.h +1 -3
@@ -323,9 +324,14 @@
  *     For full interoperability, block front and backends should publish
  *     identical ring parameters, adjusted for unit differences, to the
  *     XenStore nodes used in both schemes.
- * (4) Devices that support discard functionality may internally allocate
- *     space (discardable extents) in units that are larger than the
- *     exported logical block size.
+ * (4) Devices that support discard functionality may internally allocate 
Quoted 5 lines

space
+ * (discardable extents) in units that are larger than the exported
logical
+ * block size. If the backing device has such discardable extents the
+ * backend must provide both discard-granularity and discard-alignment.

                    ^^^^ - MAY

I think the intention is to say that these two should go together, i.e. specifying just one of them is a mistake.

Jan

Quoted 9 lines
Quoted 1 line
Quoted 1 line

+ * Backends supporting discard should include discard-granularity and

                                        ^^^^^ - MAY
Quoted 7 lines
Quoted 7 lines

+ * discard-alignment even if it supports discarding individual sectors.
+ * Frontends should assume discard-alignment == 0 and discard-granularity
==
+ * sector size if these keys are missing.
* (5) The discard-alignment parameter allows a physical device to be
* partitioned into virtual devices that do not necessarily begin or
* end on a discardable extent boundary.

#4 lore raw
Quoted 18 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · Konrad Rzeszutek Wilk
Quoted 14 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
xen/include/public/io/blkif.h +1 -3
@@ -323,9 +324,14 @@
  *     For full interoperability, block front and backends should publish
  *     identical ring parameters, adjusted for unit differences, to the
  *     XenStore nodes used in both schemes.
- * (4) Devices that support discard functionality may internally allocate
- *     space (discardable extents) in units that are larger than the
- *     exported logical block size.
+ * (4) Devices that support discard functionality may internally allocate 
Quoted 5 lines

space
+ * (discardable extents) in units that are larger than the exported
logical
+ * block size. If the backing device has such discardable extents the
+ * backend must provide both discard-granularity and discard-alignment.

                    ^^^^ - MAY
Quoted 2 lines

I think the intention is to say that these two should go together, i.e. specifying just one of them is a mistake.

The 'and' in that sentence covers that I think?

My reading with 'must' is that 'features-discard' MUST have both discard-granularity and discard-alignment. But that is not the case
- even if the device does support them - it does not have to expose them.

Quoted 14 lines

Jan

Quoted 9 lines
Quoted 1 line
Quoted 1 line

+ * Backends supporting discard should include discard-granularity and

                                        ^^^^^ - MAY
Quoted 7 lines
Quoted 7 lines

+ * discard-alignment even if it supports discarding individual sectors.
+ * Frontends should assume discard-alignment == 0 and discard-granularity
==
+ * sector size if these keys are missing.
* (5) The discard-alignment parameter allows a physical device to be
* partitioned into virtual devices that do not necessarily begin or
* end on a discardable extent boundary.

#5 lore raw
Quoted 19 lines
Quoted 1 line
Quoted 1 line · Konrad Rzeszutek Wilk
Quoted 17 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · Konrad Rzeszutek Wilk
Quoted 15 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
xen/include/public/io/blkif.h +1 -3
@@ -323,9 +324,14 @@
  *     For full interoperability, block front and backends should publish
  *     identical ring parameters, adjusted for unit differences, to the
  *     XenStore nodes used in both schemes.
- * (4) Devices that support discard functionality may internally allocate
- *     space (discardable extents) in units that are larger than the
- *     exported logical block size.
+ * (4) Devices that support discard functionality may internally allocate 
 

space
+ * (discardable extents) in units that are larger than the exported
logical
+ * block size. If the backing device has such discardable extents the
+ * backend must provide both discard-granularity and discard-alignment.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line
                    ^^^^ - MAY

I think the intention is to say that these two should go together, i.e. specifying just one of them is a mistake.

The 'and' in that sentence covers that I think?

Not with my reading of it - when using "must", it's clear that both need to be present. When using "may", one can read it that providing just one is fine too. But I agree that the wording with "must" isn't fully correct either. I'd go for "should", and extend the sentence by "; providing just one of the two may be considered an error by the frontend".

Jan

Quoted 21 lines

My reading with 'must' is that 'features-discard' MUST have both discard-granularity and discard-alignment. But that is not the case
- even if the device does support them - it does not have to expose them.

Quoted 6 lines

Jan

Quoted 3 lines
Quoted 1 line
Quoted 1 line

+ * Backends supporting discard should include discard-granularity and

                                        ^^^^^ - MAY
Quoted 1 line
Quoted 1 line

+ * discard-alignment even if it supports discarding individual

sectors.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ * Frontends should assume discard-alignment == 0 and

discard-granularity

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

==
+ * sector size if these keys are missing.
* (5) The discard-alignment parameter allows a physical device to be
* partitioned into virtual devices that do not necessarily begin or
* end on a discardable extent boundary.

#6 lore raw
Quoted 6 lines · Jan Beulich

Not with my reading of it - when using "must", it's clear that both need to be present. When using "may", one can read it that providing just one is fine too. But I agree that the wording with "must" isn't fully correct either. I'd go for "should", and extend the sentence by "; providing just one of the two may be considered an error by the frontend".

I will make that change.

Olaf

#7 lore raw
In reply to Jan Beulich
Quoted 10 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · Olaf Hering

Also fix the name of the discard-alignment property, add the missing

'n'.

Quoted 2 lines

Konrad,

you have been working on the discard stuff quite a bit iirc - any chance you could take a look and send and ack/review?

Sure - next week I will dig through the patches.

Quoted 82 lines

Jan

Review

Quoted 5 lines
---
 xen/include/public/io/blkif.h | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/xen/include/public/io/blkif.h

xen/include/public/io/blkif.h line 176

Quoted 6 lines

index 84eb7fd..515ea90 100644

xen/include/public/io/blkif.h +0 -0
@@ -175,7 +175,7 @@
  *
  *------------------------- Backend Device Properties

-------------------------

Quoted 16 lines
xen/include/public/io/blkif.h +2 -1
  *
- * discard-aligment
+ * discard-alignment
  *      Values:         <uint32_t>
  *      Default Value:  0
  *      Notes:          4, 5
@@ -194,6 +194,7 @@
  * discard-secure
  *      Values:         0/1 (boolean)
  *      Default Value:  0
+ *      Notes:          10
  *
  *      A value of "1" indicates that the backend can process 

BLKIF_OP_DISCARD
* requests with the BLKIF_DISCARD_SECURE flag set.

xen/include/public/io/blkif.h line 324

Quoted 1 line
xen/include/public/io/blkif.h +0 -0
@@ -323,9 +324,14 @@
  *     For full interoperability, block front and backends should

publish

xen/include/public/io/blkif.h line 325

Quoted 1 line
xen/include/public/io/blkif.h +0 -0
  *     identical ring parameters, adjusted for unit differences, to

the

xen/include/public/io/blkif.h line 326

Quoted 2 lines
xen/include/public/io/blkif.h +0 -1
  *     XenStore nodes used in both schemes.
- * (4) Devices that support discard functionality may internally

allocate

xen/include/public/io/blkif.h

Quoted 3 lines
xen/include/public/io/blkif.h +1 -2
- *     space (discardable extents) in units that are larger than the
- *     exported logical block size.
+ * (4) Devices that support discard functionality may internally

allocate

Quoted 2 lines

space
+ * (discardable extents) in units that are larger than the

exported

Quoted 2 lines

logical
+ * block size. If the backing device has such discardable

extents the

Quoted 1 line

+ * backend must provide both discard-granularity and

discard-alignment.

Quoted 1 line

+ * Backends supporting discard should include

discard-granularity and

Quoted 1 line

+ * discard-alignment even if it supports discarding individual

sectors.

Quoted 1 line

+ * Frontends should assume discard-alignment == 0 and

discard-granularity

Quoted 3 lines

==
+ * sector size if these keys are missing.
* (5) The discard-alignment parameter allows a physical device to

be

Quoted 1 line

* partitioned into virtual devices that do not necessarily

begin or

xen/include/public/io/blkif.h line 350

Quoted 3 lines

* end on a discardable extent boundary.

xen/include/public/io/blkif.h +0 -0
@@ -344,6 +350,8 @@
  *     grants that can be persistently mapped in the frontend

driver, but

xen/include/public/io/blkif.h line 351

Quoted 1 line
xen/include/public/io/blkif.h +0 -0
  *     due to the frontent driver implementation it should never be

bigger

xen/include/public/io/blkif.h line 353

Quoted 2 lines
xen/include/public/io/blkif.h +1 -0
  *     than RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST.
+ *(10) The discard-secure property may be present and will be set to

1 if

Quoted 10 lines

the
+ * backing device supports secure discard.
*/

/*

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 1/1
#8 lore raw
In reply to Olaf Hering
Quoted 3 lines · Olaf Hering

Also fix the name of the discard-alignment property, add the missing 'n'.

Although I am not an authority on this interface...

Quoted 57 lines
---
 xen/include/public/io/blkif.h | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
xen/include/public/io/blkif.h +2 -2
index 84eb7fd..515ea90 100644
@@ -175,7 +175,7 @@
  *
  *------------------------- Backend Device Properties
-------------------------
  *
- * discard-aligment
+ * discard-alignment
  *      Values:         <uint32_t>
  *      Default Value:  0
  *      Notes:          4, 5
@@ -194,6 +194,7 @@
  * discard-secure
  *      Values:         0/1 (boolean)
  *      Default Value:  0
+ *      Notes:          10
  *
  *      A value of "1" indicates that the backend can process

BLKIF_OP_DISCARD
* requests with the BLKIF_DISCARD_SECURE flag set.

xen/include/public/io/blkif.h +1 -3
@@ -323,9 +324,14 @@
  *     For full interoperability, block front and backends should publish
  *     identical ring parameters, adjusted for unit differences, to the
  *     XenStore nodes used in both schemes.
- * (4) Devices that support discard functionality may internally allocate
- *     space (discardable extents) in units that are larger than the
- *     exported logical block size.
+ * (4) Devices that support discard functionality may internally allocate

space
+ * (discardable extents) in units that are larger than the exported
logical

+ *     block size. If the backing device has such discardable extents the
+ *     backend must provide both discard-granularity and discard-alignment.
+ *     Backends supporting discard should include discard-granularity and
+ *     discard-alignment even if it supports discarding individual sectors.
+ *     Frontends should assume discard-alignment == 0 and discard-granularity

==
+ * sector size if these keys are missing.
* (5) The discard-alignment parameter allows a physical device to be
* partitioned into virtual devices that do not necessarily begin or
* end on a discardable extent boundary.

xen/include/public/io/blkif.h +2 -0
@@ -344,6 +350,8 @@
  *     grants that can be persistently mapped in the frontend driver, but
  *     due to the frontent driver implementation it should never be bigger
  *     than RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST.
+ *(10) The discard-secure property may be present and will be set to 1 if the
+ *     backing device supports secure discard.
  */
 
 /*