[Ocfs2-tools-devel] [PATCH 2/7] mounted.ocfs2: Add the stack/local to the output

Sunil Mushran sunil.mushran at oracle.com
Fri Mar 5 11:59:52 PST 2010


Device                FS     Stack  UUID                              Label
/dev/sdb1             ocfs2  local  2D1C9636FE38462DB43A75D1DA592207  vmvol
/dev/sdj1             ocfs2  o2cb   FF2E239B02D941FEAF25BDAE8DD553B9  dbstore

Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
---
 include/ocfs2/ocfs2.h   |    1 +
 libocfs2/checkhb.c      |   10 ++++++++++
 mounted.ocfs2/mounted.c |    9 +++++----
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/include/ocfs2/ocfs2.h b/include/ocfs2/ocfs2.h
index b9da66c..28fb2b0 100644
--- a/include/ocfs2/ocfs2.h
+++ b/include/ocfs2/ocfs2.h
@@ -224,6 +224,7 @@ struct _ocfs2_devices {
 	int mount_flags;
 	int fs_type;			/* 0=unknown, 1=ocfs, 2=ocfs2 */
 	int hb_dev;
+	char stack[8];			/* Local, O2CB, CMAN, PCMK */
 	uint32_t maj_num;		/* major number of the device */
 	uint32_t min_num;		/* minor number of the device */
 	errcode_t errcode;		/* error encountered reading device */
diff --git a/libocfs2/checkhb.c b/libocfs2/checkhb.c
index c171d6c..0c28f80 100644
--- a/libocfs2/checkhb.c
+++ b/libocfs2/checkhb.c
@@ -96,6 +96,16 @@ errcode_t ocfs2_check_heartbeats(struct list_head *dev_list, int ignore_local)
 		memcpy(dev->uuid, OCFS2_RAW_SB(fs->fs_super)->s_uuid,
 		       sizeof(dev->uuid));
 
+		if (OCFS2_HAS_INCOMPAT_FEATURE(OCFS2_RAW_SB(fs->fs_super),
+					OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT))
+			snprintf(dev->stack, sizeof(dev->stack), "%s", "local");
+		else if (ocfs2_userspace_stack(OCFS2_RAW_SB(fs->fs_super)))
+			snprintf(dev->stack, sizeof(dev->stack), "%.*s",
+				 OCFS2_STACK_LABEL_LEN,
+				 OCFS2_RAW_SB(fs->fs_super)->s_cluster_info.ci_stack);
+		else
+			snprintf(dev->stack, sizeof(dev->stack), "%s", "o2cb");
+
 		if (dev->hb_dev)
 			goto close;
 
diff --git a/mounted.ocfs2/mounted.c b/mounted.ocfs2/mounted.c
index d610ece..10d421e 100644
--- a/mounted.ocfs2/mounted.c
+++ b/mounted.ocfs2/mounted.c
@@ -145,7 +145,8 @@ static void ocfs2_print_quick_detect(struct list_head *dev_list)
 	int i;
 	char *p;
 
-	printf("%-20s  %-5s  %-32s  %-s\n", "Device", "FS", "UUID", "Label");
+	printf("%-20s  %-5s  %-5s  %-32s  %-s\n", "Device", "FS", "Stack",
+	       "UUID", "Label");
 	list_for_each(pos, dev_list) {
 		dev = list_entry(pos, ocfs2_devices, list);
 		if (dev->fs_type == 0)
@@ -156,9 +157,9 @@ static void ocfs2_print_quick_detect(struct list_head *dev_list)
 			p += 2;
 		}
 
-		printf("%-20s  %-5s  %-32s  %-s\n", dev->dev_name,
-		       (dev->fs_type == 2 ? "ocfs2" : "ocfs"), uuid,
-		       dev->label);
+		printf("%-20s  %-5s  %-5s  %-32s  %-s\n", dev->dev_name,
+		       (dev->fs_type == 2 ? "ocfs2" : "ocfs"), dev->stack,
+		       uuid, dev->label);
 	}
 }
 
-- 
1.6.3.3




More information about the Ocfs2-tools-devel mailing list