public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/format1/disk-rep.h lib/fo ...
@ 2006-10-19 12:53 agk
  0 siblings, 0 replies; 3+ messages in thread
From: agk @ 2006-10-19 12:53 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-10-19 12:53:47

Modified files:
	.              : WHATS_NEW 
	lib/format1    : disk-rep.h format1.c import-export.c 
	lib/format_text: import_vsn1.c 

Log message:
	Set PV size to current device size if it is found to be zero.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.474&r2=1.475
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/disk-rep.h.diff?cvsroot=lvm2&r1=1.48&r2=1.49
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/format1.c.diff?cvsroot=lvm2&r1=1.98&r2=1.99
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-export.c.diff?cvsroot=lvm2&r1=1.83&r2=1.84
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.36&r2=1.37

--- LVM2/WHATS_NEW	2006/10/18 18:01:51	1.474
+++ LVM2/WHATS_NEW	2006/10/19 12:53:46	1.475
@@ -1,5 +1,6 @@
 Version 2.02.13 -
 ===================================
+  Set PV size to current device size if it is found to be zero.
   Add segment parameter to target_present functions.
 
 Version 2.02.12 - 16th October 2006
--- LVM2/lib/format1/disk-rep.h	2006/08/17 19:15:27	1.48
+++ LVM2/lib/format1/disk-rep.h	2006/10/19 12:53:46	1.49
@@ -203,8 +203,8 @@
  * Functions to translate to between disk and in
  * core structures.
  */
-int import_pv(struct dm_pool *mem, struct device *dev,
-	      struct volume_group *vg,
+int import_pv(const struct format_type *fmt, struct dm_pool *mem,
+	      struct device *dev, struct volume_group *vg,
 	      struct physical_volume *pv, struct pv_disk *pvd,
 	      struct vg_disk *vgd);
 int export_pv(struct cmd_context *cmd, struct dm_pool *mem,
--- LVM2/lib/format1/format1.c	2006/08/17 19:15:27	1.98
+++ LVM2/lib/format1/format1.c	2006/10/19 12:53:46	1.99
@@ -312,7 +312,7 @@
 		goto out;
 	}
 
-	if (!import_pv(fmt->cmd->mem, dl->dev, NULL, pv, &dl->pvd, &dl->vgd)) {
+	if (!import_pv(fmt, fmt->cmd->mem, dl->dev, NULL, pv, &dl->pvd, &dl->vgd)) {
 		stack;
 		goto out;
 	}
--- LVM2/lib/format1/import-export.c	2006/08/21 12:54:52	1.83
+++ LVM2/lib/format1/import-export.c	2006/10/19 12:53:46	1.84
@@ -24,6 +24,7 @@
 #include "toolcontext.h"
 #include "segtype.h"
 #include "pv_alloc.h"
+#include "display.h"
 
 #include <time.h>
 
@@ -47,11 +48,13 @@
 	return dm_pool_strdup(mem, ptr);
 }
 
-int import_pv(struct dm_pool *mem, struct device *dev,
-	      struct volume_group *vg,
+int import_pv(const struct format_type *fmt, struct dm_pool *mem,
+	      struct device *dev, struct volume_group *vg,
 	      struct physical_volume *pv, struct pv_disk *pvd,
 	      struct vg_disk *vgd)
 {
+	uint64_t size;
+
 	memset(pv, 0, sizeof(*pv));
 	memcpy(&pv->id, pvd->pv_uuid, ID_LEN);
 
@@ -89,6 +92,25 @@
 	pv->pe_count = pvd->pe_total;
 	pv->pe_alloc_count = 0;
 
+	/* Fix up pv size if missing */
+	if (!pv->size) {
+		if (!dev_get_size(dev, &pv->size)) {
+			log_error("%s: Couldn't get size.", dev_name(pv->dev));
+			return 0;
+		}
+		log_verbose("Fixing up missing format1 size (%s) "
+			    "for PV %s", display_size(fmt->cmd, pv->size),
+			    dev_name(pv->dev));
+		if (vg) {
+			size = pv->pe_count * (uint64_t) vg->extent_size +
+			       pv->pe_start;
+			if (size > pv->size)
+				log_error("WARNING: Physical Volume %s is too "
+					  "large for underlying device",
+					  dev_name(pv->dev));
+		}
+	}
+
 	list_init(&pv->tags);
 	list_init(&pv->segments);
 
@@ -427,7 +449,7 @@
 			return 0;
 		}
 
-		if (!import_pv(mem, dl->dev, vg, pvl->pv, &dl->pvd, &dl->vgd)) {
+		if (!import_pv(fmt, mem, dl->dev, vg, pvl->pv, &dl->pvd, &dl->vgd)) {
 			stack;
 			return 0;
 		}
--- LVM2/lib/format_text/import_vsn1.c	2006/10/07 23:17:17	1.36
+++ LVM2/lib/format_text/import_vsn1.c	2006/10/19 12:53:47	1.37
@@ -116,6 +116,7 @@
 	struct physical_volume *pv;
 	struct pv_list *pvl;
 	struct config_node *cn;
+	uint64_t size;
 
 	if (!(pvl = dm_pool_zalloc(mem, sizeof(*pvl))) ||
 	    !(pvl->pv = dm_pool_zalloc(mem, sizeof(*pvl->pv)))) {
@@ -213,6 +214,25 @@
 	pv->pe_alloc_count = 0;
 	pv->fmt = fid->fmt;
 
+        /* Fix up pv size if missing */
+        if (!pv->size && pv->dev) {
+                if (!dev_get_size(pv->dev, &pv->size)) {
+                        log_error("%s: Couldn't get size.", dev_name(pv->dev));
+                        return 0;
+                }
+                log_verbose("Fixing up missing format1 size (%s) "
+                            "for PV %s", display_size(fid->fmt->cmd, pv->size),
+                            dev_name(pv->dev));
+                if (vg) {
+                        size = pv->pe_count * (uint64_t) vg->extent_size +
+                               pv->pe_start;
+                        if (size > pv->size)
+                                log_error("WARNING: Physical Volume %s is too "
+                                          "large for underlying device",
+                                          dev_name(pv->dev));
+                }
+        }
+
 	if (!alloc_pv_segment_whole_pv(mem, pv)) {
 		stack;
 		return 0;


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

* LVM2 ./WHATS_NEW lib/format1/disk-rep.h lib/fo ...
@ 2006-08-17 19:15 agk
  0 siblings, 0 replies; 3+ messages in thread
From: agk @ 2006-08-17 19:15 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-08-17 19:15:27

Modified files:
	.              : WHATS_NEW 
	lib/format1    : disk-rep.h format1.c layout.c 

Log message:
	Separate out LVM1_PE_ALIGN.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.420&r2=1.421
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/disk-rep.h.diff?cvsroot=lvm2&r1=1.47&r2=1.48
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/format1.c.diff?cvsroot=lvm2&r1=1.97&r2=1.98
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/layout.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25

--- LVM2/WHATS_NEW	2006/08/17 18:23:42	1.420
+++ LVM2/WHATS_NEW	2006/08/17 19:15:27	1.421
@@ -1,5 +1,6 @@
 Version 2.02.09 - 
 ==================================
+  Separate out LVM1_PE_ALIGN.
   Add lvm_getpagesize wrapper.
   Add --maxphysicalvolumes to vgchange.
 
--- LVM2/lib/format1/disk-rep.h	2006/05/09 21:23:50	1.47
+++ LVM2/lib/format1/disk-rep.h	2006/08/17 19:15:27	1.48
@@ -172,6 +172,7 @@
  * Layout constants.
  */
 #define METADATA_ALIGN 4096UL
+#define LVM1_PE_ALIGN (65536UL >> SECTOR_SHIFT)      /* PE alignment */
 
 #define	METADATA_BASE 0UL
 #define	PV_SIZE 1024UL
--- LVM2/lib/format1/format1.c	2006/05/09 21:23:50	1.97
+++ LVM2/lib/format1/format1.c	2006/08/17 19:15:27	1.98
@@ -408,7 +408,7 @@
 
 	/* Ensure any residual PE structure is gone */
 	pv->pe_size = pv->pe_count = 0;
-	pv->pe_start = PE_ALIGN;
+	pv->pe_start = LVM1_PE_ALIGN;
 
 	if (!(mem = dm_pool_create("lvm1 pv_write", 1024))) {
 		stack;
@@ -431,7 +431,7 @@
 	   dev_write in order to make other disk tools happy */
 	dl->pvd.pv_on_disk.base = METADATA_BASE;
 	dl->pvd.pv_on_disk.size = PV_SIZE;
-	dl->pvd.pe_on_disk.base = PE_ALIGN << SECTOR_SHIFT;
+	dl->pvd.pe_on_disk.base = LVM1_PE_ALIGN << SECTOR_SHIFT;
 
 	list_add(&pvs, &dl->list);
 	if (!write_disks(fmt, &pvs)) {
--- LVM2/lib/format1/layout.c	2006/04/19 15:33:06	1.24
+++ LVM2/lib/format1/layout.c	2006/08/17 19:15:27	1.25
@@ -153,7 +153,7 @@
 		if (pe_start && end < pe_start)
 			end = pe_start;
 
-		pvd->pe_start = _round_up(end, PE_ALIGN);
+		pvd->pe_start = _round_up(end, LVM1_PE_ALIGN);
 
 	} while ((pvd->pe_start + (pvd->pe_total * extent_size))
 		 > pv->size);


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

* LVM2 ./WHATS_NEW lib/format1/disk-rep.h lib/fo ...
@ 2006-05-04  9:33 agk
  0 siblings, 0 replies; 3+ messages in thread
From: agk @ 2006-05-04  9:33 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-05-04 09:33:42

Modified files:
	.              : WHATS_NEW 
	lib/format1    : disk-rep.h import-export.c 

Log message:
	sign fix

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.375&r2=1.376
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/disk-rep.h.diff?cvsroot=lvm2&r1=1.45&r2=1.46
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-export.c.diff?cvsroot=lvm2&r1=1.79&r2=1.80


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

end of thread, other threads:[~2006-10-19 12:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-19 12:53 LVM2 ./WHATS_NEW lib/format1/disk-rep.h lib/fo agk
  -- strict thread matches above, loose matches on Subject: below --
2006-08-17 19:15 agk
2006-05-04  9:33 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).