[libvirt] [PATCH v2 2/4] storage: move block format lookup to shared UpdateVolInfo

Eric Blake eblake at redhat.com
Mon Mar 31 19:17:15 UTC 2014


On 03/31/2014 12:50 PM, Cole Robinson wrote:
> ---

Commit message is a bit sparse - it says what but not why.  But looking
at the patch, it looks like the goal was to refactor code that copied
and pasted block format lookup after getting volinfo to instead have
volinfo get everything up front.

>  src/storage/storage_backend.c         | 175 ++++++++++++++++++----------------
>  src/storage/storage_backend.h         |   4 +-
>  src/storage/storage_backend_disk.c    |   2 +-
>  src/storage/storage_backend_fs.c      |   4 +-
>  src/storage/storage_backend_logical.c |   2 +-
>  src/storage/storage_backend_mpath.c   |  36 +------
>  src/storage/storage_backend_scsi.c    |  39 +-------
>  7 files changed, 103 insertions(+), 159 deletions(-)
> 
> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
> index 7795b33..78644f6 100644
> --- a/src/storage/storage_backend.c
> +++ b/src/storage/storage_backend.c
> @@ -1198,6 +1198,80 @@ virStorageFileBackendForType(int type,
>  }
>  
>  
> +struct diskType {
> +    int part_table_type;
> +    unsigned short offset;

So this hunk is code motion;


> @@ -1316,22 +1390,30 @@ int
>  virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target,
>                                       unsigned long long *allocation,
>                                       unsigned long long *capacity,
> +                                     bool withBlockVolFormat,

This hunk adds a new parameter that controls the use of the consolidated
code...

> +++ b/src/storage/storage_backend_disk.c
> @@ -113,7 +113,7 @@ virStorageBackendDiskMakeDataVol(virStoragePoolObjPtr pool,
>      }
>  
>      /* Refresh allocation/capacity/perms */
> -    if (virStorageBackendUpdateVolInfo(vol, true,
> +    if (virStorageBackendUpdateVolInfo(vol, true, false,

...most callers don't need the block lookup

> +++ b/src/storage/storage_backend_mpath.c
> @@ -42,37 +42,6 @@
>  VIR_LOG_INIT("storage.storage_backend_mpath");
>  
>  static int
> -virStorageBackendMpathUpdateVolTargetInfo(virStorageVolTargetPtr target,
> -                                          unsigned long long *allocation,
> -                                          unsigned long long *capacity)
> -{

and those that did now get it from the common function.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140331/a56964a6/attachment-0001.sig>


More information about the libvir-list mailing list