public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/lib/metadata metadata.c metadata.h
@ 2010-06-28 20:34 wysochanski
  0 siblings, 0 replies; 2+ messages in thread
From: wysochanski @ 2010-06-28 20:34 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2010-06-28 20:34:40

Modified files:
	lib/metadata   : metadata.c metadata.h 

Log message:
	Add mdas_empty_or_ignored() helper function.
	
	Add a helper function to consolidate checking for an empty mdas list
	or ignored mdas.  Ignored mdas should behave almost identically to
	an empty mda list - the metadata areas should not be read or written
	to.  This function will make it easier to implement metadata balancing
	and easier to track pvs with an empty mda list or ignored mdas.
	
	Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.352&r2=1.353
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.210&r2=1.211

--- LVM2/lib/metadata/metadata.c	2010/06/28 20:33:44	1.352
+++ LVM2/lib/metadata/metadata.c	2010/06/28 20:34:40	1.353
@@ -4032,6 +4032,19 @@
 	return 1;
 }
 
+int mdas_empty_or_ignored(struct dm_list *mdas)
+{
+	struct metadata_area *mda;
+
+	if (!dm_list_size(mdas))
+		return 1;
+	dm_list_iterate_items(mda, mdas) {
+		if (mda_is_ignored(mda))
+			return 1;
+	}
+	return 0;
+}
+
 uint32_t vg_seqno(const struct volume_group *vg)
 {
 	return vg->seqno;
--- LVM2/lib/metadata/metadata.h	2010/06/28 20:33:23	1.210
+++ LVM2/lib/metadata/metadata.h	2010/06/28 20:34:40	1.211
@@ -185,6 +185,7 @@
 unsigned mda_locns_match(struct metadata_area *mda1, struct metadata_area *mda2);
 void fid_add_mda(struct format_instance *fid, struct metadata_area *mda);
 int fid_add_mdas(struct format_instance *fid, struct dm_list *mdas);
+int mdas_empty_or_ignored(struct dm_list *mdas);
 
 #define seg_pvseg(seg, s)	(seg)->areas[(s)].u.pv.pvseg
 #define seg_dev(seg, s)		(seg)->areas[(s)].u.pv.pvseg->pv->dev


^ permalink raw reply	[flat|nested] 2+ messages in thread

* LVM2/lib/metadata metadata.c metadata.h
@ 2007-06-13 20:55 wysochanski
  0 siblings, 0 replies; 2+ messages in thread
From: wysochanski @ 2007-06-13 20:55 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2007-06-13 20:55:56

Modified files:
	lib/metadata   : metadata.c metadata.h 

Log message:
	Convert pv_handle_t to pv_t * and tidy up whitespace

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.114&r2=1.115
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.160&r2=1.161

--- LVM2/lib/metadata/metadata.c	2007/06/13 19:52:48	1.114
+++ LVM2/lib/metadata/metadata.c	2007/06/13 20:55:56	1.115
@@ -586,7 +586,7 @@
  * Note:
  *   FIXME - liblvm todo - tidy up arguments for external use (fmt, mdas, etc)
  */
-pv_handle_t pv_create(const struct format_type *fmt,
+pv_t *pv_create(const struct format_type *fmt,
 		struct device *dev,
 		struct id *id, uint64_t size,
 		uint64_t pe_start,
@@ -595,7 +595,7 @@
 		int pvmetadatacopies,
 		uint64_t pvmetadatasize, struct list *mdas)
 {
-	return (pv_handle_t) _pv_create(fmt, dev, id, size, pe_start, 
+	return (pv_t *) _pv_create(fmt, dev, id, size, pe_start, 
 					existing_extent_count,
 					existing_extent_size,
 					pvmetadatacopies,
@@ -719,9 +719,9 @@
  * Note
  *   FIXME - liblvm todo - make into function that takes VG handle
  */
-pv_handle_t find_pv_in_vg_by_uuid(struct volume_group *vg, struct id *id)
+pv_t *find_pv_in_vg_by_uuid(struct volume_group *vg, struct id *id)
 {
-	return (pv_handle_t) _find_pv_in_vg_by_uuid(vg, id);
+	return (pv_t *) _find_pv_in_vg_by_uuid(vg, id);
 }
 
 
@@ -1773,57 +1773,57 @@
 /*
  * Gets/Sets for external LVM library
  */
-struct id get_pv_id (pv_handle_t pv_handle)
+struct id get_pv_id(pv_t *pv)
 {
-	return pv_field(pv_handle, id);
+	return pv_field(pv, id);
 }
 
-const struct format_type *get_pv_format_type (pv_handle_t pv_handle)
+const struct format_type *get_pv_format_type(pv_t *pv)
 {
-	return pv_field(pv_handle, fmt);
+	return pv_field(pv, fmt);
 }
 
-struct id get_pv_vgid (pv_handle_t pv_handle)
+struct id get_pv_vgid(pv_t *pv)
 {
-	return pv_field(pv_handle, vgid);
+	return pv_field(pv, vgid);
 }
 
-struct device *get_pv_dev (pv_handle_t pv_handle)
+struct device *get_pv_dev(pv_t *pv)
 {
-	return pv_field(pv_handle, dev);
+	return pv_field(pv, dev);
 }
 
-const char *get_pv_vg_name (pv_handle_t pv_handle)
+const char *get_pv_vg_name(pv_t *pv)
 {
-	return pv_field(pv_handle, vg_name);
+	return pv_field(pv, vg_name);
 }
 
-uint64_t get_pv_size(pv_handle_t pv_handle)
+uint64_t get_pv_size(pv_t *pv)
 {
-	return pv_field(pv_handle, size);
+	return pv_field(pv, size);
 }
 
-uint32_t get_pv_status (pv_handle_t pv_handle)
+uint32_t get_pv_status(pv_t *pv)
 {
-	return pv_field(pv_handle, status);
+	return pv_field(pv, status);
 }
 
-uint32_t get_pv_pe_size (pv_handle_t pv_handle)
+uint32_t get_pv_pe_size(pv_t *pv)
 {
-	return pv_field(pv_handle, pe_size);
+	return pv_field(pv, pe_size);
 }
 
-uint64_t get_pv_pe_start (pv_handle_t pv_handle)
+uint64_t get_pv_pe_start(pv_t *pv)
 {
-	return pv_field(pv_handle, pe_start);
+	return pv_field(pv, pe_start);
 }
 
-uint32_t get_pv_pe_count (pv_handle_t pv_handle)
+uint32_t get_pv_pe_count(pv_t *pv)
 {
-	return pv_field(pv_handle, pe_count);
+	return pv_field(pv, pe_count);
 }
 
-uint32_t get_pv_pe_alloc_count (pv_handle_t pv_handle)
+uint32_t get_pv_pe_alloc_count(pv_t *pv)
 {
-	return pv_field(pv_handle, pe_alloc_count);
+	return pv_field(pv, pe_alloc_count);
 }
--- LVM2/lib/metadata/metadata.h	2007/06/13 19:52:48	1.160
+++ LVM2/lib/metadata/metadata.h	2007/06/13 20:55:56	1.161
@@ -142,7 +142,7 @@
 	struct list tags;
 };
 
-typedef struct physical_volume * pv_handle_t;
+typedef struct physical_volume pv_t;
 struct metadata_area;
 struct format_instance;
 
@@ -439,7 +439,7 @@
 
 /* pe_start and pe_end relate to any existing data so that new metadata
  * areas can avoid overlap */
-pv_handle_t pv_create(const struct format_type *fmt,
+pv_t *pv_create(const struct format_type *fmt,
 		      struct device *dev,
 		      struct id *id,
 		      uint64_t size,
@@ -501,7 +501,7 @@
 
 /* Find a PV within a given VG */
 struct pv_list *find_pv_in_vg(struct volume_group *vg, const char *pv_name);
-pv_handle_t find_pv_in_vg_by_uuid(struct volume_group *vg, struct id *id);
+pv_t *find_pv_in_vg_by_uuid(struct volume_group *vg, struct id *id);
 int get_pv_from_vg_by_id(const struct format_type *fmt, const char *vg_name,
 			 const char *vgid, const char *pvid,
 			 struct physical_volume *pv);
@@ -638,16 +638,16 @@
 /*
  * Gets/Sets for external LVM library
  */
-struct id get_pv_id (pv_handle_t pv_handle);
-const struct format_type *get_pv_format_type (pv_handle_t pv_handle);
-struct id get_pv_vgid (pv_handle_t pv_handle);
-struct device *get_pv_dev (pv_handle_t pv_handle);
-const char *get_pv_vg_name (pv_handle_t pv_handle);
-uint64_t get_pv_size(pv_handle_t pv_handle);
-uint32_t get_pv_status (pv_handle_t pv_handle);
-uint32_t get_pv_pe_size (pv_handle_t pv_handle);
-uint64_t get_pv_pe_start (pv_handle_t pv_handle);
-uint32_t get_pv_pe_count (pv_handle_t pv_handle);
-uint32_t get_pv_pe_alloc_count (pv_handle_t pv_handle);
+struct id get_pv_id(pv_t *pv);
+const struct format_type *get_pv_format_type(pv_t *pv);
+struct id get_pv_vgid(pv_t *pv);
+struct device *get_pv_dev(pv_t *pv);
+const char *get_pv_vg_name(pv_t *pv);
+uint64_t get_pv_size(pv_t *pv);
+uint32_t get_pv_status(pv_t *pv);
+uint32_t get_pv_pe_size(pv_t *pv);
+uint64_t get_pv_pe_start(pv_t *pv);
+uint32_t get_pv_pe_count(pv_t *pv);
+uint32_t get_pv_pe_alloc_count(pv_t *pv);
 
 #endif


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-28 20:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-28 20:34 LVM2/lib/metadata metadata.c metadata.h wysochanski
  -- strict thread matches above, loose matches on Subject: below --
2007-06-13 20:55 wysochanski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).