qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] NBD structured reads vs. block size


From: Eric Blake
Subject: Re: [Qemu-block] NBD structured reads vs. block size
Date: Wed, 1 Aug 2018 09:40:44 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 08/01/2018 09:13 AM, Richard W.M. Jones wrote:
On Wed, Aug 01, 2018 at 04:49:21PM +0300, Nir Soffer wrote:
All this is an issue only when the underlying file is a file using raw
format, right?

It's an issue for any setup where the server and client disagree on the minimum block size, and where the file size is not aligned to one (or both) of the two endpoints' notion of minimum block size.


NBD should only really be used to send raw format data over the wire.
While it is possible to serve a qcow2 file over NBD as qcow2, it's not
really how NBD is intended to be used.

Well, if I ever get time to implement my proposed NBD_CMD_RESIZE support, then exporting qcow2 over NBD as qcow2 will be a lot more feasible than it currently is, but that's a side discussion.


Since NBD is meant for block devices, and block devices cannot have
partial blocks, would it be simpler to round down unaligned file size,  and
treat possible unaligned range at the end of the file as area that can not
be accessed via NBD?

NBD is not just for block devices, but yes, block devices are much less likely to have a reported size that is not aligned to the minimum block size. So yes, the issue I'm describing (and in particular, qemu's bug of splitting NBD_CMD_READ and NBD_CMD_BLOCK_STATUS on non-sector boundaries) tends to occur mainly when using unaligned files, and not block devices, as the basis of the export that the NBD server is exposing.


For nbdkit I would like to preserve the ability to serve arbitrary-
sized files.  nbdkit allows people to write plugins, and we cannot be
sure that every plugin everyone writes will always use sensible block
sizes.

In a forthcoming nbdkit release you can add the "truncate" filter on
top of any plugin to round up the size to a multiple of any power of 2
(or round down if you really want).

https://www.redhat.com/archives/libguestfs/2018-August/msg00006.html

Rich.


--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]