From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3708 invoked by alias); 25 Jul 2008 16:00:33 -0000 Received: (qmail 3224 invoked by uid 9582); 25 Jul 2008 16:00:30 -0000 Date: Fri, 25 Jul 2008 16:00:00 -0000 Message-ID: <20080725160030.3208.qmail@sourceware.org> From: rpeterso@sourceware.org To: cluster-cvs@sources.redhat.com, cluster-devel@redhat.com Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-177-ge0ff895 X-Git-Refname: refs/heads/RHEL5 X-Git-Reftype: branch X-Git-Oldrev: ff1d4eebbc91c9fdfd427e84a2013c0a7efddd41 X-Git-Newrev: e0ff895e257924ddba53244b01445f6665a2e163 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2008-q3/txt/msg00143.txt.bz2 This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=e0ff895e257924ddba53244b01445f6665a2e163 The branch, RHEL5 has been updated via e0ff895e257924ddba53244b01445f6665a2e163 (commit) via 56402ca4bb288b12a60e6e5ea93af5b58e2ed8c0 (commit) from ff1d4eebbc91c9fdfd427e84a2013c0a7efddd41 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e0ff895e257924ddba53244b01445f6665a2e163 Author: Bob Peterson Date: Fri Jul 25 08:48:50 2008 -0500 gfs2_edit: was parsing out gfs1 log descriptors improperly bz 450004 GFS2 log descriptors have 8 bytes per entry which represents a block number. GFS1 log descriptors have a small structure that is 16-bytes, the first 8 bytes of which is the block. So gfs2_edit was mistaking the extra 0x00000000 for a GFS2 end-of-block marker when it shouldn't have. This fixes it. commit 56402ca4bb288b12a60e6e5ea93af5b58e2ed8c0 Author: Bob Peterson Date: Fri Jul 25 08:17:12 2008 -0500 gfs2_edit: Ability to enter "journalX" in block number. bz 450004 With gfs2_edit, you can position to the "block #" field and press , then enter a block number to jump to. You may also enter a keyword, like "root" to jump to the root directory, "rindex" to jump to the rindex, etc. Most keywords worked, but you could not enter "journal0" to jump to the first journal until this fix made it possible. ----------------------------------------------------------------------- Summary of changes: gfs2/edit/hexedit.c | 120 +++++++++++++++++++++++++++++++++------------------ 1 files changed, 78 insertions(+), 42 deletions(-) diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c index b169135..5a0e619 100644 --- a/gfs2/edit/hexedit.c +++ b/gfs2/edit/hexedit.c @@ -162,6 +162,7 @@ int bobgets(char string[],int x,int y,int sz,int *ch) case('\r'): rc=1; done=TRUE; + string[runningy-y] = '\0'; break; case(KEY_CANCEL): case(0x01B): @@ -1626,6 +1627,60 @@ uint64_t pop_block(void) } /* ------------------------------------------------------------------------ */ +/* find_journal_block - figure out where a journal starts, given the name */ +/* Returns: journal block number, changes j_size to the journal size */ +/* ------------------------------------------------------------------------ */ +uint64_t find_journal_block(const char *journal, uint64_t *j_size) +{ + int journal_num; + uint64_t jindex_block, jblock = 0; + int amtread; + struct gfs2_buffer_head *jindex_bh, *j_bh; + char jbuf[sbd.bsize]; + struct gfs2_inode *j_inode = NULL; + + journal_num = atoi(journal + 7); + /* Figure out the block of the jindex file */ + if (gfs1) + jindex_block = sbd1->sb_jindex_di.no_addr; + else + jindex_block = masterblock("jindex"); + /* read in the block */ + jindex_bh = bread(&sbd, jindex_block); + /* get the dinode data from it. */ + gfs2_dinode_in(&di, jindex_bh->b_data); /* parse disk inode to struct*/ + + if (!gfs1) + do_dinode_extended(&di, jindex_bh->b_data); /* parse dir. */ + brelse(jindex_bh, not_updated); + + if (gfs1) { + struct gfs2_inode *jiinode; + struct gfs_jindex ji; + + jiinode = inode_get(&sbd, jindex_bh); + amtread = gfs2_readi(jiinode, (void *)&jbuf, + journal_num * sizeof(struct gfs_jindex), + sizeof(struct gfs_jindex)); + if (amtread) { + gfs_jindex_in(&ji, jbuf); + jblock = ji.ji_addr; + *j_size = ji.ji_nsegment * 0x10; + } + } else { + struct gfs2_dinode jdi; + + jblock = indirect->ii[0].dirent[journal_num + 2].block; + j_bh = bread(&sbd, jblock); + j_inode = inode_get(&sbd, j_bh); + gfs2_dinode_in(&jdi, j_bh->b_data);/* parse dinode to struct */ + *j_size = jdi.di_size; + brelse(j_bh, not_updated); + } + return jblock; +} + +/* ------------------------------------------------------------------------ */ /* Check if the word is a keyword such as "sb" or "rindex" */ /* Returns: block number if it is, else 0 */ /* ------------------------------------------------------------------------ */ @@ -1676,6 +1731,10 @@ uint64_t check_keywords(const char *kword) rgnum = atoi(kword + 3); blk = get_rg_addr(rgnum); + } else if (!strncmp(kword, "journal", 7) && isdigit(kword[7])) { + uint64_t j_size; + + blk = find_journal_block(kword, &j_size); } else if (kword[0]=='0' && kword[1]=='x') /* hex addr */ sscanf(kword, "%"SCNx64, &blk);/* retrieve in hex */ else @@ -2180,10 +2239,9 @@ void gfs_log_header_print(struct gfs_log_header *lh) /* ------------------------------------------------------------------------ */ void dump_journal(const char *journal) { - struct gfs2_buffer_head *jindex_bh, *j_bh = NULL; - uint64_t jindex_block, jblock, j_size, jb; + struct gfs2_buffer_head *j_bh = NULL; + uint64_t jblock, j_size, jb; int error, start_line, journal_num; - struct gfs2_dinode jdi; char jbuf[sbd.bsize]; struct gfs2_inode *j_inode = NULL; @@ -2193,39 +2251,12 @@ void dump_journal(const char *journal) journal_num = atoi(journal + 7); print_gfs2("Dumping journal #%d.", journal_num); eol(0); - /* Figure out the block of the jindex file */ - if (gfs1) - jindex_block = sbd1->sb_jindex_di.no_addr; - else - jindex_block = masterblock("jindex"); - /* read in the block */ - jindex_bh = bread(&sbd, jindex_block); - /* get the dinode data from it. */ - gfs2_dinode_in(&di, jindex_bh->b_data); /* parse disk inode into structure */ - - if (!gfs1) - do_dinode_extended(&di, jindex_bh->b_data); /* parse dir. */ - brelse(jindex_bh, not_updated); - - if (gfs1) { - struct gfs2_inode *jiinode; - struct gfs_jindex ji; - - jiinode = inode_get(&sbd, jindex_bh); - error = gfs2_readi(jiinode, (void *)&jbuf, - journal_num * sizeof(struct gfs_jindex), - sizeof(struct gfs_jindex)); - if (!error) - return; - gfs_jindex_in(&ji, jbuf); - jblock = ji.ji_addr; - j_size = ji.ji_nsegment * 0x10; - } else { - jblock = indirect->ii[0].dirent[journal_num + 2].block; + jblock = find_journal_block(journal, &j_size); + if (!jblock) + return; + if (!gfs1) { j_bh = bread(&sbd, jblock); j_inode = inode_get(&sbd, j_bh); - gfs2_dinode_in(&jdi, j_bh->b_data);/* parse dinode to struct */ - j_size = jdi.di_size; } for (jb = 0; jb < j_size; jb += (gfs1 ? 1:sbd.bsize)) { @@ -2234,12 +2265,12 @@ void dump_journal(const char *journal) brelse(j_bh, not_updated); j_bh = bread(&sbd, jblock + jb); memcpy(jbuf, j_bh->b_data, sbd.bsize); - } - else + } else { error = gfs2_readi(j_inode, (void *)&jbuf, jb, sbd.bsize); - if (!error) /* end of file */ - break; + if (!error) /* end of file */ + break; + } if (get_block_type(jbuf) == GFS2_METATYPE_LD) { uint64_t *b; struct gfs2_log_descriptor ld; @@ -2295,6 +2326,8 @@ void dump_journal(const char *journal) print_gfs2("0x%08llx ", be64_to_cpu(*b)); } b++; + if (gfs1) + b++; } eol(0); } else if (get_block_type(jbuf) == GFS2_METATYPE_LH) { @@ -2447,9 +2480,15 @@ void process_parameters(int argc, char *argv[], int pass) else if (!termlines && !strchr(argv[i],'/')) { /* if print, no slash */ uint64_t keyword_blk; + if (!strncmp(argv[i], "journal", 7) && + isdigit(argv[i][7])) { + dump_journal(argv[i]); + continue; + } keyword_blk = check_keywords(argv[i]); - if (keyword_blk) + if (keyword_blk) { push_block(keyword_blk); + } else if (!strcasecmp(argv[i], "-x")) dmode = HEX_MODE; else if (argv[i][0] == '-') /* if it starts with a dash */ @@ -2520,9 +2559,6 @@ void process_parameters(int argc, char *argv[], int pass) sscanf(argv[i], "%"SCNd64, &temp_blk); push_block(temp_blk); } - else if (!strncmp(argv[i], "journal", 7) && isdigit(argv[i][7])) { - dump_journal(argv[i]); - } else { fprintf(stderr,"I don't know what '%s' means.\n", argv[i]); usage(); hooks/post-receive -- Cluster Project