Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-26 Thread Paolo Bonzini
On 24/09/2016 14:27, Vladimir Sementsov-Ogievskiy wrote: > On 24.09.2016 15:06, Vladimir Sementsov-Ogievskiy wrote: >> On 24.09.2016 00:21, Wouter Verhelst wrote: >>> On Fri, Sep 23, 2016 at 02:00:06PM -0500, Eric Blake wrote: My preference would be a new flag to the existing commands, with

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-26 Thread Kevin Wolf
Am 24.09.2016 um 14:27 hat Vladimir Sementsov-Ogievskiy geschrieben: > On 24.09.2016 15:06, Vladimir Sementsov-Ogievskiy wrote: > >On 24.09.2016 00:21, Wouter Verhelst wrote: > >>On Fri, Sep 23, 2016 at 02:00:06PM -0500, Eric Blake wrote: > >>>My preference would be a new flag to the existing

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Wouter Verhelst
On Sat, Sep 24, 2016 at 11:19:53PM +0300, Vladimir Sementsov-Ogievskiy wrote: > On 24.09.2016 21:24, Alex Bligh wrote: > > > On 24 Sep 2016, at 18:47, Vladimir Sementsov-Ogievskiy > > > wrote: > > > > > > I just wanted to say, that if we want a possibility of clearing

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Vladimir Sementsov-Ogievskiy
On 24.09.2016 21:24, Alex Bligh wrote: On 24 Sep 2016, at 18:47, Vladimir Sementsov-Ogievskiy wrote: I just wanted to say, that if we want a possibility of clearing the whole disk in one request for qcow2 we have to take 512 as granularity for such requests (with X

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Alex Bligh
> On 24 Sep 2016, at 18:47, Vladimir Sementsov-Ogievskiy > wrote: > > I just wanted to say, that if we want a possibility of clearing the whole > disk in one request for qcow2 we have to take 512 as granularity for such > requests (with X = 9). An this is too small.

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Vladimir Sementsov-Ogievskiy
On 24.09.2016 20:32, Alex Bligh wrote: On 24 Sep 2016, at 18:13, Vladimir Sementsov-Ogievskiy wrote: On 24.09.2016 19:49, Alex Bligh wrote: On 24 Sep 2016, at 17:42, Vladimir Sementsov-Ogievskiy wrote: On 24.09.2016 19:31, Alex Bligh

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Alex Bligh
> On 24 Sep 2016, at 18:13, Vladimir Sementsov-Ogievskiy > wrote: > > On 24.09.2016 19:49, Alex Bligh wrote: >>> On 24 Sep 2016, at 17:42, Vladimir Sementsov-Ogievskiy >>> wrote: >>> >>> On 24.09.2016 19:31, Alex Bligh wrote: > On 24

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Vladimir Sementsov-Ogievskiy
On 24.09.2016 20:13, Vladimir Sementsov-Ogievskiy wrote: On 24.09.2016 19:49, Alex Bligh wrote: On 24 Sep 2016, at 17:42, Vladimir Sementsov-Ogievskiy wrote: On 24.09.2016 19:31, Alex Bligh wrote: On 24 Sep 2016, at 13:06, Vladimir Sementsov-Ogievskiy

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Vladimir Sementsov-Ogievskiy
On 24.09.2016 19:49, Alex Bligh wrote: On 24 Sep 2016, at 17:42, Vladimir Sementsov-Ogievskiy wrote: On 24.09.2016 19:31, Alex Bligh wrote: On 24 Sep 2016, at 13:06, Vladimir Sementsov-Ogievskiy wrote: Note: if disk size is not aligned

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Alex Bligh
> On 24 Sep 2016, at 17:52, Alex Bligh wrote: > > In *your* use-case holes may be desirable. However in the general case, you > cannot assume a server supports holes. Optional support for holes isn't even > in the mainline spec yet (AFAIR). You should also be aware that the

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Alex Bligh
> On 24 Sep 2016, at 17:48, Vladimir Sementsov-Ogievskiy > wrote: > >>> Use NBD_CMD_WRITE_ZEROES without NBD_CMD_FLAG_NO_HOLE and you can pretty >>> much assume that a server that supports holes will write holes. A server >>> that does not support holes will write

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Alex Bligh
> On 24 Sep 2016, at 17:42, Vladimir Sementsov-Ogievskiy > wrote: > > On 24.09.2016 19:31, Alex Bligh wrote: >>> On 24 Sep 2016, at 13:06, Vladimir Sementsov-Ogievskiy >>> wrote: >>> >>> Note: if disk size is not aligned to X we will have

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Vladimir Sementsov-Ogievskiy
On 24.09.2016 19:44, Vladimir Sementsov-Ogievskiy wrote: On 24.09.2016 19:35, Alex Bligh wrote: On 24 Sep 2016, at 17:20, Vladimir Sementsov-Ogievskiy wrote: Also, accordingly to documentation, NBD_CMD_TRIM is not appropriate for disk clearing: * `NBD_CMD_TRIM`

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Vladimir Sementsov-Ogievskiy
On 24.09.2016 19:35, Alex Bligh wrote: On 24 Sep 2016, at 17:20, Vladimir Sementsov-Ogievskiy wrote: Also, accordingly to documentation, NBD_CMD_TRIM is not appropriate for disk clearing: * `NBD_CMD_TRIM` (4) A hint to the server that the data defined by

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Vladimir Sementsov-Ogievskiy
On 24.09.2016 19:31, Alex Bligh wrote: On 24 Sep 2016, at 13:06, Vladimir Sementsov-Ogievskiy wrote: Note: if disk size is not aligned to X we will have to send request larger than the disk size to clear the whole disk. If you look at the block size extension, the

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Alex Bligh
> On 24 Sep 2016, at 17:20, Vladimir Sementsov-Ogievskiy > wrote: > > Also, accordingly to documentation, NBD_CMD_TRIM is not appropriate for disk > clearing: > > * `NBD_CMD_TRIM` (4) > > A hint to the server that the data defined by len and offset is no >

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Alex Bligh
> On 24 Sep 2016, at 13:06, Vladimir Sementsov-Ogievskiy > wrote: > > Note: if disk size is not aligned to X we will have to send request larger > than the disk size to clear the whole disk. If you look at the block size extension, the size of the disk must be an

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Denis V. Lunev
On 09/24/2016 12:21 AM, Wouter Verhelst wrote: > On Fri, Sep 23, 2016 at 02:00:06PM -0500, Eric Blake wrote: >> My preference would be a new flag to the existing commands, with >> explicit documentation that 0 offset and 0 length must be used with that >> flag, when requesting a full-device wipe.

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Vladimir Sementsov-Ogievskiy
On 24.09.2016 16:42, Vladimir Sementsov-Ogievskiy wrote: On 24.09.2016 15:06, Vladimir Sementsov-Ogievskiy wrote: On 24.09.2016 00:21, Wouter Verhelst wrote: On Fri, Sep 23, 2016 at 02:00:06PM -0500, Eric Blake wrote: My preference would be a new flag to the existing commands, with explicit

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Vladimir Sementsov-Ogievskiy
On 24.09.2016 15:06, Vladimir Sementsov-Ogievskiy wrote: On 24.09.2016 00:21, Wouter Verhelst wrote: On Fri, Sep 23, 2016 at 02:00:06PM -0500, Eric Blake wrote: My preference would be a new flag to the existing commands, with explicit documentation that 0 offset and 0 length must be used with

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Vladimir Sementsov-Ogievskiy
On 24.09.2016 15:06, Vladimir Sementsov-Ogievskiy wrote: On 24.09.2016 00:21, Wouter Verhelst wrote: On Fri, Sep 23, 2016 at 02:00:06PM -0500, Eric Blake wrote: My preference would be a new flag to the existing commands, with explicit documentation that 0 offset and 0 length must be used with

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-24 Thread Vladimir Sementsov-Ogievskiy
On 24.09.2016 00:21, Wouter Verhelst wrote: On Fri, Sep 23, 2016 at 02:00:06PM -0500, Eric Blake wrote: My preference would be a new flag to the existing commands, with explicit documentation that 0 offset and 0 length must be used with that flag, when requesting a full-device wipe.

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-23 Thread Wouter Verhelst
On Fri, Sep 23, 2016 at 02:00:06PM -0500, Eric Blake wrote: > My preference would be a new flag to the existing commands, with > explicit documentation that 0 offset and 0 length must be used with that > flag, when requesting a full-device wipe. Alternatively, what about a flag that says "if you

Re: [Qemu-block] write_zeroes/trim on the whole disk

2016-09-23 Thread Eric Blake
On 09/23/2016 01:32 PM, Vladimir Sementsov-Ogievskiy wrote: > Hi all! > > There is a following problem. When we need to write_zeroes or trim the > whole disk, we have to do it iteratively, because of 32-bit restriction > on request length. > For example, current implementation of mirror (see

[Qemu-block] write_zeroes/trim on the whole disk

2016-09-23 Thread Vladimir Sementsov-Ogievskiy
Hi all! There is a following problem. When we need to write_zeroes or trim the whole disk, we have to do it iteratively, because of 32-bit restriction on request length. For example, current implementation of mirror (see mirror_dirty_init()) do this by chunks of 2147418112 bytes (with default