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

intrep.c update to handle gaps in the middle of the log.



This appears to fix the problem for me, so I've committed it to CVS. 

Index: intrep.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs/intrep.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -w -r1.23 -r1.24
--- intrep.c	2000/07/26 15:02:10	1.23
+++ intrep.c	2000/07/26 15:34:10	1.24
@@ -10,7 +10,7 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * $Id: intrep.c,v 1.23 2000/07/26 15:02:10 dwmw2 Exp $
+ * $Id: intrep.c,v 1.24 2000/07/26 15:34:10 dwmw2 Exp $
  *
  * Ported to Linux 2.3.x and MTD:
  * Copyright (C) 2000  Alexander Larsson (alex@xxxxxxx.se), Cendio Systems AB
@@ -626,6 +626,20 @@
 			     pos += 4);
 			D1(printk("jffs_scan_flash(): 0xff ended at "
 				  "pos 0x%lx.\n", (long)pos));
+
+			/* Added by dwmw2: if we have already found nodes, 
+			   then treat this space as dirty rather than clean,
+			   unless it extends to the very end of the flash.
+			   This is to handle the case where one thread 
+			   allocated space for a node, but didn't get to
+			   actually _write_ it before power was lost, leaving
+			   a gap in the log. Shifting all node writes into
+			   a single kernel thread will fix the original problem.+			*/
+			if (fmc->head && pos < end) {
+				jffs_fmalloced(fmc, (__u32) start,
+					       (__u32) (pos - start), 0);
+			}
 			continue;
 
 		case JFFS_DIRTY_BITMASK:


--
dwmw2