From: rpeterso@sourceware.org <rpeterso@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/gfs2/fsck fs_recovery.c
Date: 12 Feb 2007 19:28:50 -0000 [thread overview]
Message-ID: <20070212192850.23527.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rpeterso at sourceware.org 2007-02-12 19:28:49
Modified files:
gfs2/fsck : fs_recovery.c
Log message:
Resolves: bz 221743: gfs2_fsck errors still
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/fs_recovery.c.diff?cvsroot=cluster&r1=1.4&r2=1.5
--- cluster/gfs2/fsck/fs_recovery.c 2006/06/15 18:48:45 1.4
+++ cluster/gfs2/fsck/fs_recovery.c 2007/02/12 19:28:49 1.5
@@ -25,65 +25,6 @@
#define RANDOM(values) ((values) * (random() / (RAND_MAX + 1.0)))
/*
- * reconstruct_single_journal - write a fresh journal
- * @sdp: superblock
- * @jnum: journal number
- *
- * This function will write a fresh journal over the top of
- * the previous journal. All journal information is lost. This
- * process is basically stolen from write_journals() in the mkfs code.
- *
- * Returns: -1 on error, 0 otherwise
- */
-static int reconstruct_single_journal(struct gfs2_sbd *sdp, int jnum){
- struct gfs2_log_header lh;
- unsigned int blocks;
- struct gfs2_inode *ip = sdp->md.journal[jnum];
- uint64_t seq;
- uint64_t dblock;
- uint32_t hash, extlen;
- unsigned int x;
- int new = 0;
-
- blocks = ip->i_di.di_blocks;
- srandom(time(NULL));
- seq = RANDOM(blocks);
-
- log_info("Clearing journal %d\n", jnum);
-
- memset(&lh, 0, sizeof(struct gfs2_log_header));
- lh.lh_header.mh_magic = GFS2_MAGIC;
- lh.lh_header.mh_type = GFS2_METATYPE_LH;
- lh.lh_header.mh_format = GFS2_FORMAT_LH;
- lh.lh_flags = GFS2_LOG_HEAD_UNMOUNT;
-
- for (x = 0; x < blocks; x++) {
- struct gfs2_buffer_head *bh;
-
- block_map(ip, x, &new, &dblock, &extlen);
- bh = bread(sdp, dblock);
- if (!bh) {
- log_err("Unable to read journal block@%" PRIu64
- " (0x%" PRIx64")\n", dblock, dblock);
- return -1;
- }
-
- lh.lh_sequence = seq;
- lh.lh_blkno = x;
- gfs2_log_header_out(&lh, bh->b_data);
- hash = gfs2_disk_hash(bh->b_data, sizeof(struct gfs2_log_header));
- ((struct gfs2_log_header *)bh->b_data)->lh_hash = cpu_to_be32(hash);
- brelse(bh, updated);
-
- if (++seq == blocks)
- seq = 0;
- }
-
- return 0;
-}
-
-
-/*
* reconstruct_journals - write fresh journals
* sdp: the super block
*
@@ -103,8 +44,9 @@
* the gfs2_fsck */
if((i % 2) == 0)
log_at_notice(".");
- if(reconstruct_single_journal(sdp, i))
- return -1;
+ write_journal(sdp, sdp->md.journal[i], i,
+ sdp->md.journal[i]->i_di.di_size / sdp->sd_sb.sb_bsize);
+ /* Can't use d_di.di_blocks because that also includes metadata. */
}
log_notice("\nJournals cleared.\n");
return 0;
next reply other threads:[~2007-02-12 19:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-12 19:28 rpeterso [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-02-12 19:29 [Cluster-devel] cluster/gfs2/fsck fs_recovery.c rpeterso
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=20070212192850.23527.qmail@sourceware.org \
--to=rpeterso@sourceware.org \
/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.