mtd/fs/jffs2 gc.c,1.117,1.118 malloc.c,1.25,1.26 nodelist.c,1.82,1.83 nodelist.h,1.106,1.107 wbuf.c,1.55,1.56

David Woodhouse dwmw2 at infradead.org
Tue Oct 28 12:13:12 EST 2003


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv4700

Modified Files:
	gc.c malloc.c nodelist.c nodelist.h wbuf.c 
Log Message:
clean up, and disable, REF_PRISTINE sanity checks in gc.c

Index: gc.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/gc.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -r1.117 -r1.118
--- gc.c	28 Oct 2003 16:42:59 -0000	1.117
+++ gc.c	28 Oct 2003 17:13:09 -0000	1.118
@@ -406,11 +406,13 @@
 		if (frag->node && frag->node->raw == raw) {
 			fn = frag->node;
 			end = frag->ofs + frag->size;
-#if 1 /* Temporary debugging sanity checks, till we're ready to _trust_ the REF_PRISTINE flag stuff */ 
+#if 0 /* Checked in readinode.c now anyway. */
 			if (!nrfrags && ref_flags(fn->raw) == REF_PRISTINE) {
+				int bitched = 0;
+
 				if (fn->frags > 1) {
 					printk(KERN_WARNING "REF_PRISTINE node at 0x%08x had %d frags. Tell dwmw2\n", ref_offset(raw), fn->frags);
-					mark_ref_normal(raw);
+					bitched = 1;
 				}
 				/* A hole node which isn't multi-page should be garbage-collected
 				   and merged anyway, so we just check for the frag size here,
@@ -420,12 +422,34 @@
 				if (frag->ofs & (PAGE_CACHE_SIZE-1) && frag_prev(frag) && frag_prev(frag)->size < PAGE_CACHE_SIZE) {
 					printk(KERN_WARNING "REF_PRISTINE node at 0x%08x had a previous non-hole frag in the same page. Tell dwmw2\n",
 					       ref_offset(raw));
-					mark_ref_normal(raw);
+					bitched = 1;
 				}
 
 				if ((frag->ofs+frag->size) & (PAGE_CACHE_SIZE-1) && frag_next(frag) && frag_next(frag)->size < PAGE_CACHE_SIZE) {
 					printk(KERN_WARNING "REF_PRISTINE node at 0x%08x (%08x-%08x) had a following non-hole frag in the same page. Tell dwmw2\n",
 					       ref_offset(raw), frag->ofs, frag->ofs+frag->size);
+					bitched = 1;
+				}
+				if (bitched) {
+					struct jffs2_node_frag *thisfrag;
+
+					printk(KERN_WARNING "Inode is #%u, i_size %zd\n", ic->ino, inode->i_size);	
+					thisfrag = frag_first(&f->fragtree);
+					while (thisfrag) {
+						if (!thisfrag->node) {
+							printk("Frag @0x%x-0x%x; node-less hole\n",
+							       thisfrag->ofs, thisfrag->size + thisfrag->ofs);
+						} else if (!thisfrag->node->raw) {
+							printk("Frag @0x%x-0x%x; raw-less hole\n",
+							       thisfrag->ofs, thisfrag->size + thisfrag->ofs);
+						} else {
+							printk("Frag @0x%x-0x%x; raw at 0x%08x(%d) (0x%x-0x%x)\n",
+							       thisfrag->ofs, thisfrag->size + thisfrag->ofs,
+							       ref_offset(thisfrag->node->raw), ref_flags(thisfrag->node->raw),
+							       thisfrag->node->ofs, thisfrag->node->ofs+thisfrag->node->size);
+						}
+						thisfrag = frag_next(thisfrag);
+					}
 					mark_ref_normal(raw);
 				}
 			}

Index: malloc.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/malloc.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- malloc.c	4 Oct 2003 08:33:06 -0000	1.25
+++ malloc.c	28 Oct 2003 17:13:09 -0000	1.26
@@ -17,7 +17,7 @@
 #include <linux/jffs2.h>
 #include "nodelist.h"
 
-#if 0
+#if 1
 #define JFFS2_SLAB_POISON SLAB_POISON
 #else
 #define JFFS2_SLAB_POISON 0

Index: nodelist.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodelist.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- nodelist.c	16 Oct 2003 10:22:50 -0000	1.82
+++ nodelist.c	28 Oct 2003 17:13:09 -0000	1.83
@@ -25,7 +25,11 @@
 {
 	struct jffs2_full_dirent **prev = list;
 	D1(printk(KERN_DEBUG "jffs2_add_fd_to_list( %p, %p (->%p))\n", new, list, *list));
-
+	if (!new->raw) {
+		printk(KERN_NOTICE "Add fd to list with NULL raw. \"%s\"->#%u\n",
+		       new->name, new->ino);
+		__backtrace();
+	}
 	while ((*prev) && (*prev)->nhash <= new->nhash) {
 		if ((*prev)->nhash == new->nhash && !strcmp((*prev)->name, new->name)) {
 			/* Duplicate. Free one */
@@ -49,20 +53,44 @@
 	*prev = new;
 
  out:
-	D2(while(*list) {
-		printk(KERN_DEBUG "Dirent \"%s\" (hash 0x%08x, ino #%u\n", (*list)->name, (*list)->nhash, (*list)->ino);
-		list = &(*list)->next;
-	});
+#if 0
+	{ uint32_t lasthash = 0;
+
+		for (prev = list; *prev; prev = &((*prev)->next)) {
+			if ((*prev)->nhash <= lasthash) {
+				printk(KERN_CRIT "dirent hash list corrupt\n");
+				
+				while(*list && list != prev) {
+					printk(KERN_CRIT "@%p Dirent \"%s\" (hash 0x%08x, ino #%u) next %p\n", (*list), (*list)->name, (*list)->nhash, (*list)->ino, (*list)->next);
+					list = &(*list)->next;
+				}
+				printk(KERN_CRIT "..@%p Dirent \"%s\" (hash 0x%08x, ino #%u) next %p\n", (*list), (*prev)->name, (*prev)->nhash, (*prev)->ino, (*list)->next);
+			}
+		}
+	}
+#endif
 }
 
 /* Put a new tmp_dnode_info into the list, keeping the list in 
    order of increasing version
 */
-void jffs2_add_tn_to_list(struct jffs2_tmp_dnode_info *tn, struct jffs2_tmp_dnode_info **list)
+static void jffs2_add_tn_to_list(struct jffs2_tmp_dnode_info *tn, struct jffs2_tmp_dnode_info **list)
 {
 	struct jffs2_tmp_dnode_info **prev = list;
-	
+	uint32_t oldver = 0;
+
 	while ((*prev) && (*prev)->version < tn->version) {
+		if ((*prev)->version < oldver) {
+			struct jffs2_tmp_dnode_info *this = *list;
+			printk(KERN_CRIT "Eeep. TN list goes backwards!\n");
+			while (this && this != (*prev)->next) {
+				printk(KERN_CRIT "tn at %p is version %d, node at %p (0x%08x)\n",
+				       this, this->version, this->fn, ref_offset(this->fn->raw));
+				this = this->next;
+			}
+			BUG();
+		}
+		oldver = (*prev)->version;
 		prev = &((*prev)->next);
 	}
 	tn->next = (*prev);

Index: nodelist.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodelist.h,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- nodelist.h	16 Oct 2003 10:22:50 -0000	1.106
+++ nodelist.h	28 Oct 2003 17:13:09 -0000	1.107
@@ -360,7 +360,6 @@
 /* nodelist.c */
 D1(void jffs2_print_frag_list(struct jffs2_inode_info *f));
 void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list);
-void jffs2_add_tn_to_list(struct jffs2_tmp_dnode_info *tn, struct jffs2_tmp_dnode_info **list);
 int jffs2_get_inode_nodes(struct jffs2_sb_info *c, ino_t ino, struct jffs2_inode_info *f,
 			  struct jffs2_tmp_dnode_info **tnp, struct jffs2_full_dirent **fdp,
 			  uint32_t *highest_version, uint32_t *latest_mctime,

Index: wbuf.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/wbuf.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- wbuf.c	16 Oct 2003 10:22:50 -0000	1.55
+++ wbuf.c	28 Oct 2003 17:13:09 -0000	1.56
@@ -966,7 +966,7 @@
 					retval = 1;
 				}
 			}
-			D1(if (retval == 1) {
+			D2(if (retval == 1) {
 				printk(KERN_WARNING "jffs2_check_nand_cleanmarker(): Cleanmarker node not detected in block at %08x\n", jeb->offset);
 				printk(KERN_WARNING "OOB at %08x was ", offset);
 				for (i=0; i < oob_size; i++) {




More information about the linux-mtd-cvs mailing list