public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/lib/format_text format-text.c
@ 2010-11-29 11:16 zkabelac
  0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2010-11-29 11:16 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2010-11-29 11:16:58

Modified files:
	lib/format_text: format-text.c 

Log message:
	Remove unused 'i' in _pv_analyze_mda_raw
	
	'i' is unused in the function - remove it.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.148&r2=1.149

--- LVM2/lib/format_text/format-text.c	2010/10/26 09:13:13	1.148
+++ LVM2/lib/format_text/format-text.c	2010/11/29 11:16:58	1.149
@@ -173,7 +173,6 @@
 	uint64_t area_size;
 	uint64_t prev_sector, prev_sector2;
 	uint64_t latest_mrec_offset;
-	int i;
 	uint64_t offset;
 	uint64_t offset2;
 	size_t size;
@@ -214,7 +213,7 @@
 	offset = prev_sector;
 	size = SECTOR_SIZE;
 	offset2 = size2 = 0;
-	i = 0;
+
 	while (prev_sector != latest_mrec_offset) {
 		prev_sector2 = prev_sector;
 		prev_sector = _get_prev_sector_circular(area_start, area_size,


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2012-02-27  9:54 zkabelac
  0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2012-02-27  9:54 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-02-27 09:54:25

Modified files:
	lib/format_text: format-text.c 

Log message:
	Remove test for pvid
	
	Since pvid is char buffer[] and not pointer,
	there is no point to check it for NULL.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.195&r2=1.196

--- LVM2/lib/format_text/format-text.c	2012/02/23 17:59:33	1.195
+++ LVM2/lib/format_text/format-text.c	2012/02/27 09:54:25	1.196
@@ -1676,7 +1676,6 @@
 	 */
 	else {
 		if (!pv->dev ||
-		    !pv->dev->pvid ||
 		    !(info = lvmcache_info_from_pvid(pv->dev->pvid, 0))) {
 			log_error("PV %s missing from cache", pv_dev_name(pv));
 			return 0;


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2011-03-02 10:23 prajnoha
  0 siblings, 0 replies; 15+ messages in thread
From: prajnoha @ 2011-03-02 10:23 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2011-03-02 10:23:29

Modified files:
	lib/format_text: format-text.c 

Log message:
	Use a copy if moving an mda from pv fid to vg fid.
	
	We'll destroy the pv fid (with all mdas in it) after merging all pv mdas to
	a vg in _text_pv_setup fn, hence we need to use a copy here!

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.172&r2=1.173

--- LVM2/lib/format_text/format-text.c	2011/03/02 10:19:14	1.172
+++ LVM2/lib/format_text/format-text.c	2011/03/02 10:23:29	1.173
@@ -1647,7 +1647,7 @@
 	const char *pvid = (const char *) (*pv->old_id.uuid ? &pv->old_id : &pv->id);
 	struct lvmcache_info *info;
 	unsigned mda_index;
-	struct metadata_area *pv_mda;
+	struct metadata_area *pv_mda, *pv_mda_copy;
 	struct mda_context *pv_mdac;
 	uint64_t pe_count;
 	uint64_t size_reduction = 0;
@@ -1659,8 +1659,10 @@
 				continue;
 
 			/* Be sure it's not already in VG's format instance! */
-			if (!fid_get_mda_indexed(vg->fid, pvid, ID_LEN, mda_index))
-				fid_add_mda(vg->fid, pv_mda, pvid, ID_LEN, mda_index);
+			if (!fid_get_mda_indexed(vg->fid, pvid, ID_LEN, mda_index)) {
+				pv_mda_copy = mda_copy(vg->fid->fmt->cmd->mem, pv_mda);
+				fid_add_mda(vg->fid, pv_mda_copy, pvid, ID_LEN, mda_index);
+			}
 		}
 	}
 	/*


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2011-02-28 17:05 prajnoha
  0 siblings, 0 replies; 15+ messages in thread
From: prajnoha @ 2011-02-28 17:05 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2011-02-28 17:05:48

Modified files:
	lib/format_text: format-text.c 

Log message:
	Use pv->vg_name directly instead of pv->vg->name in _text_pv_write.
	
	This also prevents a possible segfault during an automatic repair
	when the PV does not belong to a VG anymore and we call pv_write_orphan.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.170&r2=1.171

--- LVM2/lib/format_text/format-text.c	2011/02/28 13:19:02	1.170
+++ LVM2/lib/format_text/format-text.c	2011/02/28 17:05:48	1.171
@@ -1273,8 +1273,7 @@
 
 	/* Add a new cache entry with PV info or update existing one. */
 	if (!(info = lvmcache_add(fmt->labeller, (const char *) &pv->id,
-		      pv->dev, pv->vg ? pv->vg->name : FMT_TEXT_ORPHAN_VG_NAME,
-		      NULL, 0)))
+				  pv->dev, pv->vg_name, NULL, 0)))
 		return_0;
 
 	label = info->label;


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2011-02-25 13:50 prajnoha
  0 siblings, 0 replies; 15+ messages in thread
From: prajnoha @ 2011-02-25 13:50 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2011-02-25 13:50:03

Modified files:
	lib/format_text: format-text.c 

Log message:
	Fix a bug in metadata location calculation, cleanup pv_add_metadata_area fn.
	
	This bug (a missing line) caused the 2nd MDA area location to be calculated
	incorrectly and it didn't fit the disk size properly.
	
	(https://www.redhat.com/archives/lvm-devel/2011-February/msg00127.html)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.166&r2=1.167

--- LVM2/lib/format_text/format-text.c	2011/02/21 12:31:28	1.166
+++ LVM2/lib/format_text/format-text.c	2011/02/25 13:50:02	1.167
@@ -1884,11 +1884,13 @@
 	uint64_t alignment, alignment_offset;
 	uint64_t disk_size;
 	uint64_t mda_start;
-	uint64_t adjustment, limit;
+	uint64_t adjustment, limit, tmp_mda_size;
 	uint64_t wipe_size = 8 << SECTOR_SHIFT;
 	size_t page_size = lvm_getpagesize();
 	struct metadata_area *mda;
 	struct mda_context *mdac;
+	const char *limit_name;
+	int limit_applied = 0;
 
 	if (mda_index >= FMT_TEXT_MAX_MDAS_PER_PV) {
 		log_error(INTERNAL_ERROR "invalid index of value %u used "
@@ -1917,13 +1919,19 @@
 		 * is locked. If it's not locked, count with any existing MDA1.
 		 * If there's no MDA1, just use disk size as the limit.
 		 */
-		if (pe_start_locked)
+		if (pe_start_locked) {
 			limit = pe_start;
+			limit_name = "pe_start";
+		}
 		else if ((mda = fid_get_mda_indexed(fid, pvid, ID_LEN, 1)) &&
-			 (mdac = mda->metadata_locn))
+			 (mdac = mda->metadata_locn)) {
 			limit = mdac->area.start;
-		else
+			limit_name = "MDA1 start";
+		}
+		else {
 			limit = disk_size;
+			limit_name = "disk size";
+		}
 
 		if (limit > disk_size)
 			goto bad;
@@ -1937,29 +1945,22 @@
 		}
 
 		/* Align MDA0 end position with given alignment if possible. */
-		if (alignment) {
-			if ((adjustment = (mda_start + mda_size) % alignment)) {
-				mda_size += (alignment - adjustment);
-				if (mda_start + mda_size > limit)
-					mda_size -= (alignment - adjustment);
-			}
+		if (alignment &&
+		    (adjustment = (mda_start + mda_size) % alignment)) {
+			tmp_mda_size = mda_size + alignment - adjustment;
+			if (mda_start + tmp_mda_size <= limit)
+				mda_size = tmp_mda_size;
 		}
 
 		/* Align MDA0 end position with given alignment offset if possible. */
 		if (alignment_offset &&
 		    (((mda_start + mda_size) % alignment) == 0)) {
-			mda_size += alignment_offset;
-			if (mda_start + mda_size > limit)
-				mda_size -= alignment_offset;
+			tmp_mda_size = mda_size + alignment_offset;
+			if (mda_start + tmp_mda_size <= limit)
+				mda_size = tmp_mda_size;
 		}
 
 		if (mda_start + mda_size > limit) {
-			log_warn("WARNING: metadata area size outreaches "
-				 "a limit on PV %s specified by its %s. "
-				 "Trying to adjust metadata area size.",
-				  pv_dev_name(pv),
-				  pe_start_locked ? "PE start" : "disk size");
-
 			/*
 			 * Try to decrease the MDA0 size with twice the
 			 * alignment and then align with given alignment.
@@ -1982,6 +1983,8 @@
 			/* FIXME: We should probably check for some minimum MDA size here. */
 			else
 				mda_size = limit - mda_start;
+
+			limit_applied = 1;
 		}
 
 		/*
@@ -1997,41 +2000,54 @@
 	else {
 		/*
 		 * Try to fit MDA1 start within given pe_end or pe_start limit
-		 * if it's locked. If pe_start and pe_end are not defined yet,
-		 * count with any existing MDA0 and pe_start. If MDA0 does not
-		 * exist, just use LABEL_SCAN_SIZE.
+		 * if defined or locked. If pe_start is not defined yet, count
+		 * with any existing MDA0. If MDA0 does not exist, just use
+		 * LABEL_SCAN_SIZE.
 		 */
 		pe_end = pv->pe_count ? (pv->pe_start +
 					 pv->pe_count * pv->pe_size - 1) << SECTOR_SHIFT
 				      : 0;
-		if (pe_start_locked)
+
+		if (pe_start || pe_start_locked) {
 			limit = pe_end ? pe_end : pe_start;
-		else if (pe_start)
-			limit = pe_start;
-		/*
-		 * Normally MDA0's start + size should be pe_start.
-		 * The statemet here is probably useless since the
-		 * situation is covered by previous statement.
-		 */
+			limit_name = pe_end ? "pe_end" : "pe_start";
+		}
 		else if ((mda = fid_get_mda_indexed(fid, pvid, ID_LEN, 0)) &&
-			 (mdac = mda->metadata_locn))
+			 (mdac = mda->metadata_locn)) {
 			limit = mdac->area.start + mdac->area.size;
-		else
+			limit_name = "MDA0 end";
+		}
+		else {
 			limit = LABEL_SCAN_SIZE;
+			limit_name = "label scan size";
+		}
 
-		if (limit > disk_size || mda_size > disk_size)
+		if (limit > disk_size)
 			goto bad;
 
-		mda_start = disk_size - mda_size;
-
-		if (alignment) {
-			adjustment = mda_start % alignment;
-			if (adjustment)
-				mda_size += adjustment;
+		if (mda_size > disk_size) {
+			mda_size = disk_size - limit;
+			limit_applied = 1;
 		}
 
-		if (disk_size - mda_size < limit)
+		mda_start = disk_size - mda_size;
+
+		/* If MDA1 size is too big, just take any usable space. */
+		if (disk_size - mda_size < limit) {
 			mda_size = disk_size - limit;
+			mda_start = disk_size - mda_size;
+			limit_applied = 1;
+		}
+		/* Otherwise, try to align MDA1 start if possible. */
+		else if (alignment &&
+		    (adjustment = mda_start % alignment)) {
+			tmp_mda_size = mda_size + adjustment;
+			if (tmp_mda_size < disk_size &&
+			    disk_size - tmp_mda_size >= limit) {
+				mda_size = tmp_mda_size;
+				mda_start = disk_size - mda_size;
+			}
+		}
 
 		/*
 		 * If PV's pe_end not set yet, set it to the end of the
@@ -2044,6 +2060,12 @@
 		}*/
 	}
 
+	if (limit_applied)
+		log_very_verbose("Using limited metadata area size on %s "
+				 "with value %" PRIu64 " (limited by %s of "
+				 "%" PRIu64 ").", pv_dev_name(pv),
+				  mda_size, limit_name, limit);
+
 	if (mda_size) {
 		/* Wipe metadata area with zeroes. */
 		if (!dev_set((struct device *) pv->dev, mda_start,


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2011-02-21 12:25 prajnoha
  0 siblings, 0 replies; 15+ messages in thread
From: prajnoha @ 2011-02-21 12:25 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2011-02-21 12:25:16

Modified files:
	lib/format_text: format-text.c 

Log message:
	Remove unused _mda_setup fn. This functionality is covered by new pv_add_metadata_area fn.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.162&r2=1.163

--- LVM2/lib/format_text/format-text.c	2011/02/21 12:24:17	1.162
+++ LVM2/lib/format_text/format-text.c	2011/02/21 12:25:16	1.163
@@ -1255,159 +1255,6 @@
 	return (_scan_file(fmt, vgname) & _scan_raw(fmt, vgname));
 }
 
-/* For orphan, creates new mdas according to policy.
-   Always have an mda between end-of-label and pe_align() boundary */
-static int _mda_setup(const struct format_type *fmt,
-		      uint64_t pe_start, uint64_t pe_end,
-		      int pvmetadatacopies, uint64_t pvmetadatasize,
-		      unsigned metadataignore, struct dm_list *mdas,
-		      struct physical_volume *pv,
-		      struct volume_group *vg __attribute__((unused)))
-{
-	uint64_t mda_adjustment, disk_size, alignment, alignment_offset;
-	uint64_t start1, mda_size1;	/* First area - start of disk */
-	uint64_t start2, mda_size2;	/* Second area - end of disk */
-	uint64_t wipe_size = 8 << SECTOR_SHIFT;
-	size_t pagesize = lvm_getpagesize();
-
-	if (!pvmetadatacopies)
-		return 1;
-
-	alignment = pv->pe_align << SECTOR_SHIFT;
-	alignment_offset = pv->pe_align_offset << SECTOR_SHIFT;
-	disk_size = pv->size << SECTOR_SHIFT;
-	pe_start <<= SECTOR_SHIFT;
-	pe_end <<= SECTOR_SHIFT;
-
-	if (pe_end > disk_size) {
-		log_error("Physical extents end beyond end of device %s!",
-			  pv_dev_name(pv));
-		return 0;
-	}
-
-	/* Requested metadatasize */
-	mda_size1 = pvmetadatasize << SECTOR_SHIFT;
-
-	/* Place mda straight after label area at start of disk */
-	start1 = LABEL_SCAN_SIZE;
-
-	/* Unless the space available is tiny, round to PAGE_SIZE boundary */
-	if ((!pe_start && !pe_end) ||
-	    ((pe_start > start1) && (pe_start - start1 >= MDA_SIZE_MIN))) {
-		mda_adjustment = start1 % pagesize;
-		if (mda_adjustment)
-			start1 += (pagesize - mda_adjustment);
-	}
-
-	/* Round up to pe_align boundary */
-	mda_adjustment = (mda_size1 + start1) % alignment;
-	if (mda_adjustment) {
-		mda_size1 += (alignment - mda_adjustment);
-		/* Revert if it's now too large */
-		if (start1 + mda_size1 > disk_size)
-			mda_size1 -= (alignment - mda_adjustment);
-	}
-
-	/* Add pe_align_offset if on pe_align boundary */
-	if (alignment_offset &&
-	    (((start1 + mda_size1) % alignment) == 0)) {
-		mda_size1 += alignment_offset;
-		/* Revert if it's now too large */
-		if (start1 + mda_size1 > disk_size)
-			mda_size1 -= alignment_offset;
-	}
-
-	/* Ensure it's not going to be bigger than the disk! */
-	if (start1 + mda_size1 > disk_size) {
-		log_warn("WARNING: metadata area fills disk leaving no "
-			 "space for data on %s.", pv_dev_name(pv));
-		/* Leave some free space for rounding */
-		/* Avoid empty data area as could cause tools problems */
-		mda_size1 = disk_size - start1 - alignment * 2;
-		if (start1 + mda_size1 > disk_size) {
-			log_error("Insufficient space for first mda on %s",
-				  pv_dev_name(pv));
-			return 0;
-		}
-		/* Round up to pe_align boundary */
-		mda_adjustment = (mda_size1 + start1) % alignment;
-		if (mda_adjustment)
-			mda_size1 += (alignment - mda_adjustment);
-		/* Only have 1 mda in this case */
-		pvmetadatacopies = 1;
-	}
-
-	/* If we already have PEs, avoid overlap */
-	if (pe_start || pe_end) {
-		if (pe_start <= start1)
-			mda_size1 = 0;
-		else if (start1 + mda_size1 > pe_start)
-			mda_size1 = pe_start - start1;
-	}
-
-	/* FIXME If creating new mdas, wipe them! */
-	if (mda_size1) {
-		if (!add_mda(fmt, fmt->cmd->mem, mdas, pv->dev, start1,
-			     mda_size1, metadataignore))
-			return 0;
-
-		if (!dev_set((struct device *) pv->dev, start1,
-			     (size_t) ((mda_size1 > wipe_size) ?
-				       wipe_size : mda_size1), 0)) {
-			log_error("Failed to wipe new metadata area");
-			return 0;
-		}
-
-		if (pvmetadatacopies == 1)
-			return 1;
-	} else
-		start1 = 0;
-
-	/* A second copy at end of disk */
-	mda_size2 = pvmetadatasize << SECTOR_SHIFT;
-
-	/* Ensure it's not going to be bigger than the disk! */
-	if (mda_size2 > disk_size)
-		mda_size2 = disk_size - start1 - mda_size1;
-
-	mda_adjustment = (disk_size - mda_size2) % alignment;
-	if (mda_adjustment)
-		mda_size2 += mda_adjustment;
-
-	start2 = disk_size - mda_size2;
-
-	/* If we already have PEs, avoid overlap */
-	if (pe_start || pe_end) {
-		if (start2 < pe_end) {
-			mda_size2 -= (pe_end - start2);
-			start2 = pe_end;
-		}
-	}
-
-	/* If we already have a first mda, avoid overlap */
-	if (mda_size1) {
-		if (start2 < start1 + mda_size1) {
-			mda_size2 -= (start1 + mda_size1 - start2);
-			start2 = start1 + mda_size1;
-		}
-		/* No room for any PEs here now! */
-	}
-
-	if (mda_size2) {
-		if (!add_mda(fmt, fmt->cmd->mem, mdas, pv->dev, start2,
-			     mda_size2, metadataignore)) return 0;
-		if (!dev_set(pv->dev, start2,
-			     (size_t) ((mda_size2 > wipe_size) ?
-				       wipe_size : mda_size2), 0)) {
-			log_error("Failed to wipe new metadata area");
-			return 0;
-		}
-	} else
-		return 0;
-
-	return 1;
-}
-
 /* Only for orphans */
 /* Set label_sector to -1 if rewriting existing label into same sector */
 /* If mdas is supplied it overwrites existing mdas e.g. used with pvcreate */


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2010-08-26 12:22 mbroz
  0 siblings, 0 replies; 15+ messages in thread
From: mbroz @ 2010-08-26 12:22 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-08-26 12:22:05

Modified files:
	lib/format_text: format-text.c 

Log message:
	Fix previous const removal.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.143&r2=1.144

--- LVM2/lib/format_text/format-text.c	2010/08/20 20:59:07	1.143
+++ LVM2/lib/format_text/format-text.c	2010/08/26 12:22:05	1.144
@@ -1649,7 +1649,7 @@
 	return dev_name(mdac->area.dev);
 }
 
-static uint64_t const _metadata_locn_offset_raw(void *metadata_locn)
+static uint64_t _metadata_locn_offset_raw(void *metadata_locn)
 {
 	struct mda_context *mdac = (struct mda_context *) metadata_locn;
 


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2010-06-29 13:29 wysochanski
  0 siblings, 0 replies; 15+ messages in thread
From: wysochanski @ 2010-06-29 13:29 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2010-06-29 13:29:53

Modified files:
	lib/format_text: format-text.c 

Log message:
	Attempt to fix intermittent failure with non-debug configured vgcfgbackup.
	
	There's an intermittent failure with vgcfgbackup that seems to have been
	introduced with the metadataignore / vgmetadatacopies patchset.
	Intermittent failures are often the result of uninitialized data,
	so this patch calls zalloc in a few places it might matter.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.133&r2=1.134

--- LVM2/lib/format_text/format-text.c	2010/06/28 20:35:17	1.133
+++ LVM2/lib/format_text/format-text.c	2010/06/29 13:29:53	1.134
@@ -1919,7 +1919,7 @@
 	dm_list_init(&fid->metadata_areas_ignored);
 
 	if (!vgname) {
-		if (!(mda = dm_pool_alloc(fmt->cmd->mem, sizeof(*mda))))
+		if (!(mda = dm_pool_zalloc(fmt->cmd->mem, sizeof(*mda))))
 			return_NULL;
 		mda->ops = &_metadata_text_file_backup_ops;
 		mda->metadata_locn = context;
@@ -1936,7 +1936,7 @@
 			}
 
 			context = create_text_context(fmt->cmd, path, NULL);
-			if (!(mda = dm_pool_alloc(fmt->cmd->mem, sizeof(*mda))))
+			if (!(mda = dm_pool_zalloc(fmt->cmd->mem, sizeof(*mda))))
 				return_NULL;
 			mda->ops = &_metadata_text_file_ops;
 			mda->metadata_locn = context;
@@ -1950,10 +1950,10 @@
 			if (!_raw_holds_vgname(fid, &rl->dev_area, vgname))
 				continue;
 
-			if (!(mda = dm_pool_alloc(fmt->cmd->mem, sizeof(*mda))))
+			if (!(mda = dm_pool_zalloc(fmt->cmd->mem, sizeof(*mda))))
 				return_NULL;
 
-			if (!(mdac = dm_pool_alloc(fmt->cmd->mem, sizeof(*mdac))))
+			if (!(mdac = dm_pool_zalloc(fmt->cmd->mem, sizeof(*mdac))))
 				return_NULL;
 			mda->metadata_locn = mdac;
 			/* FIXME Allow multiple dev_areas inside area */


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2010-06-28 20:30 wysochanski
  0 siblings, 0 replies; 15+ messages in thread
From: wysochanski @ 2010-06-28 20:30 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

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

Modified files:
	lib/format_text: format-text.c 

Log message:
	Move dev_open / dev_close outside _vg_read_raw_area().
	
	This refactoring moves the device open/close up one level to the caller of
	_vg_read_raw_area().  Should be no functional change and facilitate future
	changes related to metadata balancing.
	
	Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.124&r2=1.125

--- LVM2/lib/format_text/format-text.c	2010/06/28 20:29:57	1.124
+++ LVM2/lib/format_text/format-text.c	2010/06/28 20:30:30	1.125
@@ -483,9 +483,6 @@
 	char *desc;
 	uint32_t wrap = 0;
 
-	if (!dev_open(area->dev))
-		return_NULL;
-
 	if (!(mdah = _raw_read_mda_header(fid->fmt, area)))
 		goto_out;
 
@@ -520,9 +517,6 @@
 		vg->status |= PRECOMMITTED;
 
       out:
-	if (!dev_close(area->dev))
-		stack;
-
 	return vg;
 }
 
@@ -531,8 +525,17 @@
 					 struct metadata_area *mda)
 {
 	struct mda_context *mdac = (struct mda_context *) mda->metadata_locn;
+	struct volume_group *vg;
+
+	if (!dev_open(mdac->area.dev))
+		return_NULL;
+
+	vg = _vg_read_raw_area(fid, vgname, &mdac->area, 0);
 
-	return _vg_read_raw_area(fid, vgname, &mdac->area, 0);
+	if (!dev_close(mdac->area.dev))
+		stack;
+
+	return vg;
 }
 
 static struct volume_group *_vg_read_precommit_raw(struct format_instance *fid,
@@ -540,8 +543,17 @@
 						   struct metadata_area *mda)
 {
 	struct mda_context *mdac = (struct mda_context *) mda->metadata_locn;
+	struct volume_group *vg;
 
-	return _vg_read_raw_area(fid, vgname, &mdac->area, 1);
+	if (!dev_open(mdac->area.dev))
+		return_NULL;
+
+	vg = _vg_read_raw_area(fid, vgname, &mdac->area, 1);
+
+	if (!dev_close(mdac->area.dev))
+		stack;
+
+	return vg;
 }
 
 static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
@@ -1192,9 +1204,17 @@
 		/* FIXME We're reading mdah twice here... */
 		if ((vgname = vgname_from_mda(fmt, &rl->dev_area, &vgid, &vgstatus,
 					      NULL, NULL))) {
-			if ((vg = _vg_read_raw_area(&fid, vgname,
-						    &rl->dev_area, 0)))
+			if (!dev_open(rl->dev_area.dev)) {
+				stack;
+				continue;
+			}
+
+			vg = _vg_read_raw_area(&fid, vgname, &rl->dev_area, 0);
+			if (vg)
 				lvmcache_update_vg(vg, 0);
+
+			if (!dev_close(rl->dev_area.dev))
+				stack;
 		}
 	}
 


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2009-07-31 14:23 snitzer
  0 siblings, 0 replies; 15+ messages in thread
From: snitzer @ 2009-07-31 14:23 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	snitzer@sourceware.org	2009-07-31 14:23:07

Modified files:
	lib/format_text: format-text.c 

Log message:
	Fix compile warnings from recently added log_very_verbose() in _text_pv_write()

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.113&r2=1.114

--- LVM2/lib/format_text/format-text.c	2009/07/30 21:15:17	1.113
+++ LVM2/lib/format_text/format-text.c	2009/07/31 14:23:06	1.114
@@ -1427,8 +1427,8 @@
 				if (adjustment)
 					pv->pe_start += pv->pe_align - adjustment;
 
-				log_very_verbose("%s: setting pe_start=%lu "
-					 "(orig_pe_start=%lu, "
+				log_very_verbose("%s: setting pe_start=%" PRIu64
+					 " (orig_pe_start=%" PRIu64 ", "
 					 "pe_align=%lu, pe_align_offset=%lu, "
 					 "adjustment=%" PRIu64 ")",
 					 pv_dev_name(pv), pv->pe_start,


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2009-07-30 17:41 snitzer
  0 siblings, 0 replies; 15+ messages in thread
From: snitzer @ 2009-07-30 17:41 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	snitzer@sourceware.org	2009-07-30 17:41:02

Modified files:
	lib/format_text: format-text.c 

Log message:
	Remove legacy support for preserving pe_start if a PV already has data
	areas.
	
	This preserved pe_start would quickly be readjusted to follow the first
	mda anyway.  An example use-case that hit this code path is: running
	pvcreate on an already existing PV _without_ a preceeding pvremove.
	
	Signed-off-by: Mike Snitzer <snitzer@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.108&r2=1.109

--- LVM2/lib/format_text/format-text.c	2009/07/30 17:19:31	1.108
+++ LVM2/lib/format_text/format-text.c	2009/07/30 17:41:01	1.109
@@ -1327,7 +1327,6 @@
 	char buf[MDA_HEADER_SIZE] __attribute((aligned(8)));
 	struct mda_header *mdah = (struct mda_header *) buf;
 	uint64_t adjustment;
-	struct data_area_list *da;
 
 	/* FIXME Test mode don't update cache? */
 
@@ -1364,16 +1363,9 @@
 		dm_list_init(&info->mdas);
 	}
 
-	/*
-	 * If no pe_start supplied but PV already exists,
-	 * preserve existing value.
-	 */
-	if (info->das.n) {
-		if (!pv->pe_start)
-			dm_list_iterate_items(da, &info->das)
-				pv->pe_start = da->disk_locn.offset >> SECTOR_SHIFT;
+	if (info->das.n)
 		del_das(&info->das);
-	} else
+	else
 		dm_list_init(&info->das);
 
 	/*


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2006-04-21 15:37 agk
  0 siblings, 0 replies; 15+ messages in thread
From: agk @ 2006-04-21 15:37 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-04-21 15:37:08

Modified files:
	lib/format_text: format-text.c 

Log message:
	terminate vgid in debug mesg

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.56&r2=1.57


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2005-10-31  2:37 agk
  0 siblings, 0 replies; 15+ messages in thread
From: agk @ 2005-10-31  2:37 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2005-10-31 02:37:29

Modified files:
	lib/format_text: format-text.c 

Log message:
	A pvresize implementation (Zak Kipling).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.46&r2=1.47


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2005-04-06 16:35 agk
  0 siblings, 0 replies; 15+ messages in thread
From: agk @ 2005-04-06 16:35 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2005-04-06 16:35:34

Modified files:
	lib/format_text: format-text.c 

Log message:
	_vg_posn -> _find_vg_rlocn

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39


^ permalink raw reply	[flat|nested] 15+ messages in thread
* LVM2/lib/format_text format-text.c
@ 2004-05-05 18:17 agk
  0 siblings, 0 replies; 15+ messages in thread
From: agk @ 2004-05-05 18:17 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2004-05-05 18:17:48

Modified files:
	lib/format_text: format-text.c 

Log message:
	lvm2 format sets unlimited_vols format flag.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33


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

end of thread, other threads:[~2012-02-27  9:54 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-29 11:16 LVM2/lib/format_text format-text.c zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2012-02-27  9:54 zkabelac
2011-03-02 10:23 prajnoha
2011-02-28 17:05 prajnoha
2011-02-25 13:50 prajnoha
2011-02-21 12:25 prajnoha
2010-08-26 12:22 mbroz
2010-06-29 13:29 wysochanski
2010-06-28 20:30 wysochanski
2009-07-31 14:23 snitzer
2009-07-30 17:41 snitzer
2006-04-21 15:37 agk
2005-10-31  2:37 agk
2005-04-06 16:35 agk
2004-05-05 18:17 agk

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).