Re: [Qemu-devel] 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-devel] 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 comma

Re: [Qemu-devel] 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 the whole > > > disk in on

Re: [Qemu-devel] 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 = 9). An this is too small

Re: [Qemu-devel] 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. 1tb will be the upper boun

Re: [Qemu-devel] 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 wrote: On 24 Sep 2016, at 13:06, Vladimir Sementsov-Ogi

Re: [Qemu-devel] 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 Sep 2016, at 13:06, Vladimir Sementsov-Ogievskiy

Re: [Qemu-devel] 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 wrote: Note: if disk size is not alig

Re: [Qemu-devel] 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 to X we will have to send request larger than the dis

Re: [Qemu-devel] 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 minimum granularit

Re: [Qemu-devel] 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 zeroes. If you don't care wh

Re: [Qemu-devel] 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 to send request larger >>> than the disk size to cle

Re: [Qemu-devel] 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` (4) A hint to the s

Re: [Qemu-devel] 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 len and offset is no l

Re: [Qemu-devel] 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 size of the disk must be an

Re: [Qemu-devel] 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 > longer needed. A server

Re: [Qemu-devel] 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-devel] 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 exact multiple of the minimu

Re: [Qemu-devel] 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 do

Re: [Qemu-devel] 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-devel] 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-devel] 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. Alternative

Re: [Qemu-devel] 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 u

Re: [Qemu-devel] 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 mirro

[Qemu-devel] 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