qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCHv2 07/11] iscsi: let bdrv_create conditionally ze


From: Peter Lieven
Subject: Re: [Qemu-devel] [PATCHv2 07/11] iscsi: let bdrv_create conditionally zero out the device
Date: Wed, 10 Jul 2013 15:52:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0

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 <address@hidden>
>> ---
>>  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



reply via email to

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