aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-06-23 16:37:18 -0600
committerKevin Wolf <kwolf@redhat.com>2016-07-05 16:46:25 +0200
commit79ba8c986adb9ca07f52abd0b3d33c3aee8e6ff9 (patch)
treeb5dc1abc3917a06033dca8b2bf9e8e9c3c370210 /block
parenta65064816d64db463f4c24bd81dcaad62fee89eb (diff)
block: Set default request_alignment during bdrv_refresh_limits()
We want to eventually stick request_alignment alongside other BlockLimits, but first, we must ensure it is populated at the same time as all other limits, rather than being a special case that is set only when a block is first opened. Now that all drivers have been updated to supply an override of request_alignment during their .bdrv_refresh_limits(), as needed, the block layer itself can defer setting the default alignment until part of the overall bdrv_refresh_limits(). Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/io.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/io.c b/block/io.c
index 82c9ff0a04..323e822dd4 100644
--- a/block/io.c
+++ b/block/io.c
@@ -78,6 +78,9 @@ void bdrv_refresh_limits(BlockDriverState *bs, Error **errp)
return;
}
+ /* Default alignment based on whether driver has byte interface */
+ bs->request_alignment = drv->bdrv_co_preadv ? 1 : 512;
+
/* Take some limits from the children as a default */
if (bs->file) {
bdrv_refresh_limits(bs->file->bs, &local_err);