From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uwuoy-0007ZZ-Ci for qemu-devel@nongnu.org; Wed, 10 Jul 2013 09:52:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uwuov-0005zp-Qc for qemu-devel@nongnu.org; Wed, 10 Jul 2013 09:52:40 -0400 Received: from mx.ipv6.kamp.de ([2a02:248:0:51::16]:38355 helo=mx01.kamp.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Uwuov-0005zT-7O for qemu-devel@nongnu.org; Wed, 10 Jul 2013 09:52:37 -0400 Message-ID: <51DD6722.4090107@kamp.de> Date: Wed, 10 Jul 2013 15:52:34 +0200 From: Peter Lieven MIME-Version: 1.0 References: <1372338695-411-1-git-send-email-pl@kamp.de> <1372338695-411-8-git-send-email-pl@kamp.de> <20130710101415.GI3898@dhcp-200-207.str.redhat.com> In-Reply-To: <20130710101415.GI3898@dhcp-200-207.str.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCHv2 07/11] iscsi: let bdrv_create conditionally zero out the device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: pbonzini@redhat.com, ronniesahlberg@gmail.com, qemu-devel@nongnu.org, stefanha@redhat.com Am 10.07.2013 12:14, schrieb Kevin Wolf: > Am 27.06.2013 um 15:11 hat Peter Lieven geschrieben: >> if the device supports unmapping and unmapped blocks read as >> zero ensure that the whole device is unmapped and report >> .has_zero_init = 1 in this case to speed up qemu-img convert. >> >> Signed-off-by: Peter Lieven >> --- >> block/iscsi.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- >> 1 file changed, 71 insertions(+), 1 deletion(-) >> >> diff --git a/block/iscsi.c b/block/iscsi.c >> index 92e66a6..621ca40 100644 >> --- a/block/iscsi.c >> +++ b/block/iscsi.c >> @@ -1436,7 +1436,8 @@ static int iscsi_truncate(BlockDriverState *bs, int64_t offset) >> >> static int iscsi_has_zero_init(BlockDriverState *bs) >> { >> - return 0; >> + IscsiLun *iscsilun = bs->opaque; >> + return (iscsilun->lbpu && iscsilun->lbprz) ? 1 : 0; >> } >> >> static int iscsi_create(const char *filename, QEMUOptionParameter *options) >> @@ -1446,6 +1447,7 @@ static int iscsi_create(const char *filename, QEMUOptionParameter *options) >> BlockDriverState bs; >> IscsiLun *iscsilun = NULL; >> QDict *bs_options; >> + struct scsi_task *task = NULL; >> >> memset(&bs, 0, sizeof(BlockDriverState)); >> >> @@ -1481,7 +1483,75 @@ static int iscsi_create(const char *filename, QEMUOptionParameter *options) >> } >> >> ret = 0; > Noticed something independent from your patch, a bit more context: > > if (bs.total_sectors < total_size) { > ret = -ENOSPC; > } > > ret = 0; > > The -ENOSPC case can't ever trigger, there's a 'goto out' missing. Maybe > you can include another patch too fix this in the next version of your > series? will do. the patch 7/11 itself will not be included. i was asked to make a general approach to zero out the device in qemu-img if a device has discard_zeroes. Peter