[libvirt] [PATCH 3/3] storage: Clean up volume wiping

Martin Kletzander mkletzan at redhat.com
Mon Aug 1 16:10:00 UTC 2016


On Mon, Aug 01, 2016 at 11:10:19AM -0400, John Ferlan wrote:
>On 08/01/2016 09:12 AM, Martin Kletzander wrote:
>> Let's cleanly differentiate what wiping a volume does for ploop and
>> other volumes so it's more readable what is done for each one instead of
>> branching out multiple times in different parts of the same function.
>>
>> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
>> ---
>>  src/storage/storage_backend.c | 78 ++++++++++++++++++++++++-------------------
>>  1 file changed, 44 insertions(+), 34 deletions(-)
>>
>> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
>> index b7c7af298f29..27a757edec73 100644
>> --- a/src/storage/storage_backend.c
>> +++ b/src/storage/storage_backend.c
>> @@ -2499,26 +2481,23 @@ virStorageBackendVolWipeLocal(virConnectPtr conn ATTRIBUTE_UNUSED,
>>          } else {
>>              ret = virStorageBackendWipeLocal(path,
>>                                               fd,
>> -                                             vol->target.allocation,
>> +                                             allocation,
>>                                               st.st_blksize);
>>          }
>>          if (ret < 0)
>>              goto cleanup;
>>      }
>>
>> -    if (vol->target.format == VIR_STORAGE_FILE_PLOOP)
>> -        ret = virStorageBackendVolWipePloop(vol);
>> -
>>   cleanup:
>>      virCommandFree(cmd);
>> -    VIR_FREE(path);
>>      VIR_FORCE_CLOSE(fd);
>>      return ret;
>>  }
>>
>>
>>  static int
>> -virStorageBackendVolWipePloop(virStorageVolDefPtr vol)
>> +virStorageBackendVolWipePloop(virStorageVolDefPtr vol,
>> +                              unsigned int algorithm)
>
>
>Ironically... this could take "path", "allocation", and "capacity" as
>parameters instead of "vol"....
>

I don't see the reason for that now as it won't be available from

>Your call on adjusting this one as well...  If you do, you should adjust
>the odd vertical alignment for the virCommandAddArgFormat for
>VIR_DIV_UP(capacity,...)
>

I adjusted that though.  Let's have it clean.  I'll push it after release.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160801/152ffe89/attachment-0001.sig>


More information about the libvir-list mailing list