Linux LVM users
 help / color / mirror / Atom feed
* [linux-lvm] Patch for /proc (NOT a bug fix)
@ 2002-05-01 14:28 Stephenson, Dale
  2002-05-06  5:33 ` Heinz J . Mauelshagen
  2002-05-06  8:34 ` Heinz J . Mauelshagen
  0 siblings, 2 replies; 3+ messages in thread
From: Stephenson, Dale @ 2002-05-01 14:28 UTC (permalink / raw)
  To: 'linux-lvm@sistina.com'

This patch doesn't attempt to solve any bugs.  I just wanted to get more
useful information about snapshots from /proc -- little things like the
snapshots' actual size, what volume is its source, and how much of its space
it has used.  Yes, all this information is available from /sbin/lvdisplay
(except for the *real* allocated LE, which you have to figure by hand).  But
I like using /proc.

I put the extra (conditional) lines before the "device:" line because the
optional stripesize line was already there.

I'd like to fit the snapshot/snapshot-source bit into the status bits in
/proc/lvm/global too, but I haven't done it yet.

Dale J. Stephenson
steph@snapserver.com

--- linux/drivers/md/lvm-fs.c.orig	Mon Apr 22 12:14:59 2002
+++ linux/drivers/md/lvm-fs.c	Mon Apr 22 13:44:03 2002
@@ -285,6 +285,26 @@
 		sz += sprintf(page + sz, "stripesize:   %u\n",
 			      lv->lv_stripesize);
 	}
+	if (lv->lv_access & LV_SNAPSHOT) {
+		sz += sprintf(page + sz, "remap total:  %u\n",
+			      lv->lv_remap_end * lv->lv_chunk_size / 2);
+		sz += sprintf(page + sz, "remap used:   %u\n",
+			      lv->lv_remap_ptr * lv->lv_chunk_size / 2);
+		sz += sprintf(page + sz, "snapshot LE:  %u\n",
+			      lv->lv_allocated_snapshot_le);
+		if (lv->lv_snapshot_org != NULL) {
+			sz += sprintf(page + sz, "source:       %s\n",
+				      lv->lv_snapshot_org->lv_name);
+		}
+	}
+	if (lv->lv_access & LV_SNAPSHOT_ORG) {
+		lv_t *lvp = lv->lv_snapshot_next;
+		while (lvp != NULL) {
+			sz += sprintf(page + sz, "source of:    %s\n",
+				      lvp->lv_name);
+			lvp = lvp->lv_snapshot_next;
+		}
+	}
 	sz += sprintf(page + sz, "device:       %02u:%02u\n",
 		      MAJOR(lv->lv_dev), MINOR(lv->lv_dev));
 

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

end of thread, other threads:[~2002-05-06  8:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-01 14:28 [linux-lvm] Patch for /proc (NOT a bug fix) Stephenson, Dale
2002-05-06  5:33 ` Heinz J . Mauelshagen
2002-05-06  8:34 ` Heinz J . Mauelshagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox