qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v5 13/14] nbd: Implement NBD_CMD_WRITE_ZEROES on


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH v5 13/14] nbd: Implement NBD_CMD_WRITE_ZEROES on server
Date: Wed, 20 Jul 2016 12:37:09 +0800
User-agent: Mutt/1.6.1 (2016-04-27)

On Tue, 07/19 21:47, Eric Blake wrote:
> > In block/raw-posix.c:handle_aiocb_write_zeroes():
> >> #ifdef CONFIG_FALLOCATE_PUNCH_HOLE
> >>     if (s->has_discard && s->has_fallocate) {
> >>         int ret = do_fallocate(s->fd,
> >>                                FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
> >>                                aiocb->aio_offset, aiocb->aio_nbytes);
> >>         if (ret == 0) {
> >>             ret = do_fallocate(s->fd, 0, aiocb->aio_offset, 
> >> aiocb->aio_nbytes);
> 
> That is just implementation: punch a hole, BUT THEN reallocate it back,
> so that in the end, the file is still not sparse in that region.  Or am
> I reading it wrong?

Yes, you are right about this, I was confused because "qemu-img map" does not
report this allocation state after zero write. (No idea why SEEK_DATA doesn't
hit the fallocate'ed area.)

Then, when it comes to qcow2, it's a bit different: after a NO_HOLE write zero
doesn't allocate anything, it only sets the bit in cluster table. In other
words, NO_HOLE only ensures allocated clusters are not deallocated, but it
doesn't ensure the population of previously unallocated area. Is that intended?

Fam



reply via email to

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