From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpWFI-0003bB-49 for qemu-devel@nongnu.org; Thu, 29 Sep 2016 03:59:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpWFG-0004yh-Am for qemu-devel@nongnu.org; Thu, 29 Sep 2016 03:59:07 -0400 Sender: Paolo Bonzini References: <1475046261-15679-1-git-send-email-famz@redhat.com> <20160929022147.GB6412@lemon> From: Paolo Bonzini Message-ID: Date: Thu, 29 Sep 2016 09:58:56 +0200 MIME-Version: 1.0 In-Reply-To: <20160929022147.GB6412@lemon> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qcow2: Support BDRV_REQ_MAY_UNMAP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , Max Reitz Cc: Kevin Wolf , qemu-devel@nongnu.org, qemu-block@nongnu.org On 29/09/2016 04:21, Fam Zheng wrote: > On Wed, 09/28 18:11, Max Reitz wrote: >> Note that BDRV_REQ_MAY_UNMAP does not mean "Yes, please discard" but >> just "You may discard if it's easier for you". But it's actually not >> easier for us, so I don't see why we're doing it. >> >> As far as I can guess you actually want some way to tell a block driver >> to actually make an effort to discard clusters as long they then read >> back as zero (which is why you cannot simply use bdrv_pdiscard()). >> However, I think this would require a new flag called >> BDRV_REQ_SHOULD_UNMAP (which should imply BDRV_REQ_MAY_UNMAP). > > This flag doesn't make sense to me, if the protocol doesn't know how to unmap, > it can ignore BDRV_REQ_MAY_UNMAP, but not BDRV_REQ_SHOULD_UNMAP. It just > complicates things a little. I don't think we actually have a use for a "MAY" unmap flag. Either we keep the not-so-perfect name or we replace MAY_UNMAP with "should" or "want" or "would_like" unmap... But Fam's patch does do what was intended for the flag (which is the equivalent of the UNMAP bit in the SCSI WRITE SAME command). Paolo