diff options
author | Paul Durrant <paul.durrant@citrix.com> | 2017-06-21 08:52:47 -0400 |
---|---|---|
committer | Stefano Stabellini <sstabellini@kernel.org> | 2017-06-27 15:01:49 -0700 |
commit | 976eba1c88420c08977eae912628d443c4aacb0c (patch) | |
tree | 23f6c4800cebe77ff64172d935efb8a155e5c1d0 /hw | |
parent | b0ac694fdb9113b973048ebe5619927e74965f61 (diff) |
xen-disk: only advertize feature-persistent if grant copy is not available
If grant copy is available then it will always be used in preference to
persistent maps. In this case feature-persistent should not be advertized
to the frontend, otherwise it may needlessly copy data into persistently
granted buffers.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/block/xen_disk.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 9200511c88..8218741541 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -1022,11 +1022,18 @@ static int blk_init(struct XenDevice *xendev) blkdev->file_blk = BLOCK_SIZE; + blkdev->feature_grant_copy = + (xengnttab_grant_copy(blkdev->xendev.gnttabdev, 0, NULL) == 0); + + xen_pv_printf(&blkdev->xendev, 3, "grant copy operation %s\n", + blkdev->feature_grant_copy ? "enabled" : "disabled"); + /* fill info * blk_connect supplies sector-size and sectors */ xenstore_write_be_int(&blkdev->xendev, "feature-flush-cache", 1); - xenstore_write_be_int(&blkdev->xendev, "feature-persistent", 1); + xenstore_write_be_int(&blkdev->xendev, "feature-persistent", + !blkdev->feature_grant_copy); xenstore_write_be_int(&blkdev->xendev, "info", info); blk_parse_discard(blkdev); @@ -1201,12 +1208,6 @@ static int blk_connect(struct XenDevice *xendev) xen_be_bind_evtchn(&blkdev->xendev); - blkdev->feature_grant_copy = - (xengnttab_grant_copy(blkdev->xendev.gnttabdev, 0, NULL) == 0); - - xen_pv_printf(&blkdev->xendev, 3, "grant copy operation %s\n", - blkdev->feature_grant_copy ? "enabled" : "disabled"); - xen_pv_printf(&blkdev->xendev, 1, "ok: proto %s, ring-ref %d, " "remote port %d, local port %d\n", blkdev->xendev.protocol, blkdev->ring_ref, |