summaryrefslogtreecommitdiffstats
path: root/drivers/block/xen-blkback/xenbus.c
diff options
context:
space:
mode:
authorStefan Bader2013-05-13 16:28:15 +0200
committerKonrad Rzeszutek Wilk2013-06-07 23:05:53 +0200
commit7c4d7d710f7eb499ec483f25acc28b53adaa3260 (patch)
tree4ad0e3765e0f1f0f00f1782f264565e0e02e4666 /drivers/block/xen-blkback/xenbus.c
parentxen-blkback/sysfs: Move the parameters for the persistent grant features (diff)
downloadkernel-qcow2-linux-7c4d7d710f7eb499ec483f25acc28b53adaa3260.tar.gz
kernel-qcow2-linux-7c4d7d710f7eb499ec483f25acc28b53adaa3260.tar.xz
kernel-qcow2-linux-7c4d7d710f7eb499ec483f25acc28b53adaa3260.zip
xen/blkback: Use physical sector size for setup
Currently xen-blkback passes the logical sector size over xenbus and xen-blkfront sets up the paravirt disk with that logical block size. But newer drives usually have the logical sector size set to 512 for compatibility reasons and would show the actual sector size only in physical sector size. This results in the device being partitioned and accessed in dom0 with the correct sector size, but the guest thinks 512 bytes is the correct block size. And that results in poor performance. To fix this, blkback gets modified to pass also physical-sector-size over xenbus and blkfront to use both values to set up the paravirt disk. I did not just change the passed in sector-size because I am not sure having a bigger logical sector size than the physical one is valid (and that would happen if a newer dom0 kernel hits an older domU kernel). Also this way a domU set up before should still be accessible (just some tools might detect the unaligned setup). [v2: Make xenbus write failure non-fatal] [v3: Use xenbus_scanf instead of xenbus_gather] [v4: Rebased against segment changes] Signed-off-by: Stefan Bader <stefan.bader@canonical.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/block/xen-blkback/xenbus.c')
-rw-r--r--drivers/block/xen-blkback/xenbus.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 4a4749c78942..7b06f943371c 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -782,6 +782,11 @@ again:
dev->nodename);
goto abort;
}
+ err = xenbus_printf(xbt, dev->nodename, "physical-sector-size", "%u",
+ bdev_physical_block_size(be->blkif->vbd.bdev));
+ if (err)
+ xenbus_dev_error(dev, err, "writing %s/physical-sector-size",
+ dev->nodename);
err = xenbus_transaction_end(xbt, 0);
if (err == -EAGAIN)