All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] lvm2app: Implementation of pv resize (v6)
@ 2013-04-01 21:34 Tony Asleson
  2013-04-01 21:34 ` [PATCH 2/7] lvm2app: Move percent_of_extents to lvm-percent.[h|c] Tony Asleson
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Tony Asleson @ 2013-04-01 21:34 UTC (permalink / raw)
  To: lvm-devel

Signed-off-by: Tony Asleson <tasleson@redhat.com>
---
 liblvm/lvm2app.h |  2 --
 liblvm/lvm_pv.c  | 20 +++++++++++++++++---
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/liblvm/lvm2app.h b/liblvm/lvm2app.h
index 93a78c3..935c53b 100644
--- a/liblvm/lvm2app.h
+++ b/liblvm/lvm2app.h
@@ -1626,8 +1626,6 @@ pv_t lvm_pv_from_uuid(vg_t vg, const char *uuid);
  *
  * \memberof pv_t
  *
- * NOTE: This function is currently not implemented.
- *
  * \param   pv
  * Physical volume handle.
  *
diff --git a/liblvm/lvm_pv.c b/liblvm/lvm_pv.c
index 90edaed..bf9f630 100644
--- a/liblvm/lvm_pv.c
+++ b/liblvm/lvm_pv.c
@@ -123,7 +123,21 @@ pv_t lvm_pv_from_uuid(vg_t vg, const char *uuid)
 
 int lvm_pv_resize(const pv_t pv, uint64_t new_size)
 {
-	/* FIXME: add pv resize code here */
-	log_error("NOT IMPLEMENTED YET");
-	return -1;
+	uint64_t size = new_size >> SECTOR_SHIFT;
+
+	if (new_size % SECTOR_SIZE) {
+		log_errno(EINVAL, "Size not a multiple of 512");
+		return -1;
+	}
+
+	if (!vg_check_write_mode(pv->vg)) {
+		return -1;
+	}
+
+	if (!pv_resize(pv, pv->vg, size)) {
+		log_error("PV re-size failed!");
+		return -1;
+	} else {
+		return 0;
+	}
 }
-- 
1.8.1.4



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

end of thread, other threads:[~2013-04-16  8:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-01 21:34 [PATCH 1/7] lvm2app: Implementation of pv resize (v6) Tony Asleson
2013-04-01 21:34 ` [PATCH 2/7] lvm2app: Move percent_of_extents to lvm-percent.[h|c] Tony Asleson
2013-04-01 21:34 ` [PATCH 3/7] lvm2app: Rework argument handling for lv resize Tony Asleson
2013-04-01 21:34 ` [PATCH 4/7] lvm2app: Move core lv re-size code (v2) Tony Asleson
2013-04-01 21:34 ` [PATCH 5/7] lvm2app: Implement lv resize (v2) Tony Asleson
2013-04-01 21:35 ` [PATCH 6/7] lvm2app: Add function to retrieve list of PVs Tony Asleson
2013-04-01 21:35 ` [PATCH 7/7] config_def_check: Fix memory leak Tony Asleson
2013-04-16  8:47   ` Peter Rajnoha

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.