xen-block: fix reporting of discard feature

Linux blkfront expects both "discard-granularity" and
"discard-alignment" present on xenbus in order to properly enable the
feature, not exposing "discard-alignment" left some Linux blkfront
versions with a broken discard setup. This has also been addressed in
Linux with:

https://lore.kernel.org/lkml/20210118151528.81668-1-roger.pau@citrix.com/T/#u

Fix QEMU to report a "discard-alignment" of 0, in order for it to work
with older Linux frontends.

Reported-by: Arthur Borsboom <arthurborsboom@gmail.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Message-Id: <20210118153330.82324-1-roger.pau@citrix.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Roger Pau Monne 2021-01-18 16:33:30 +01:00 committed by Kevin Wolf
parent 26941eb4ca
commit 7f22201ac8
1 changed files with 1 additions and 0 deletions

View File

@ -253,6 +253,7 @@ static void xen_block_realize(XenDevice *xendev, Error **errp)
xen_device_backend_printf(xendev, "feature-discard", "%u", 1);
xen_device_backend_printf(xendev, "discard-granularity", "%u",
conf->discard_granularity);
xen_device_backend_printf(xendev, "discard-alignment", "%u", 0);
}
xen_device_backend_printf(xendev, "feature-flush-cache", "%u", 1);