[Ocfs-tools-commits]
smushran commits r111 - in trunk/ocfs2/debugfs.ocfs2: . include
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Jun 28 19:38:08 CDT 2004
Author: smushran
Date: 2004-06-28 18:38:05 -0500 (Mon, 28 Jun 2004)
New Revision: 111
Modified:
trunk/ocfs2/debugfs.ocfs2/commands.c
trunk/ocfs2/debugfs.ocfs2/dump.c
trunk/ocfs2/debugfs.ocfs2/include/main.h
trunk/ocfs2/debugfs.ocfs2/include/utils.h
trunk/ocfs2/debugfs.ocfs2/utils.c
Log:
publish and vote displayed
Modified: trunk/ocfs2/debugfs.ocfs2/commands.c
===================================================================
--- trunk/ocfs2/debugfs.ocfs2/commands.c 2004-06-28 19:53:44 UTC (rev 110)
+++ trunk/ocfs2/debugfs.ocfs2/commands.c 2004-06-28 23:38:05 UTC (rev 111)
@@ -65,6 +65,7 @@
static void do_config (char **args);
static void do_publish (char **args);
static void do_vote (char **args);
+static void do_cat (char **args);
extern gboolean allow_write;
@@ -117,7 +118,10 @@
{ "nodes", do_config },
{ "publish", do_publish },
- { "vote", do_vote }
+ { "vote", do_vote },
+
+ { "cat", do_cat }
+
};
@@ -518,3 +522,37 @@
return ;
} /* do_vote */
+
+/*
+ * do_cat()
+ *
+ */
+static void do_cat (char **args)
+{
+#if 0
+ char *opts = args[1];
+ ocfs2_dinode *inode;
+ __u32 blknum = 0;
+ char *buf = NULL;
+ __u32 buflen;
+
+ if (opts)
+ blknum = atoi(opts);
+
+ if (!blknum)
+ goto bail;
+
+ buflen = 1 << blksz_bits;
+ if (!(buf = malloc(buflen)))
+ DBGFS_FATAL("%s", strerror(errno));
+
+ if ((read_inode (dev_fd, blknum, buf, buflen)) == -1) {
+ printf("Not an inode\n");
+ goto bail;
+ }
+ inode = (ocfs2_dinode *)buf;
+
+bail:
+#endif
+ return ;
+} /* do_cat */
Modified: trunk/ocfs2/debugfs.ocfs2/dump.c
===================================================================
--- trunk/ocfs2/debugfs.ocfs2/dump.c 2004-06-28 19:53:44 UTC (rev 110)
+++ trunk/ocfs2/debugfs.ocfs2/dump.c 2004-06-28 23:38:05 UTC (rev 111)
@@ -280,7 +280,7 @@
ocfs_node_config_info *node;
ocfs2_super_block *sb = &(((ocfs2_dinode *)superblk)->id2.i_super);
__u16 port;
- char *addr;
+ char addr[32];
struct in_addr ina;
int i;
@@ -297,9 +297,13 @@
p = buf + (2 << blksz_bits);
for (i = 0; i < sb->s_max_nodes; ++i) {
node = (ocfs_node_config_info *)p;
- port = htonl(node->ipc_config.ip_port);
+ if (!*node->node_name)
+ continue;
+
+ port = htonl(node->ipc_config.ip_port);
+
ina.s_addr = node->ipc_config.addr_u.ip_addr4;
- addr = inet_ntoa(ina);
+ strcpy (addr, inet_ntoa(ina));
printf("%-4u %-32s %-15s %-6u ", i, node->node_name, addr, port);
for (i = 0; i < 16; i++)
@@ -315,8 +319,38 @@
*/
void dump_publish (char *buf)
{
+ ocfs_publish *pub;
+ char *p;
+ GString *pub_flag;
+ ocfs2_super_block *sb = &(((ocfs2_dinode *)superblk)->id2.i_super);
+ __u32 i, j;
+ printf("%-2s %-3s %-3s %-3s %-15s %-15s %-15s %-*s %-s\n",
+ "No", "Mnt", "Vot", "Dty", "LockId", "Seq", "Time", sb->s_max_nodes,
+ "Map", "Type");
+ p = buf + ((2 + 4 + sb->s_max_nodes) << blksz_bits);
+ for (i = 0; i < sb->s_max_nodes; ++i) {
+ pub = (ocfs_publish *)p;
+
+ pub_flag = g_string_new (NULL);
+ get_publish_flag (pub->vote_type, pub_flag);
+
+ printf("%-2d %1u %1u %1u %-15llu %-15llu %-15llu ",
+ i, pub->mounted, pub->vote, pub->dirty, pub->lock_id,
+ pub->publ_seq_num, pub->time);
+
+ for (j = 0; j < sb->s_max_nodes; j++)
+ printf ("%d", ((pub->vote_map & (1 << j)) ? 1 : 0));
+
+ printf(" %-s\n", pub_flag->str);
+
+ g_string_free (pub_flag, 1);
+
+ p += (1 << blksz_bits);
+ }
+
+ return ;
} /* dump_publish */
/*
@@ -325,6 +359,29 @@
*/
void dump_vote (char *buf)
{
+ ocfs_vote *vote;
+ char *p;
+ GString *vote_flag;
+ ocfs2_super_block *sb = &(((ocfs2_dinode *)superblk)->id2.i_super);
+ __u32 i;
+ printf("%-2s %-2s %-1s %-15s %-15s %-s\n",
+ "No", "NV", "O", "LockId", "Seq", "Type");
+ p = buf + ((2 + 4 + sb->s_max_nodes + sb->s_max_nodes) << blksz_bits);
+ for (i = 0; i < sb->s_max_nodes; ++i) {
+ vote = (ocfs_vote *)p;
+
+ vote_flag = g_string_new (NULL);
+ get_vote_flag (vote->type, vote_flag);
+
+ printf("%-2u %-2u %-1u %-15llu %-15llu %-s\n", i,
+ vote->node, vote->open_handle, vote->lock_id,
+ vote->vote_seq_num, vote_flag->str);
+
+ g_string_free (vote_flag, 1);
+ p += (1 << blksz_bits);
+ }
+
+ return ;
} /* dump_vote */
Modified: trunk/ocfs2/debugfs.ocfs2/include/main.h
===================================================================
--- trunk/ocfs2/debugfs.ocfs2/include/main.h 2004-06-28 19:53:44 UTC (rev 110)
+++ trunk/ocfs2/debugfs.ocfs2/include/main.h 2004-06-28 23:38:05 UTC (rev 111)
@@ -75,4 +75,46 @@
#define DBGFS_WARN_STR(str) DBGFS_WARN(str, "")
+
+/* Publish flags */
+#define FLAG_FILE_CREATE 0x00000001
+#define FLAG_FILE_EXTEND 0x00000002
+#define FLAG_FILE_DELETE 0x00000004
+#define FLAG_FILE_RENAME 0x00000008
+#define FLAG_FILE_UPDATE 0x00000010
+#define FLAG_FILE_RECOVERY 0x00000020
+#define FLAG_FILE_CREATE_DIR 0x00000040
+#define FLAG_FILE_UPDATE_OIN 0x00000080
+#define FLAG_FILE_RELEASE_MASTER 0x00000100
+#define FLAG_RELEASE_DENTRY 0x00000200
+#define FLAG_CHANGE_MASTER 0x00000400
+#define FLAG_ADD_OIN_MAP 0x00000800
+#define FLAG_DIR 0x00001000
+#define FLAG_REMASTER 0x00002000
+#define FLAG_FAST_PATH_LOCK 0x00004000
+#define FLAG_FILE_UNUSED5 0x00008000
+#define FLAG_FILE_UNUSED6 0x00010000
+//#define FLAG_DEL_NAME 0x00020000
+//#define FLAG_DEL_INODE 0x00040000
+#define FLAG_FILE_UNUSED7 0x00080000
+#define FLAG_FILE_UNUSED8 0x00100000
+#define FLAG_FILE_UNUSED9 0x00200000
+#define FLAG_FILE_RELEASE_CACHE 0x00400000
+#define FLAG_FILE_UNUSED10 0x00800000
+#define FLAG_FILE_UNUSED11 0x01000000
+#define FLAG_FILE_UNUSED12 0x02000000
+#define FLAG_FILE_UNUSED13 0x04000000
+#define FLAG_FILE_TRUNCATE 0x08000000
+#define FLAG_DROP_READONLY 0x10000000
+#define FLAG_READDIR 0x20000000
+#define FLAG_ACQUIRE_LOCK 0x40000000
+#define FLAG_RELEASE_LOCK 0x80000000
+
+/* Vote flags */
+#define FLAG_VOTE_NODE 0x1
+#define FLAG_VOTE_OIN_UPDATED 0x2
+#define FLAG_VOTE_OIN_ALREADY_INUSE 0x4
+#define FLAG_VOTE_UPDATE_RETRY 0x8
+#define FLAG_VOTE_FILE_DEL 0x10
+
#endif /* __MAIN_H__ */
Modified: trunk/ocfs2/debugfs.ocfs2/include/utils.h
===================================================================
--- trunk/ocfs2/debugfs.ocfs2/include/utils.h 2004-06-28 19:53:44 UTC (rev 110)
+++ trunk/ocfs2/debugfs.ocfs2/include/utils.h 2004-06-28 23:38:05 UTC (rev 111)
@@ -28,5 +28,7 @@
void add_extent_rec (GArray *arr, ocfs2_extent_rec *rec);
void add_dir_rec (GArray *arr, struct ocfs2_dir_entry *rec);
+void get_vote_flag (__u32 flag, GString *str);
+void get_publish_flag (__u32 flag, GString *str);
#endif /* __UTILS_H__ */
Modified: trunk/ocfs2/debugfs.ocfs2/utils.c
===================================================================
--- trunk/ocfs2/debugfs.ocfs2/utils.c 2004-06-28 19:53:44 UTC (rev 110)
+++ trunk/ocfs2/debugfs.ocfs2/utils.c 2004-06-28 23:38:05 UTC (rev 111)
@@ -76,3 +76,121 @@
return ;
} /* add_dir_rec */
+
+/*
+ * get_vote_flag()
+ *
+ */
+void get_vote_flag (__u32 flag, GString *str)
+{
+ if (flag & FLAG_VOTE_NODE)
+ g_string_append (str, "ok ");
+
+ if (flag & FLAG_VOTE_OIN_UPDATED)
+ g_string_append (str, "oin_upd ");
+
+ if (flag & FLAG_VOTE_OIN_ALREADY_INUSE)
+ g_string_append (str, "inuse ");
+
+ if (flag & FLAG_VOTE_UPDATE_RETRY)
+ g_string_append (str, "retry ");
+
+ if (flag & FLAG_VOTE_FILE_DEL)
+ g_string_append (str, "del ");
+
+ if (flag & ~(FLAG_VOTE_NODE | FLAG_VOTE_OIN_UPDATED |
+ FLAG_VOTE_OIN_ALREADY_INUSE |
+ FLAG_VOTE_UPDATE_RETRY | FLAG_VOTE_FILE_DEL))
+ g_string_append (str, "unknown");
+
+ if (!str->len)
+ g_string_append (str, "none");
+
+ return ;
+} /* get_vote_flag */
+
+/*
+ * get_publish_flag()
+ *
+ */
+void get_publish_flag (__u32 flag, GString *str)
+{
+ if (flag & FLAG_FILE_CREATE)
+ g_string_append (str, "create ");
+
+ if (flag & FLAG_FILE_EXTEND)
+ g_string_append (str, "extend ");
+
+ if (flag & FLAG_FILE_DELETE)
+ g_string_append (str, "delete ");
+
+ if (flag & FLAG_FILE_RENAME)
+ g_string_append (str, "rename ");
+
+ if (flag & FLAG_FILE_UPDATE)
+ g_string_append (str, "update ");
+
+ if (flag & FLAG_FILE_RECOVERY)
+ g_string_append (str, "recovery ");
+
+ if (flag & FLAG_FILE_CREATE_DIR)
+ g_string_append (str, "createdir ");
+
+ if (flag & FLAG_FILE_UPDATE_OIN)
+ g_string_append (str, "upd_oin ");
+
+ if (flag & FLAG_FILE_RELEASE_MASTER)
+ g_string_append (str, "rls_mstr ");
+
+ if (flag & FLAG_RELEASE_DENTRY)
+ g_string_append (str, "rls_dntry ");
+
+ if (flag & FLAG_CHANGE_MASTER)
+ g_string_append (str, "chng_mstr ");
+
+ if (flag & FLAG_ADD_OIN_MAP)
+ g_string_append (str, "add_oin ");
+
+ if (flag & FLAG_DIR)
+ g_string_append (str, "dir ");
+
+ if (flag & FLAG_REMASTER)
+ g_string_append (str, "re_mstr ");
+
+ if (flag & FLAG_FAST_PATH_LOCK)
+ g_string_append (str, "fast_path");
+
+ if (flag & FLAG_FILE_RELEASE_CACHE)
+ g_string_append (str, "rls_cache ");
+
+ if (flag & FLAG_FILE_TRUNCATE)
+ g_string_append (str, "trunc ");
+
+ if (flag & FLAG_DROP_READONLY)
+ g_string_append (str, "drop_ro ");
+
+ if (flag & FLAG_READDIR)
+ g_string_append (str, "rddir ");
+
+ if (flag & FLAG_ACQUIRE_LOCK)
+ g_string_append (str, "acq ");
+
+ if (flag & FLAG_RELEASE_LOCK)
+ g_string_append (str, "rls ");
+
+ if (flag & ~(FLAG_FILE_CREATE | FLAG_FILE_EXTEND | FLAG_FILE_DELETE |
+ FLAG_FILE_RENAME | FLAG_FILE_UPDATE | FLAG_FILE_RECOVERY |
+ FLAG_FILE_CREATE_DIR | FLAG_FILE_UPDATE_OIN |
+ FLAG_FILE_RELEASE_MASTER | FLAG_RELEASE_DENTRY |
+ FLAG_CHANGE_MASTER | FLAG_ADD_OIN_MAP | FLAG_DIR |
+ FLAG_REMASTER | FLAG_FAST_PATH_LOCK |
+ FLAG_FILE_RELEASE_CACHE | FLAG_FILE_TRUNCATE |
+ FLAG_DROP_READONLY | FLAG_READDIR | FLAG_ACQUIRE_LOCK |
+ FLAG_RELEASE_LOCK))
+ g_string_append (str, "unknown");
+
+ if (!str->len)
+ g_string_append (str, "none");
+
+ return ;
+} /* get_publish_flag */
More information about the Ocfs-tools-commits
mailing list