[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/gfs2/fsck fs_recovery.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rpeterso 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 at %" 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]