[Ocfs-tools-commits]
smushran commits r146 - in trunk/ocfs2/debugfs.ocfs2: . include
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Jul 7 17:57:11 CDT 2004
Author: smushran
Date: 2004-07-07 16:57:09 -0500 (Wed, 07 Jul 2004)
New Revision: 146
Modified:
trunk/ocfs2/debugfs.ocfs2/commands.c
trunk/ocfs2/debugfs.ocfs2/include/main.h
trunk/ocfs2/debugfs.ocfs2/readfs.c
Log:
logdump accessed by nodenum
Modified: trunk/ocfs2/debugfs.ocfs2/commands.c
===================================================================
--- trunk/ocfs2/debugfs.ocfs2/commands.c 2004-07-07 18:00:52 UTC (rev 145)
+++ trunk/ocfs2/debugfs.ocfs2/commands.c 2004-07-07 21:57:09 UTC (rev 146)
@@ -391,7 +391,7 @@
printf ("nodes\t\t\t\tList of nodes\n");
printf ("publish\t\t\t\tPublish blocks\n");
printf ("vote\t\t\t\tVote blocks\n");
- printf ("logdump <blknum>\t\tPrints journal file\n");
+ printf ("logdump <nodenum>\t\tPrints journal file for the node\n");
printf ("help, ?\t\t\t\tThis information\n");
printf ("quit, q\t\t\t\tExit the program\n");
} /* do_help */
@@ -640,12 +640,23 @@
__u64 blknum = 0;
__s32 len = 0;
FILE *out;
+ __u32 nodenum;
+ ocfs2_super_block *sb = &(gbls.superblk->id2.i_super);
if (args[1])
- blknum = strtoull (args[1], NULL, 0);
- if (!blknum)
+ nodenum = strtoull (args[1], NULL, 0);
+ else {
+ printf ("No node number specified\n");
goto bail;
+ }
+ if (nodenum >= sb->s_max_nodes) {
+ printf ("Invalid node number specified\n");
+ goto bail;
+ }
+
+ blknum = gbls.journal_blkno[nodenum];
+
if (gbls.dev_fd == -1)
printf ("device not open\n");
else {
Modified: trunk/ocfs2/debugfs.ocfs2/include/main.h
===================================================================
--- trunk/ocfs2/debugfs.ocfs2/include/main.h 2004-07-07 18:00:52 UTC (rev 145)
+++ trunk/ocfs2/debugfs.ocfs2/include/main.h 2004-07-07 21:57:09 UTC (rev 146)
@@ -70,6 +70,7 @@
__u64 root_blkno;
__u64 sysdir_blkno;
__u64 dlm_blkno;
+ __u64 journal_blkno[256];
char *curdir;
ocfs2_dinode *superblk;
ocfs2_dinode *rootin;
Modified: trunk/ocfs2/debugfs.ocfs2/readfs.c
===================================================================
--- trunk/ocfs2/debugfs.ocfs2/readfs.c 2004-07-07 18:00:52 UTC (rev 145)
+++ trunk/ocfs2/debugfs.ocfs2/readfs.c 2004-07-07 21:57:09 UTC (rev 146)
@@ -234,7 +234,10 @@
struct ocfs2_dir_entry *rec;
GArray *dirarr = NULL;
char *dlm = ocfs2_system_inode_names[DLM_SYSTEM_INODE];
- unsigned int i;
+ unsigned int i, j;
+ char *journal[256];
+ ocfs2_super_block *sb = &((gbls.superblk)->id2.i_super);
+ char tmpstr[40];
inode = (ocfs2_dinode *)sysdir;
@@ -247,16 +250,34 @@
read_dir (fd, &(inode->id2.i_list), inode->i_size, dirarr);
+ /* generate journal sysfile names */
+ for (i = 0; i < sb->s_max_nodes; ++i) {
+ snprintf (tmpstr, sizeof(tmpstr),
+ ocfs2_system_inode_names[JOURNAL_SYSTEM_INODE], i);
+ journal[i] = strdup (tmpstr);
+ gbls.journal_blkno[i] = 0;
+ }
+
for (i = 0; i < dirarr->len; ++i) {
rec = &(g_array_index(dirarr, struct ocfs2_dir_entry, i));
- if (!strncmp (rec->name, dlm, strlen(dlm)))
+ if (!strncmp (rec->name, dlm, strlen(dlm))) {
gbls.dlm_blkno = rec->inode;
+ continue;
+ }
+ for (j = 0; j < sb->s_max_nodes; ++j) {
+ if (!strncmp (rec->name, journal[j], strlen(journal[j]))) {
+ gbls.journal_blkno[j] = rec->inode;
+ break;
+ }
+ }
}
bail:
if (dirarr)
g_array_free (dirarr, 1);
+ for (i = 0; i < sb->s_max_nodes; ++i)
+ safefree (journal[i]);
return ;
} /* read_sysdir */
More information about the Ocfs-tools-commits
mailing list