xen-block: only advertize discard to the frontend when it is enabled...
A message that is not in the archive (sent off-list or not yet received): [email protected]
Anthony PERARD
Reviewed-byQuoted 5 lines · Paul Durrant
...and properly enable it when synthesizing a drive.
The Xen toolstack sets 'discard-enable' to '1' in xenstore when it wants to enable discard on a specified image. The code in
xen_block_driver_create()correctly parses this and uses it to set
typo: It's xen_block_drive_create (s/driver/drive/), otherwise my IDE can't find it :-(.
Quoted 1 line
'discard' to 'unamp' for the
file_layer, but fails to do the same for the
Looks like s/unamp/unmap/
Quoted 3 lines
driver_layer(which effectively disables it). Meanwhile the code inxen_block_realize()advertizes discard support to the frontend in the default case (becauseconf->discard_granularitydefaults to -1), even when
That doesn't match the code I'm reading, before the patch apply.
if (discard_granularity > 0) feature-discard=1
Nothing seems to set discard_granularity, so it keeps it's default to -1, so .... wait, discard_granularity is unsigned :-(
The description is fine then.
Quoted 9 lines
the underlying image may not handle it.
This patch adds the missing option to the
driver_layerinxen_block_driver_create()and checks whetherBDRV_O_UNMAPis actually set on the block device before advertizing discard to the frontend. In the case that discard is supported it also makes sure that the granularity is set to the physical block size.Signed-off-by Paul Durrant <[email protected]>
With the two typos fixed (which I can try to remember to do on commit):
Thanks,
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines
-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: 21 March 2019 11:42
To: Paul Durrant <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Stefano Stabellini <[email protected]>; Kevin Wolf <[email protected]>; Max Reitz <[email protected]>
Subject: Re: [PATCH] xen-block: only advertize discard to the frontend when it is enabled...On Wed, Mar 20, 2019 at 02:28:25PM +0000, Paul Durrant wrote:
Quoted 8 lines
Quoted 5 lines
...and properly enable it when synthesizing a drive.
The Xen toolstack sets 'discard-enable' to '1' in xenstore when it wants to enable discard on a specified image. The code in
xen_block_driver_create()correctly parses this and uses it to settypo: It's
xen_block_drive_create(s/driver/drive/), otherwise my IDE can't find it :-(.
Sorry, my fingers are so used to typing 'driver'
Quoted 4 lines
Quoted 2 lines
'discard' to 'unamp' for the
file_layer, but fails to do the same for theLooks like s/unamp/unmap/
Yes.
Quoted 11 lines
Quoted 4 lines
driver_layer(which effectively disables it). Meanwhile the code inxen_block_realize()advertizes discard support to the frontend in the default case (becauseconf->discard_granularitydefaults to -1), even whenThat doesn't match the code I'm reading, before the patch apply.
if (discard_granularity> 0) feature-discard=1
Nothing seems to setdiscard_granularity, so it keeps it's default to -1, so .... wait,discard_granularityis unsigned :-(The description is fine then.
Indeed.
Quoted 9 lines
Quoted 9 lines
the underlying image may not handle it.
This patch adds the missing option to the
driver_layerinxen_block_driver_create()and checks whetherBDRV_O_UNMAPis actually set on the block device before advertizing discard to the frontend. In the case that discard is supported it also makes sure that the granularity is set to the physical block size.
Quoted 4 lines
Quoted 1 line
Signed-off-by Paul Durrant <[email protected]>With the two typos fixed (which I can try to remember to do on commit):
Reviewed-by Anthony PERARD <[email protected]>
Ok, thanks.
Paul
Quoted 5 lines
Thanks,
--
Anthony PERARD
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel