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

Re: [libvirt] [PATCH 4/5] free extent fix



On Wed, Jun 24, 2009 at 11:19:37AM +0200, Henrik Persson wrote:
> Parted reports that the first block of the disk is free, even if it is occupied by the 
> partition table.

> --- libvirt-0.6.4.patches/src/storage_backend_disk.c	2009-06-23 18:17:19.039168000 +0200
> +++ libvirt-0.6.4/src/storage_backend_disk.c	2009-06-23 18:17:10.324936000 +0200
> @@ -36,6 +36,8 @@
>  
>  #define PARTHELPER BINDIR "/libvirt_parthelper"
>  
> +#define SECTOR_SIZE 512
> +
>  /* Map partition types to internal enum */
>  static int 
>  virStorageBackendDiskMapPartitionType(const char* partType)
> @@ -214,6 +216,11 @@ virStorageBackendDiskMakeFreeExtent(virC
>                           &dev->freeExtents[dev->nfreeExtent].end) < 0)
>          return -1; /* Don't bother to re-alloc freeExtents - it'll be free'd shortly */
>  
> +    /* first block reported as free, even if it is not */
> +    if (dev->freeExtents[dev->nfreeExtent].start == 0) {
> +        dev->freeExtents[dev->nfreeExtent].start = SECTOR_SIZE;
> +    }
> +
>      pool->def->available +=
>          (dev->freeExtents[dev->nfreeExtent].end -
>           dev->freeExtents[dev->nfreeExtent].start);


ACK, makes sense,


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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