All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Wysochanski <dwysocha@redhat.com>
To: lvm-devel@redhat.com
Subject: [LVM2 PATCH] Add pvseg_free field to 'pvs' output
Date: Mon, 10 Sep 2007 13:58:12 -0400	[thread overview]
Message-ID: <1189447092.4444.2.camel@linux-cxyg> (raw)

Add pvseg_free field to 'pvs' output to display whether a segment
is free or allocated to an LV.  This brings pvs segment output 
closer to 'pvdisplay --maps'.

# tools/lvm pvs -o pv_name,pvseg_start,pvseg_size,pvseg_free 
  PV         Start SSize Free 
  /dev/loop1     0    32 Y    
  /dev/loop1    32    31 N    
  /dev/loop2     0    32 Y    
  /dev/loop2    32    15 Y    
  /dev/loop2    47    16 N    
  /dev/loop3     0    63 N    


---
Index: LVM2/lib/report/columns.h
===================================================================
--- LVM2.orig/lib/report/columns.h	2007-08-20 16:55:27.000000000 -0400
+++ LVM2/lib/report/columns.h	2007-09-10 13:47:33.000000000 -0400
@@ -83,4 +83,5 @@ FIELD(SEGS, seg, STR, "Devices", list, 5
 
 FIELD(PVSEGS, pvseg, NUM, "Start", pe, 5, uint32, "pvseg_start", "Physical Extent number of start of segment.")
 FIELD(PVSEGS, pvseg, NUM, "SSize", len, 5, uint32, "pvseg_size", "Number of extents in segment.")
+FIELD(PVSEGS, pvseg, STR, "Free", lvseg, 5, lvseg, "pvseg_free", "Whether the segment is free or allocated to an LV.")
 /* *INDENT-ON* */
Index: LVM2/lib/report/report.c
===================================================================
--- LVM2.orig/lib/report/report.c	2007-08-22 10:38:17.000000000 -0400
+++ LVM2/lib/report/report.c	2007-09-10 13:47:33.000000000 -0400
@@ -62,6 +62,15 @@ static char _alloc_policy_char(alloc_pol
 /*
  * Data-munging functions to prepare each data type for display and sorting
  */
+static int _lvseg_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)),
+		       struct dm_report_field *field,
+		       const void *data, void *private __attribute((unused)))
+{
+	const struct lv_segment *seg = *(const struct lv_segment **) data;
+	dm_report_field_set_value(field, seg ? "Y" : "N", NULL);
+	return 1;
+}
+
 static int _string_disp(struct dm_report *rh, struct dm_pool *mem __attribute((unused)),
 			struct dm_report_field *field,
 			const void *data, void *private __attribute((unused)))




             reply	other threads:[~2007-09-10 17:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-10 17:58 Dave Wysochanski [this message]
2007-09-10 20:07 ` [LVM2 PATCH] Add pvseg_free field to 'pvs' output Dave Wysochanski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1189447092.4444.2.camel@linux-cxyg \
    --to=dwysocha@redhat.com \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.