]> sourceware.org Git - lvm2.git/commitdiff
metadata: Add lvmcache_info_mda_free as a companion to pv_mda_free.
authorPetr Rockai <prockai@redhat.com>
Mon, 29 Jul 2013 16:52:28 +0000 (18:52 +0200)
committerPetr Rockai <prockai@redhat.com>
Sun, 17 Nov 2013 20:41:27 +0000 (21:41 +0100)
lib/metadata/pv.c
lib/metadata/pv.h

index dad747cd3fb7f66eac23fbe293b9d5aefd82504e..5b08998e6e3e52d64c719d45d0ea2f207f6a09e8 100644 (file)
@@ -241,14 +241,11 @@ static int _pv_mda_free(struct metadata_area *mda, void *baton) {
        return 1;
 }
 
-uint64_t pv_mda_free(const struct physical_volume *pv)
+uint64_t lvmcache_info_mda_free(struct lvmcache_info *info)
 {
-       struct lvmcache_info *info;
        uint64_t freespace = UINT64_MAX;
-       const char *pvid = (const char *)&pv->id.uuid;
 
-       if ((info = lvmcache_info_from_pvid(pvid, 0)))
-               lvmcache_foreach_mda(info, _pv_mda_free, &freespace);
+       lvmcache_foreach_mda(info, _pv_mda_free, &freespace);
 
        if (freespace == UINT64_MAX)
                freespace = UINT64_C(0);
@@ -256,6 +253,15 @@ uint64_t pv_mda_free(const struct physical_volume *pv)
        return freespace;
 }
 
+uint64_t pv_mda_free(const struct physical_volume *pv)
+{
+       const char *pvid = (const char *)&pv->id.uuid;
+       struct lvmcache_info *info;
+       if ((info = lvmcache_info_from_pvid(pvid, 0)))
+               return lvmcache_info_mda_free(info);
+       return 0;
+}
+
 uint64_t pv_used(const struct physical_volume *pv)
 {
        uint64_t used;
index c018f3870e05f98c9f28a914de89639601295126..ff708f8e3b7780b986d6bb7367ec0e3e10af26cc 100644 (file)
@@ -85,6 +85,8 @@ uint64_t pv_ba_size(const struct physical_volume *pv);
 uint32_t pv_pe_count(const struct physical_volume *pv);
 uint32_t pv_pe_alloc_count(const struct physical_volume *pv);
 uint64_t pv_mda_size(const struct physical_volume *pv);
+struct lvmcache_info;
+uint64_t lvmcache_info_mda_free(struct lvmcache_info *info);
 uint64_t pv_mda_free(const struct physical_volume *pv);
 uint64_t pv_used(const struct physical_volume *pv);
 uint32_t pv_mda_count(const struct physical_volume *pv);
This page took 0.045405 seconds and 5 git commands to generate.