Skip to contentSkip to conversation

master - thin: read table line with thin device id

PATCH Zdenek Kabelac 1 participant 1 message Dec 4, 2013

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=572983d7931eac9347dad79b7d9b13f640bfaeaf
Commit:        572983d7931eac9347dad79b7d9b13f640bfaeaf
Parent:        cf7f4512384bac494fd352762f685377e2f10034
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Wed Dec 4 13:57:27 2013 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Dec 4 14:30:25 2013 +0100

thin: read table line with thin device id

Add functions to parse thin table line to
obtain thin device id.

---
 WHATS_NEW                  |    1 +
 lib/activate/activate.c    |   22 +++++++++++++++++++
 lib/activate/activate.h    |    1 +
 lib/activate/dev_manager.c |   50 ++++++++++++++++++++++++++++++++++++++++++++
 lib/activate/dev_manager.h |    3 ++
 5 files changed, 77 insertions(+), 0 deletions(-)
WHATS_NEW +1 -0
index cba7c8f..c81cb7a 100644
@@ -1,5 +1,6 @@
 Version 2.02.105 -
 =====================================
+  Add support to read thin device id from table line entry.
   Drop extra test for origin when testing merging origin in lv_refresh().
   Extend lv_remove_single() to not print info about removed LV.
   Replace open_count check with lv_check_not_in_use() for snapshot open test.
lib/activate/activate.c +22 -0
index f75f1cf..80eef32 100644
@@ -1051,6 +1051,28 @@ int lv_thin_pool_transaction_id(const struct logical_volume *lv,
 	return r;
 }
 
+int lv_thin_device_id(const struct logical_volume *lv, uint32_t *device_id)
+{
+	int r;
+	struct dev_manager *dm;
+
+	if (!activation())
+		return 0;
+
+	log_debug_activation("Checking device id for LV %s/%s",
+			     lv->vg->name, lv->name);
+
+	if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
+		return_0;
+
+	if (!(r = dev_manager_thin_device_id(dm, lv, device_id)))
+		stack;
+
+	dev_manager_destroy(dm);
+
+	return r;
+}
+
 static int _lv_active(struct cmd_context *cmd, const struct logical_volume *lv)
 {
 	struct lvinfo info;
lib/activate/activate.h +1 -0
index df888cd..1881f75 100644
@@ -140,6 +140,7 @@ int lv_thin_percent(const struct logical_volume *lv, int mapped,
 		    percent_t *percent);
 int lv_thin_pool_transaction_id(const struct logical_volume *lv,
 				uint64_t *transaction_id);
+int lv_thin_device_id(const struct logical_volume *lv, uint32_t *device_id);
 
 /*
  * Return number of LVs in the VG that are active.
lib/activate/dev_manager.c +50 -0

56 lines not on this page · raw message

lib/activate/dev_manager.h +3 -0
index ecf3c5f..032766e 100644
@@ -70,6 +70,9 @@ int dev_manager_thin_pool_percent(struct dev_manager *dm,
 int dev_manager_thin_percent(struct dev_manager *dm,
 			     const struct logical_volume *lv,
 			     int mapped, percent_t *percent);
+int dev_manager_thin_device_id(struct dev_manager *dm,
+			       const struct logical_volume *lv,
+			       uint32_t *device_id);
 int dev_manager_suspend(struct dev_manager *dm, struct logical_volume *lv,
 			struct lv_activate_opts *laopts, int lockfs, int flush_required);
 int dev_manager_activate(struct dev_manager *dm, struct logical_volume *lv,