mtd/fs/jffs2 gc.c,1.95,1.96

David Woodhouse dwmw2 at infradead.org
Sun Jan 19 06:04:47 EST 2003


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

Modified Files:
	gc.c 
Log Message:
Fix sanity check on REF_PRISTINE nodes. frag->node is always non-NULL, 
even for holes, it's only non-NULL in case of errors causing nodes to go 
AWOL or during read_inode() before we found them all yet. 

Check for the adjacent node's size instead -- we don't want to bitch about 
a data node which is adjacent to a large hole, but if it's next to a 
_small_ hole it should probably have got marked REF_NORMAL anyway.


Index: gc.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/gc.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- gc.c	18 Jan 2003 01:35:37 -0000	1.95
+++ gc.c	19 Jan 2003 11:04:44 -0000	1.96
@@ -382,12 +382,16 @@
 			if (!nrfrags && ref_flags(fn->raw) == REF_PRISTINE) {
 				if (fn->frags > 1)
 					printk(KERN_WARNING "REF_PRISTINE node at 0x%08x had %d frags. Tell dwmw2\n", ref_offset(raw), fn->frags);
-
-				if (frag->ofs & (PAGE_CACHE_SIZE-1) && frag_prev(frag) && frag_prev(frag)->node)
+				/* A hole node which isn't multi-page should be garbage-collected
+				   and merged anyway, so we just check for the frag size here,
+				   rather than mucking around with actually reading the node
+				   and checking the compression type, which is the real way
+				   to tell a hole node. */
+				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));
 
-				if ((frag->ofs+frag->size) & (PAGE_CACHE_SIZE-1) && frag_next(frag) && frag_next(frag)->node)
+				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);
 			}





More information about the linux-mtd-cvs mailing list