xen-blkfront: remove type check from blkfront_setup_discard
Subsystems (3)
PATCH v2 1/1 xen-blkfront: remove type check from blkfront_setup_discard
In its initial implementation a check for "type" was added, but only phy and file are handled. This breaks advertised discard support for other type values such as qdisk.
Fix and simplify this function: remove the check for "type" as the frontend is not supposed to care about this backend detail. Expect backends to provide discard-aligment, discard-granularity and discard-secure properties because interface specification in blkif.h does not list these properties as optional.
--- drivers/block/xen-blkfront.c | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-)
drivers/block/xen-blkfront.c +9 -24
@@ -1634,37 +1634,22 @@ blkfront_closing(struct blkfront_info *info)static void blkfront_setup_discard (struct blkfront_info *info) { -int err; -char *type;unsigned int discard_granularity;unsigned int discard_alignment;unsigned int discard_secure; - type =xenbus_read (XBT_NIL , info->xbdev->otherend,"type" ,NULL ); -if (IS_ERR (type)) +if (xenbus_gather (XBT_NIL , info->xbdev->otherend, +"discard-granularity" ,"%u" , &discard_granularity, +"discard-alignment" ,"%u" , &discard_alignment, +"discard-secure" ,"%u" , &discard_secure, +NULL ))return ; - info->feature_secdiscard =0 ; -if (strncmp (type,"phy" ,3 ) ==0 ) { - err =xenbus_gather (XBT_NIL , info->xbdev->otherend, -"discard-granularity" ,"%u" , &discard_granularity, -"discard-alignment" ,"%u" , &discard_alignment, -NULL ); -if (!err) { - info->feature_discard =1 ; - info->discard_granularity = discard_granularity; - info->discard_alignment = discard_alignment; - } - err =xenbus_gather (XBT_NIL , info->xbdev->otherend, -"discard-secure" ,"%d" , &discard_secure, -NULL ); -if (!err) - info->feature_secdiscard = discard_secure; - - }else if (strncmp (type,"file" ,4 ) ==0 ) - info->feature_discard =1 ; + info->discard_granularity = discard_granularity; + info->discard_alignment = discard_alignment; + info->feature_secdiscard = !!discard_secure; -kfree (type); + info->feature_discard =1 ; }static int blkfront_setup_indirect (struct blkfront_info *info)
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
drivers/block/xen-blkfront.c +0
-2@@ -1634,37 +1634,22 @@ blkfront_closing(struct blkfront_info *info)static void blkfront_setup_discard (struct blkfront_info *info) { -int err; -char *type;unsigned int discard_granularity;unsigned int discard_alignment;
drivers/block/xen-blkfront.c blkfront_closing(struct blkfront_info *info) · line 1646
Quoted 10 lines
drivers/block/xen-blkfront.c +5
-2unsigned int discard_secure; - type =xenbus_read (XBT_NIL , info->xbdev->otherend,"type" ,NULL ); -if (IS_ERR (type)) +if (xenbus_gather (XBT_NIL , info->xbdev->otherend, +"discard-granularity" ,"%u" , &discard_granularity, +"discard-alignment" ,"%u" , &discard_alignment, +"discard-secure" ,"%u" , &discard_secure, +NULL ))return ;
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (xenbus_gather() fails on the first absent value).
Jan
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
drivers/block/xen-blkfront.c +0
-2@@ -1634,37 +1634,22 @@ blkfront_closing(struct blkfront_info *info)static void blkfront_setup_discard (struct blkfront_info *info) { -int err; -char *type;unsigned int discard_granularity;unsigned int discard_alignment;
drivers/block/xen-blkfront.c blkfront_closing(struct blkfront_info *info) · line 1646
Quoted 10 lines
drivers/block/xen-blkfront.c +5
-2unsigned int discard_secure; - type =xenbus_read (XBT_NIL , info->xbdev->otherend,"type" ,NULL ); -if (IS_ERR (type)) +if (xenbus_gather (XBT_NIL , info->xbdev->otherend, +"discard-granularity" ,"%u" , &discard_granularity, +"discard-alignment" ,"%u" , &discard_alignment, +"discard-secure" ,"%u" , &discard_secure, +NULL ))return ;
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (xenbus_gather() fails on the first absent value).
Jan
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).
Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then blkif.h should be updated to say that.
Olaf
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).
Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then blkif.h should be updated to say that.
Olaf
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.
They _are_ optional.
Jan
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.
They _are_ optional.
Jan
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).
Quoted 5 lines
Quoted 3 lines
Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.They _are_ optional.
In this case my first patch is correct and should be used.
Olaf
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).
Quoted 5 lines
Quoted 3 lines
Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.They _are_ optional.
In this case my first patch is correct and should be used.
Olaf
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).
Quoted 5 lines
Quoted 3 lines
Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.They _are_ optional.
But is it true that either they are all present or they are all absent?
Ian.
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).
Quoted 5 lines
Quoted 3 lines
Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.They _are_ optional.
But is it true that either they are all present or they are all absent?
Ian.
Quoted 10 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.They _are_ optional.
But is it true that either they are all present or they are all absent?
No, it's not. discard-secure is independent of the other two (but those other two are tied together).
Jan
Quoted 10 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.They _are_ optional.
But is it true that either they are all present or they are all absent?
No, it's not. discard-secure is independent of the other two (but those other two are tied together).
Jan
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 12 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
They _are_ optional.
But is it true that either they are all present or they are all absent?
No, it's not. discard-secure is independent of the other two (but those other two are tied together).
Thanks for clarifying.
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 12 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
They _are_ optional.
But is it true that either they are all present or they are all absent?
No, it's not. discard-secure is independent of the other two (but those other two are tied together).
Thanks for clarifying.
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 12 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
They _are_ optional.
But is it true that either they are all present or they are all absent?
No, it's not. discard-secure is independent of the other two (but those other two are tied together).
Can we have a patch to blkif.h that clarifies this?
e.g.,
feature-discard
...
discard-granularity and discard-offset must also be present if feature-discard is enabled
discard-secure may also be present if feature-discard is enabled.
David
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 12 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
They _are_ optional.
But is it true that either they are all present or they are all absent?
No, it's not. discard-secure is independent of the other two (but those other two are tied together).
Can we have a patch to blkif.h that clarifies this?
e.g.,
feature-discard
...
discard-granularity and discard-offset must also be present if feature-discard is enabled
discard-secure may also be present if feature-discard is enabled.
David
Quoted 25 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 12 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.Quoted 6 lines
Quoted 3 lines
Quoted 1 line
They _are_ optional.
But is it true that either they are all present or they are all absent?
No, it's not. discard-secure is independent of the other two (but those other two are tied together).
Can we have a patch to
blkif.hthat clarifies this?
Quoted 8 lines
e.g.,
feature-discard
...
discard-granularity and discard-offset must also be present if feature-discard is enabled
It would be "may" here too afaict. But I'll defer to Konrad, who has done more work in this area...
Jan
Quoted 3 lines
discard-secure may also be present if feature-discard is enabled.
David
Quoted 25 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 12 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 4 lines · Jan Beulich
You can't do this in one go - the first two and the last one may be set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).Yes, thats the purpose. Since the properties are required its an all or nothing thing. If they are truly optional then
blkif.hshould be updated to say that.Quoted 6 lines
Quoted 3 lines
Quoted 1 line
They _are_ optional.
But is it true that either they are all present or they are all absent?
No, it's not. discard-secure is independent of the other two (but those other two are tied together).
Can we have a patch to
blkif.hthat clarifies this?
Quoted 8 lines
e.g.,
feature-discard
...
discard-granularity and discard-offset must also be present if feature-discard is enabled
It would be "may" here too afaict. But I'll defer to Konrad, who has done more work in this area...
Jan
Quoted 3 lines
discard-secure may also be present if feature-discard is enabled.
David
Quoted 51 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 1 line · Jan Beulich
Quoted 1 line
Quoted 1 line
Quoted 1 line
On 13.01.14 at 14:00, Ian Campbell <[email protected]>
Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines · Jan Beulich
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 1 line · Jan Beulich
You can't do this in one go - the first two and the last one may
be
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).Yes, thats the purpose. Since the properties are required its an
all or
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
nothing thing. If they are truly optional then
blkif.hshould beupdated
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
to say that.
They _are_ optional.
But is it true that either they are all present or they are all
absent?
Quoted 6 lines
Quoted 3 lines
No, it's not. discard-secure is independent of the other two (but those other two are tied together).
Can we have a patch to
blkif.hthat clarifies this?Quoted 8 lines
e.g.,
feature-discard
...
discard-granularity and discard-offset must also be present if feature-discard is enabled
It would be "may" here too afaict. But I'll defer to Konrad, who has done more work in this area...
Jan
Quoted 3 lines
discard-secure may also be present if feature-discard is enabled.
David
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
It is all 'may'. If there is just 'feature-discard' without any other options that is OK.
Quoted 51 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 1 line · Jan Beulich
Quoted 1 line
Quoted 1 line
Quoted 1 line
On 13.01.14 at 14:00, Ian Campbell <[email protected]>
Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines · Jan Beulich
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
Quoted 1 line · Jan Beulich
You can't do this in one go - the first two and the last one may
be
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
set independently (and are independent in their meaning), and hence need to be queried independently (
xenbus_gather()fails on the first absent value).Yes, thats the purpose. Since the properties are required its an
all or
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
nothing thing. If they are truly optional then
blkif.hshould beupdated
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
to say that.
They _are_ optional.
But is it true that either they are all present or they are all
absent?
Quoted 6 lines
Quoted 3 lines
No, it's not. discard-secure is independent of the other two (but those other two are tied together).
Can we have a patch to
blkif.hthat clarifies this?Quoted 8 lines
e.g.,
feature-discard
...
discard-granularity and discard-offset must also be present if feature-discard is enabled
It would be "may" here too afaict. But I'll defer to Konrad, who has done more work in this area...
Jan
Quoted 3 lines
discard-secure may also be present if feature-discard is enabled.
David
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
It is all 'may'. If there is just 'feature-discard' without any other options that is OK.
Quoted 1 line · David Vrabel
Can we have a patch to
blkif.hthat clarifies this?
What about this change?
xen/include/public/io/blkif.h +7 -3
@@ -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,10 @@* 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. The properties discard-granularity and discard-alignment may +* be present if the backing device has such requirments. * (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 +346,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. */ /*
Olaf
Quoted 1 line · David Vrabel
Can we have a patch to
blkif.hthat clarifies this?
What about this change?
xen/include/public/io/blkif.h +7 -3
@@ -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,10 @@* 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. The properties discard-granularity and discard-alignment may +* be present if the backing device has such requirments. * (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 +346,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. */ /*
Olaf
Quoted 19 lines · Olaf Hering
Quoted 1 line · David Vrabel
Can we have a patch to
blkif.hthat clarifies this?What about this change?
xen/include/public/io/blkif.h +1
-0@@ -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 330
Quoted 10 lines
xen/include/public/io/blkif.h +4
-3@@ -323,9 +324,10 @@* 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. The properties discard-granularity and discard-alignment may +* be present if the backing device has such requirments.
Clarify that both discard-granularity and discard-alignment must be present if non-sector-sized granularity is required. e.g.,
"If the backing device has such discardable extents the backend must provide both discard-granularity and discard-alignment."
You find it useful to add these recommendations:
"Backends supporting discard should include discard-granularity and discard-alignment even if it supports discarding individual sectors. Frontends should assume discard-aligment == 0 and discard-granularity == sector size if these keys are missing."
xen/include/public/io/blkif.h line 351
Quoted 10 lines
xen/include/public/io/blkif.h +2
-0* (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 +346,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. */
David
Quoted 19 lines · Olaf Hering
Quoted 1 line · David Vrabel
Can we have a patch to
blkif.hthat clarifies this?What about this change?
xen/include/public/io/blkif.h +1
-0@@ -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 330
Quoted 10 lines
xen/include/public/io/blkif.h +4
-3@@ -323,9 +324,10 @@* 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. The properties discard-granularity and discard-alignment may +* be present if the backing device has such requirments.
Clarify that both discard-granularity and discard-alignment must be present if non-sector-sized granularity is required. e.g.,
"If the backing device has such discardable extents the backend must provide both discard-granularity and discard-alignment."
You find it useful to add these recommendations:
"Backends supporting discard should include discard-granularity and discard-alignment even if it supports discarding individual sectors. Frontends should assume discard-aligment == 0 and discard-granularity == sector size if these keys are missing."
xen/include/public/io/blkif.h line 351
Quoted 10 lines
xen/include/public/io/blkif.h +2
-0* (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 +346,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. */
David