[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen-block: scale sector based quantities correctly



On Wed, Mar 20, 2019 at 04:26:32PM +0000, Paul Durrant wrote:
> The mail thread at [1] clarifies that the Xen blkif protocol requires that
> sector based quantities should be interpreted strictly as multiples of
> 512 bytes. This patch modifies the xen-block code accordingly.
> 
> [1] https://lists.xenproject.org/archives/html/xen-devel/2019-03/msg01600.html

So, that patch [1] only makes one change: how to interpret the "sectors"
node. It doesn't change the unit of a sector in blkif_request and
blkif_request_segment.

For a request, there is a comment in blkif.h:
    NB. first_sect and last_sect in blkif_request_segment, as well as
    sector_number in blkif_request, are always expressed in 512-byte units.

I think most of this QEMU patch is to comply with that comment and would
be a bug fix, but the single line change in hw/block/xen-block.c is
different.

> diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
> index a848849f48..57e9da7e1c 100644
> --- a/hw/block/xen-block.c
> +++ b/hw/block/xen-block.c
> @@ -149,7 +149,7 @@ static void xen_block_set_size(XenBlockDevice *blockdev)
>      const char *type = object_get_typename(OBJECT(blockdev));
>      XenBlockVdev *vdev = &blockdev->props.vdev;
>      BlockConf *conf = &blockdev->props.conf;
> -    int64_t sectors = blk_getlength(conf->blk) / conf->logical_block_size;
> +    int64_t sectors = blk_getlength(conf->blk) / XEN_BLKIF_SECTOR_SIZE;

That the only thing that the thread [1] is changing.

>      XenDevice *xendev = XEN_DEVICE(blockdev);
>  
>      trace_xen_block_size(type, vdev->disk, vdev->partition, sectors);

Thanks,

-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.