mtd/fs/jffs3 write.c,3.9,3.10

hammache at infradead.org hammache at infradead.org
Mon Jan 24 16:17:35 EST 2005


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

Modified Files:
	write.c 
Log Message:
JFFS3 and NAND failure:
Correction of retry case to avoid silent failure of rmdir
when reallocating new space GCs the previous entry (+ corresponding
dnode case). 


Index: write.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/write.c,v
retrieving revision 3.9
retrieving revision 3.10
diff -u -r3.9 -r3.10
--- write.c	5 Jan 2005 16:19:01 -0000	3.9
+++ write.c	24 Jan 2005 21:17:32 -0000	3.10
@@ -117,6 +117,21 @@
 #endif
 	raw->next_phys = NULL;
 
+	if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(ri->version) < f->highest_version))
+	{
+		if (! retried)
+		{
+			BUG();
+		}
+		else
+		{
+			DBG_WRITE(1,"jffs3_write_dnode : dnode_version %d,  highest version %d -> updating dnode\n", 
+					     je32_to_cpu(ri->version), f->highest_version);
+			ri->version = cpu_to_je32(++f->highest_version);
+			ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
+		}
+	}
+
 	ret = jffs3_flash_writev(c, vecs, cnt, flash_ofs, &retlen,
 				 (alloc_mode==ALLOC_GC)?0:f->inocache->ino);
 
@@ -266,6 +281,21 @@
 	raw->__totlen = rawlen;
 #endif
 	raw->next_phys = NULL;
+	if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(rd->version) < f->highest_version))
+	{
+		if (! retried)
+		{
+			BUG();
+		}
+		else
+		{
+			DBG_WRITE(1,"jffs3_write_dirent : dirent_version %d,  highest version %d -> updating dirent\n", 
+				je32_to_cpu(rd->version), f->highest_version);
+			rd->version = cpu_to_je32(++f->highest_version);
+			fd->version = je32_to_cpu(rd->version);
+			rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
+		}
+	}
 
 	ret = jffs3_flash_writev(c, vecs, 2, flash_ofs, &retlen,
 				 (alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino));





More information about the linux-mtd-cvs mailing list