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 <p...@kamp.de> > --- > 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? Kevin