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

[Cluster-devel] cluster/gfs2/fsck fsck.h metawalk.c pass1.c pa ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	rpeterso sourceware org	2007-11-29 16:21:20

Modified files:
	gfs2/fsck      : fsck.h metawalk.c pass1.c pass1b.c pass1c.c 
	                 pass2.c pass3.c pass4.c 

Log message:
	Resolves: bz 325151: GFS2: gfs2_fsck changes to system inodes don't stick

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/fsck.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.3&r2=1.3.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/metawalk.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.11&r2=1.3.2.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass1.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.8&r2=1.4.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass1b.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.4&r2=1.3.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass1c.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.4&r2=1.4.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass2.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.6&r2=1.4.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass3.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.1&r2=1.4.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/pass4.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.1&r2=1.4.2.2

--- cluster/gfs2/fsck/fsck.h	2007/08/15 22:31:00	1.3.2.3
+++ cluster/gfs2/fsck/fsck.h	2007/11/29 16:21:19	1.3.2.4
@@ -58,6 +58,12 @@
 			  gfs2_grow or something.  Count the RGs by hand. */
 };
 
+struct gfs2_inode *get_system_inode(struct gfs2_sbd *sbp, uint64_t block);
+struct gfs2_inode *fsck_load_inode(struct gfs2_sbd *sbp, uint64_t block);
+struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp,
+				  struct gfs2_buffer_head *bh);
+void fsck_inode_put(struct gfs2_inode *ip, enum update_flags update);
+
 int initialize(struct gfs2_sbd *sbp);
 void destroy(struct gfs2_sbd *sbp);
 int block_mounters(struct gfs2_sbd *sbp, int block_em);
--- cluster/gfs2/fsck/metawalk.c	2007/11/16 23:22:23	1.3.2.11
+++ cluster/gfs2/fsck/metawalk.c	2007/11/29 16:21:19	1.3.2.12
@@ -12,6 +12,7 @@
 
 #include <inttypes.h>
 #include <linux_endian.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
@@ -24,6 +25,84 @@
 #include "metawalk.h"
 #include "hash.h"
 
+struct gfs2_inode *get_system_inode(struct gfs2_sbd *sbp, uint64_t block)
+{
+	int j;
+
+	if (block == sbp->md.inum->i_di.di_num.no_addr)
+		return sbp->md.inum;
+	if (block == sbp->md.statfs->i_di.di_num.no_addr)
+		return sbp->md.statfs;
+	if (block == sbp->md.jiinode->i_di.di_num.no_addr)
+		return sbp->md.jiinode;
+	if (block == sbp->md.riinode->i_di.di_num.no_addr)
+		return sbp->md.riinode;
+	if (block == sbp->md.qinode->i_di.di_num.no_addr)
+		return sbp->md.qinode;
+	if (block == sbp->md.pinode->i_di.di_num.no_addr)
+		return sbp->md.pinode;
+	if (block == sbp->md.rooti->i_di.di_num.no_addr)
+		return sbp->md.rooti;
+	if (block == sbp->master_dir->i_di.di_num.no_addr)
+		return sbp->master_dir;
+	if (lf_dip && block == lf_dip->i_di.di_num.no_addr)
+		return lf_dip;
+	for (j = 0; j < sbp->md.journals; j++)
+		if (block == sbp->md.journal[j]->i_di.di_num.no_addr)
+			return sbp->md.journal[j];
+	return NULL;
+}
+
+/* fsck_load_inode - same as gfs2_load_inode() in libgfs2 but system inodes
+   get special treatment. */
+struct gfs2_inode *fsck_load_inode(struct gfs2_sbd *sbp, uint64_t block)
+{
+	struct gfs2_inode *ip = NULL;
+
+	ip = get_system_inode(sbp, block);
+	if (ip) {
+		bhold(ip->i_bh);
+		return ip;
+	}
+	return gfs2_load_inode(sbp, block);
+}
+
+/* fsck_inode_get - same as inode_get() in libgfs2 but system inodes
+   get special treatment. */
+struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp,
+				  struct gfs2_buffer_head *bh)
+{
+	struct gfs2_inode *ip, *sysip;
+
+	zalloc(ip, sizeof(struct gfs2_inode));
+	gfs2_dinode_in(&ip->i_di, bh->b_data);
+	ip->i_bh = bh;
+	ip->i_sbd = sdp;
+
+	sysip = get_system_inode(sdp, ip->i_di.di_num.no_addr);
+	if (sysip) {
+		free(ip);
+		return sysip;
+	}
+	return ip;
+}
+
+/* fsck_inode_put - same as inode_put() in libgfs2 but system inodes
+   get special treatment. */
+void fsck_inode_put(struct gfs2_inode *ip, enum update_flags update)
+{
+	struct gfs2_inode *sysip;
+
+	sysip = get_system_inode(ip->i_sbd, ip->i_di.di_num.no_addr);
+	if (sysip) {
+		if (update)
+			gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data);
+		brelse(ip->i_bh, update);
+	} else {
+		inode_put(ip, update);
+	}
+}
+
 int dirent_repair(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
 		  struct gfs2_dirent *de, struct gfs2_dirent *dent,
 		  int type, int first)
@@ -542,6 +621,7 @@
 
 /**
  * build_and_check_metalist - check a bunch of indirect blocks
+ * Note: Every buffer put on the metalist should be "held".
  * @ip:
  * @mlp:
  */
@@ -561,10 +641,8 @@
 	osi_list_add(&metabh->b_altlist, &mlp[0]);
 
 	/* if(<there are no indirect blocks to check>) */
-	if (height < 2) {
-		brelse(metabh, not_updated);
+	if (height < 2)
 		return 0;
-	}
 	for (i = 1; i < height; i++){
 		prev_list = &mlp[i - 1];
 		cur_list = &mlp[i];
@@ -588,6 +666,8 @@
 				block = be64_to_cpu(*ptr);
 				err = pass->check_metalist(ip, block, &nbh,
 							   pass->private);
+				/* check_metalist should hold any buffers
+				   it gets with "bread". */
 				if(err < 0) {
 					stack;
 					goto fail;
@@ -598,16 +678,13 @@
 						  block, block);
 					continue;
 				}
-				if(!nbh) {
+				if(!nbh)
 					nbh = bread(ip->i_sbd, block);
-					osi_list_add(&nbh->b_altlist, cur_list);
-				}
-				else
-					osi_list_add(&nbh->b_altlist, cur_list);
+
+				osi_list_add(&nbh->b_altlist, cur_list);
 			} /* for all data on the indirect block */
 		} /* for blocks at that height */
 	} /* for height */
-	brelse(metabh, not_updated);
 	return 0;
 fail:
 	for (i = 0; i < GFS2_MAX_META_HEIGHT; i++) {
@@ -619,6 +696,7 @@
 			osi_list_del(&nbh->b_altlist);
 		}
 	}
+	/* This is an error path, so we need to release the buffer here: */
 	brelse(metabh, not_updated);
 	return -1;
 }
@@ -690,6 +768,7 @@
 		{
 			bh = osi_list_entry(list->next,
 					    struct gfs2_buffer_head, b_altlist);
+			brelse(bh, not_updated);
 			osi_list_del(&bh->b_altlist);
 		}
 	}
@@ -734,13 +813,13 @@
 	int error = 0;
 
 	bh = bread(sbp, block);
-	ip = inode_get(sbp, bh);
+	ip = fsck_inode_get(sbp, bh);
 
 	if(ip->i_di.di_flags & GFS2_DIF_EXHASH) {
 		error = check_leaf(ip, &update, pass);
 		if(error < 0) {
 			stack;
-			inode_put(ip, not_updated); /* does brelse(bh); */
+			fsck_inode_put(ip, not_updated); /* does brelse(bh); */
 			return -1;
 		}
 	}
@@ -748,12 +827,12 @@
 		error = check_linear_dir(ip, bh, &update, pass);
 		if(error < 0) {
 			stack;
-			inode_put(ip, not_updated); /* does brelse(bh); */
+			fsck_inode_put(ip, not_updated); /* does brelse(bh); */
 			return -1;
 		}
 	}
 
-	inode_put(ip, opts.no ? not_updated : update); /* does a brelse */
+	fsck_inode_put(ip, opts.no ? not_updated : update); /* does a brelse */
 	return error;
 }
 
--- cluster/gfs2/fsck/pass1.c	2007/11/16 23:22:23	1.4.2.8
+++ cluster/gfs2/fsck/pass1.c	2007/11/29 16:21:19	1.4.2.9
@@ -83,7 +83,6 @@
 	}
 	nbh = bread(ip->i_sbd, block);
 
-	/** Attention -- experimental code **/
 	if (gfs2_check_meta(nbh, GFS2_METATYPE_IN)){
 		log_debug("Bad indirect block pointer "
 				  "(points to something that is not an indirect block).\n");
@@ -94,8 +93,6 @@
 		}
 	}else  /* blk check ok */
 		*bh = nbh;
-	brelse(nbh, not_updated);
-	/** Attention -- experimental code end **/
 
 	log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to indirect block.\n",
 			  block, block);
@@ -285,6 +282,7 @@
 				  block, block);
 		gfs2_block_set(bl, block, gfs2_dup_block);
 		bc->ea_count++;
+		ret = 1;
 	}
 	else {
 		leaf_bh = bread(sdp, block);
@@ -465,7 +463,7 @@
 	invalidate_metatree.check_data = clear_data;
 	invalidate_metatree.check_leaf = clear_leaf;
 
-	ip = inode_get(sdp, bh);
+	ip = fsck_inode_get(sdp, bh);
 	if (ip->i_di.di_num.no_addr != block) {
 		log_err("Inode #%" PRIu64 " (0x%" PRIx64
 				"): Bad inode address found: %"	PRIu64 " (0x%" PRIx64 ")\n",
@@ -483,7 +481,7 @@
 
 	if(gfs2_block_check(bl, block, &q)) {
 		stack;
-		inode_put(ip, f);
+		fsck_inode_put(ip, f);
 		return -1;
 	}
 	if(q.block_type != gfs2_block_free) {
@@ -491,10 +489,10 @@
 				  block, block);
 		if(gfs2_block_mark(bl, block, gfs2_dup_block)) {
 			stack;
-			inode_put(ip, f);
+			fsck_inode_put(ip, f);
 			return -1;
 		}
-		inode_put(ip, f);
+		fsck_inode_put(ip, f);
 		return 0;
 	}
 
@@ -505,12 +503,12 @@
 				  block, block);
 		if(gfs2_block_set(bl, block, gfs2_inode_dir)) {
 			stack;
-			inode_put(ip, f);
+			fsck_inode_put(ip, f);
 			return -1;
 		}
 		if(add_to_dir_list(sdp, block)) {
 			stack;
-			inode_put(ip, f);
+			fsck_inode_put(ip, f);
 			return -1;
 		}
 		break;
@@ -519,7 +517,7 @@
 				  block, block);
 		if(gfs2_block_set(bl, block, gfs2_inode_file)) {
 			stack;
-			inode_put(ip, f);
+			fsck_inode_put(ip, f);
 			return -1;
 		}
 		break;
@@ -528,7 +526,7 @@
 				  block, block);
 		if(gfs2_block_set(bl, block, gfs2_inode_lnk)) {
 			stack;
-			inode_put(ip, f);
+			fsck_inode_put(ip, f);
 			return -1;
 		}
 		break;
@@ -537,7 +535,7 @@
 				  block, block);
 		if(gfs2_block_set(bl, block, gfs2_inode_blk)) {
 			stack;
-			inode_put(ip, f);
+			fsck_inode_put(ip, f);
 			return -1;
 		}
 		break;
@@ -546,7 +544,7 @@
 				  block, block);
 		if(gfs2_block_set(bl, block, gfs2_inode_chr)) {
 			stack;
-			inode_put(ip, f);
+			fsck_inode_put(ip, f);
 			return -1;
 		}
 		break;
@@ -555,7 +553,7 @@
 				  block, block);
 		if(gfs2_block_set(bl, block, gfs2_inode_fifo)) {
 			stack;
-			inode_put(ip, f);
+			fsck_inode_put(ip, f);
 			return -1;
 		}
 		break;
@@ -564,7 +562,7 @@
 				  block, block);
 		if(gfs2_block_set(bl, block, gfs2_inode_sock)) {
 			stack;
-			inode_put(ip, f);
+			fsck_inode_put(ip, f);
 			return -1;
 		}
 		break;
@@ -573,15 +571,15 @@
 				  block, block);
 		if(gfs2_block_set(bl, block, gfs2_meta_inval)) {
 			stack;
-			inode_put(ip, f);
+			fsck_inode_put(ip, f);
 			return -1;
 		}
-		inode_put(ip, f);
+		fsck_inode_put(ip, f);
 		return 0;
 	}
 	if(set_link_count(ip->i_sbd, ip->i_di.di_num.no_addr, ip->i_di.di_nlink)) {
 		stack;
-		inode_put(ip, f);
+		fsck_inode_put(ip, f);
 		return -1;
 	}
 
@@ -596,10 +594,10 @@
 		log_warn("Marking inode invalid\n");
 		if(gfs2_block_set(bl, block, gfs2_meta_inval)) {
 			stack;
-			inode_put(ip, f);
+			fsck_inode_put(ip, f);
 			return -1;
 		}
-		inode_put(ip, f);
+		fsck_inode_put(ip, f);
 		return 0;
 	}
 
@@ -615,10 +613,10 @@
 			log_warn("Marking inode invalid\n");
 			if(gfs2_block_set(bl, block, gfs2_meta_inval)) {
 				stack;
-				inode_put(ip, f);
+				fsck_inode_put(ip, f);
 				return -1;
 			}
-			inode_put(ip, f);
+			fsck_inode_put(ip, f);
 			return 0;
 		}
 	}
@@ -627,7 +625,7 @@
 
 	error = check_metatree(ip, &pass1_fxns);
 	if(error < 0) {
-		inode_put(ip, f);
+		fsck_inode_put(ip, f);
 		return 0;
 	}
 	if(error > 0) {
@@ -635,7 +633,7 @@
 		/* FIXME: Must set all leaves invalid as well */
 		check_metatree(ip, &invalidate_metatree);
 		gfs2_block_set(bl, ip->i_di.di_num.no_addr, gfs2_meta_inval);
-		inode_put(ip, f);
+		fsck_inode_put(ip, f);
 		return 0;
 	}
 
@@ -663,7 +661,7 @@
 					ip->i_di.di_num.no_addr);
 	}
 
-	inode_put(ip, f);
+	fsck_inode_put(ip, f);
 	return 0;
 }
 
--- cluster/gfs2/fsck/pass1b.c	2007/10/11 20:32:36	1.3.2.4
+++ cluster/gfs2/fsck/pass1b.c	2007/11/29 16:21:19	1.3.2.5
@@ -132,6 +132,8 @@
 	osi_list_t *tmp1, *tmp2;
 	struct blocks *b;
 	struct inode_with_dups *id;
+	struct gfs2_leaf leaf;
+
 	osi_list_foreach(tmp1, &dup_list) {
 		b = osi_list_entry(tmp1, struct blocks, list);
 		osi_list_foreach(tmp2, &b->ref_inode_list) {
@@ -157,6 +159,10 @@
 			}
 		}
 	}
+	/* Return the number of leaf entries so metawalk doesn't flag this
+	   leaf as having none. */
+	gfs2_leaf_in(&leaf, bh->b_data);
+	*count = leaf.lf_entries;
 	return 0;
 }
 
@@ -339,17 +345,22 @@
 		.check_eattr_extentry = check_eattr_extentry,
 	};
 
-	ip = gfs2_load_inode(sbp, inode); /* bread, inode_get */
+	ip = fsck_load_inode(sbp, inode); /* bread, inode_get */
 	log_info("Checking inode %" PRIu64 " (0x%" PRIx64
 			 ")'s metatree for references to block %" PRIu64 " (0x%" PRIx64
 			 ")\n", inode, inode, b->block_no, b->block_no);
 	if(check_metatree(ip, &find_refs)) {
 		stack;
-		inode_put(ip, not_updated); /* out, brelse, free */
+		fsck_inode_put(ip, not_updated); /* out, brelse, free */
 		return -1;
 	}
 	log_info("Done checking metatree\n");
-
+	/* Check for ea references in the inode */
+	if(check_inode_eattr(ip, &find_refs) < 0){
+		stack;
+		fsck_inode_put(ip, not_updated); /* out, brelse, free */
+		return -1;
+	}
 	if (myfi.found) {
 		if(!(id = malloc(sizeof(*id)))) {
 			log_crit("Unable to allocate inode_with_dups structure\n");
@@ -367,7 +378,7 @@
 		id->ea_only = myfi.ea_only;
 		osi_list_add_prev(&id->list, &b->ref_inode_list);
 	}
-	inode_put(ip, (opts.no ? not_updated : updated)); /* out, brelse, free */
+	fsck_inode_put(ip, (opts.no ? not_updated : updated)); /* out, brelse, free */
 	return 0;
 }
 
@@ -433,7 +444,7 @@
 				 b->block_no);
 		/* FIXME: User input */
 		log_warn("Clearing...\n");
-		ip = gfs2_load_inode(sbp, id->block_no);
+		ip = fsck_load_inode(sbp, id->block_no);
 		dh.b = b;
 		dh.id = id;
 		clear_dup_fxns.private = (void *) &dh;
@@ -443,7 +454,7 @@
 		if(!id->ea_only)
 			check_metatree(ip, &clear_dup_fxns);
 
-		inode_put(ip, not_updated); /* out, brelse, free */
+		fsck_inode_put(ip, not_updated); /* out, brelse, free */
 		dh.ref_inode_count--;
 		if(dh.ref_inode_count == 1)
 			break;
@@ -522,7 +533,7 @@
 	log_info("Handling duplicate blocks\n");
 out:
 	while (!osi_list_empty(&dup_list)) {
-		b = osi_list_entry(tmp, struct blocks, list);
+		b = osi_list_entry(dup_list.next, struct blocks, list);
 		if (!skip_this_pass && !rc) /* no error & not asked to skip the rest */
 			handle_dup_blk(sbp, b);
 		osi_list_del(&b->list);
--- cluster/gfs2/fsck/pass1c.c	2007/11/16 23:22:23	1.4.2.4
+++ cluster/gfs2/fsck/pass1c.c	2007/11/29 16:21:19	1.4.2.5
@@ -240,7 +240,7 @@
 			log_info("EA in inode %"PRIu64" (0x%" PRIx64 ")\n",
 				 block_no, block_no);
 			gfs2_block_clear(bl, block_no, gfs2_eattr_block);
-			ip = inode_get(sbp, bh);
+			ip = fsck_inode_get(sbp, bh);
 
 			log_debug("Found eattr at %"PRIu64" (0x%" PRIx64 ")\n",
 				  ip->i_di.di_eattr, ip->i_di.di_eattr);
@@ -252,13 +252,10 @@
 				return -1;
 			}
 
-			if(update)
-				gfs2_dinode_out(&ip->i_di, bh->b_data);
-
-			free(ip);
+			fsck_inode_put(ip, update); /* dinode_out, brelse, free */
+		} else {
+			brelse(bh, update);
 		}
-		brelse(bh, update);
-
 		block_no++;
 	}
 	return 0;
--- cluster/gfs2/fsck/pass2.c	2007/11/16 23:22:23	1.4.2.6
+++ cluster/gfs2/fsck/pass2.c	2007/11/29 16:21:19	1.4.2.7
@@ -250,9 +250,9 @@
 
 		if(query(&opts, "Clear entry to inode containing bad blocks? (y/n)")) {
 
-			entry_ip = gfs2_load_inode(sbp, de->de_inum.no_addr);
+			entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
 			check_inode_eattr(entry_ip, &clear_eattrs);
-			inode_put(entry_ip, not_updated);
+			fsck_inode_put(entry_ip, not_updated);
 
 			/* FIXME: make sure all blocks referenced by
 			 * this inode are cleared in the bitmap */
@@ -309,9 +309,9 @@
 				 de->de_inum.no_addr, de->de_inum.no_addr,
 				 block_type_string(&q));
 		if(query(&opts, "Clear stale directory entry? (y/n) ")) {
-			entry_ip = gfs2_load_inode(sbp, de->de_inum.no_addr);
+			entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
 			check_inode_eattr(entry_ip, &clear_eattrs);
-			inode_put(entry_ip, not_updated);
+			fsck_inode_put(entry_ip, not_updated);
 
 			dirent2_del(ip, bh, prev_de, dent);
 			*update  = 1;
@@ -333,9 +333,9 @@
 					ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
 			if(query(&opts, "Clear duplicate '.' entry? (y/n) ")) {
 
-				entry_ip = gfs2_load_inode(sbp, de->de_inum.no_addr);
+				entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
 				check_inode_eattr(entry_ip, &clear_eattrs);
-				inode_put(entry_ip, not_updated);
+				fsck_inode_put(entry_ip, not_updated);
 
 				dirent2_del(ip, bh, prev_de, dent);
 				*update  = 1;
@@ -364,9 +364,9 @@
 					de->de_inum.no_addr, de->de_inum.no_addr,
 					ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
 			if(query(&opts, "Remove '.' reference? (y/n) ")) {
-				entry_ip = gfs2_load_inode(sbp, de->de_inum.no_addr);
+				entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
 				check_inode_eattr(entry_ip, &clear_eattrs);
-				inode_put(entry_ip, not_updated);
+				fsck_inode_put(entry_ip, not_updated);
 
 				dirent2_del(ip, bh, prev_de, dent);
 				*update = 1;
@@ -399,9 +399,9 @@
 					ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
 			if(query(&opts, "Clear duplicate '..' entry? (y/n) ")) {
 
-				entry_ip = gfs2_load_inode(sbp, de->de_inum.no_addr);
+				entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
 				check_inode_eattr(entry_ip, &clear_eattrs);
-				inode_put(entry_ip, not_updated);
+				fsck_inode_put(entry_ip, not_updated);
 
 				dirent2_del(ip, bh, prev_de, dent);
 				*update = 1;
@@ -424,9 +424,9 @@
 					" something that's not a directory",
 					ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
 			if(query(&opts, "Clear bad '..' directory entry? (y/n) ")) {
-				entry_ip = gfs2_load_inode(sbp, de->de_inum.no_addr);
+				entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
 				check_inode_eattr(entry_ip, &clear_eattrs);
-				inode_put(entry_ip, not_updated);
+				fsck_inode_put(entry_ip, not_updated);
 
 				dirent2_del(ip, bh, prev_de, dent);
 				*update = 1;
@@ -685,13 +685,13 @@
 		if(ds.q.bad_block) {
 			/* First check that the directory's metatree
 			 * is valid */
-			ip = gfs2_load_inode(sbp, i);
+			ip = fsck_load_inode(sbp, i);
 			if(check_metatree(ip, &pass2_fxns)) {
 				stack;
 				free(ip);
 				return -1;
 			}
-			inode_put(ip, not_updated);
+			fsck_inode_put(ip, not_updated);
 		}
 		error = check_dir(sbp, i, &pass2_fxns);
 		if(error < 0) {
@@ -730,7 +730,7 @@
 			gfs2_block_set(bl, i, gfs2_meta_inval);
 		}
 		bh = bread(sbp, i);
-		ip = inode_get(sbp, bh);
+		ip = fsck_inode_get(sbp, bh);
 		if(!ds.dotdir) {
 			log_err("No '.' entry found\n");
 			sprintf(tmp_name, ".");
@@ -753,21 +753,20 @@
 			free(filename);
 
 		}
-		inode_put(ip, not_updated); /* does a brelse */
+		fsck_inode_put(ip, not_updated); /* does a brelse */
 
 		bh = bread(sbp, i);
-		ip = inode_get(sbp, bh);
+		ip = fsck_inode_get(sbp, bh);
 		if(ip->i_di.di_entries != ds.entry_count) {
 			log_err("Entries is %d - should be %d for inode block %" PRIu64
 					" (0x%" PRIx64 ")\n",
 					ip->i_di.di_entries, ds.entry_count,
 					ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
 			ip->i_di.di_entries = ds.entry_count;
-			gfs2_dinode_out(&ip->i_di, bh->b_data);
-			inode_put(ip, updated); /* does a brelse */
+			fsck_inode_put(ip, updated); /* does a gfs2_dinode_out, brelse */
 		}
 		else
-			inode_put(ip, not_updated); /* does a brelse */
+			fsck_inode_put(ip, not_updated); /* does a brelse */
 	}
 	return 0;
 }
--- cluster/gfs2/fsck/pass3.c	2007/01/23 19:30:19	1.4.2.1
+++ cluster/gfs2/fsck/pass3.c	2007/11/29 16:21:19	1.4.2.2
@@ -31,8 +31,8 @@
 	int filename_len;
 	struct gfs2_inode *ip, *pip;
 
-	ip = gfs2_load_inode(sbp, block);
-	pip = gfs2_load_inode(sbp, newdotdot);
+	ip = fsck_load_inode(sbp, block);
+	pip = fsck_load_inode(sbp, newdotdot);
 	/* FIXME: Need to add some interactive
 	 * options here and come up with a
 	 * good default for non-interactive */
@@ -43,15 +43,15 @@
 	filename_len = strlen("..");
 	if(!(filename = malloc((sizeof(char) * filename_len) + 1))) {
 		log_err("Unable to allocate name\n");
-		inode_put(ip, not_updated);
-		inode_put(pip, not_updated);
+		fsck_inode_put(ip, not_updated);
+		fsck_inode_put(pip, not_updated);
 		stack;
 		return -1;
 	}
 	if(!memset(filename, 0, (sizeof(char) * filename_len) + 1)) {
 		log_err("Unable to zero name\n");
-		inode_put(ip, not_updated);
-		inode_put(pip, not_updated);
+		fsck_inode_put(ip, not_updated);
+		fsck_inode_put(pip, not_updated);
 		stack;
 		return -1;
 	}
@@ -62,8 +62,8 @@
 		decrement_link(sbp, olddotdot);
 	dir_add(ip, filename, filename_len, &pip->i_di.di_num, DT_DIR);
 	increment_link(sbp, newdotdot);
-	inode_put(ip, updated);
-	inode_put(pip, updated);
+	fsck_inode_put(ip, updated);
+	fsck_inode_put(pip, updated);
 	return 0;
 }
 
@@ -248,14 +248,14 @@
 
 				log_err("Found unlinked directory at block %" PRIu64
 						" (0x%" PRIx64 ")\n", di->dinode, di->dinode);
-				ip = gfs2_load_inode(sbp, di->dinode);
+				ip = fsck_load_inode(sbp, di->dinode);
 				/* Don't skip zero size directories
 				 * with eattrs */
 				if(!ip->i_di.di_size && !ip->i_di.di_eattr){
 					log_err("Unlinked directory has zero size.\n");
 					if(query(&opts, "Remove zero-size unlinked directory? (y/n) ")) {
 						gfs2_block_set(bl, di->dinode, gfs2_block_free);
-						inode_put(ip, not_updated);
+						fsck_inode_put(ip, not_updated);
 						break;
 					} else {
 						log_err("Zero-size unlinked directory remains\n");
@@ -263,7 +263,7 @@
 				}
 				if(query(&opts, "Add unlinked directory to lost+found? (y/n) ")) {
 					if(add_inode_to_lf(ip)) {
-						inode_put(ip, not_updated);
+						fsck_inode_put(ip, not_updated);
 						stack;
 						return -1;
 					}
@@ -271,7 +271,7 @@
 				} else {
 					log_err("Unlinked directory remains unlinked\n");
 				}
-				inode_put(ip, not_updated);
+				fsck_inode_put(ip, not_updated);
 				break;
 			}
 			else {
--- cluster/gfs2/fsck/pass4.c	2007/01/23 19:30:19	1.4.2.1
+++ cluster/gfs2/fsck/pass4.c	2007/11/29 16:21:19	1.4.2.2
@@ -85,7 +85,7 @@
 				log_err("Cleared\n");
 				continue;
 			}
-			ip = gfs2_load_inode(sbp, ii->inode);
+			ip = fsck_load_inode(sbp, ii->inode);
 
 			/* We don't want to clear zero-size files with
 			 * eattrs - there might be relevent info in
@@ -94,7 +94,7 @@
 				log_err("Unlinked inode has zero size\n");
 				if(query(&opts, "Clear zero-size unlinked inode? (y/n) ")) {
 					gfs2_block_set(bl, ii->inode, gfs2_block_free);
-					inode_put(ip, not_updated);
+					fsck_inode_put(ip, not_updated);
 					continue;
 				}
 
@@ -103,7 +103,7 @@
 				f = updated;
 				if(add_inode_to_lf(ip)) {
 					stack;
-					inode_put(ip, not_updated);
+					fsck_inode_put(ip, not_updated);
 					return -1;
 				}
 				else {
@@ -112,7 +112,7 @@
 				}
 			} else
 				log_err("Unlinked inode left unlinked\n");
-			inode_put(ip, f);
+			fsck_inode_put(ip, f);
 		} /* if(ii->counted_links == 0) */
 		else if(ii->link_count != ii->counted_links) {
 			log_err("Link count inconsistent for inode %" PRIu64
@@ -122,9 +122,9 @@
 			 * and write it back out */
 			if(query(&opts, "Update link count for inode %"
 				 PRIu64 " (0x%" PRIx64 ") ? (y/n) ", ii->inode, ii->inode)) {
-				ip = gfs2_load_inode(sbp, ii->inode); /* bread, inode_get */
+				ip = fsck_load_inode(sbp, ii->inode); /* bread, inode_get */
 				fix_inode_count(sbp, ii, ip);
-				inode_put(ip, updated); /* out, brelse, free */
+				fsck_inode_put(ip, updated); /* out, brelse, free */
 				log_warn("Link count updated for inode %"
 						 PRIu64 " (0x%" PRIx64 ") \n", ii->inode, ii->inode);
 			} else {


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