mtd/fs/jffs2 gc.c,1.76,1.77

David Woodhouse dwmw2 at infradead.org
Wed Aug 7 05:27:47 EDT 2002


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

Modified Files:
	gc.c 
Log Message:
<tglx1> is sizeof(jffs2_raw_dirent) == sizeof(jffs2_unknown_node) ??
<tglx1> not at all
<tglx1> gc.c line 432: jffs2_flash_read(c, offset, sizof(rd), &retlen, &rd)
<tglx1> line 438: if (retlen != sizeof( struct jffs2_unknown_node))
<tglx1> unknown node is 12 byte 
<dwmw2> heh
<dwmw2> me fuckwit
<tglx1> rd, which is jffs2_raw_dirent is 40 bytes
<tglx1> any more questions ?
<dwmw2> er, line 466 too.
<dwmw2> should compare with name_len+1
<tglx1> yep
* dwmw2 declares himself to be Today's Official Mr Fuck All Good and stomps off in search of caffeine


Index: gc.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/gc.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- gc.c	6 Aug 2002 08:38:23 -0000	1.76
+++ gc.c	7 Aug 2002 09:27:44 -0000	1.77
@@ -415,7 +415,7 @@
 			ret = jffs2_flash_read(c, raw->flash_offset & ~3, sizeof(struct jffs2_unknown_node), &retlen, (char *)&rd);
 			if (ret) {
 				printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Read error (%d) reading header from obsolete node at %08x\n", ret, raw->flash_offset & ~3);
-				/* If we can't read it, we don't need to continune to obsolete it. Continue */
+				/* If we can't read it, we don't need to continue to obsolete it. Continue */
 				continue;
 			}
 			if (retlen != sizeof(struct jffs2_unknown_node)) {
@@ -435,9 +435,9 @@
 				/* If we can't read it, we don't need to continune to obsolete it. Continue */
 				continue;
 			}
-			if (retlen != sizeof(struct jffs2_unknown_node)) {
+			if (retlen != sizeof(rd)) {
 				printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Short read (%d not %d) reading from obsolete node at %08x\n",
-				       retlen, sizeof(struct jffs2_unknown_node), raw->flash_offset & ~3);
+				       retlen, sizeof(struct rd), raw->flash_offset & ~3);
 				continue;
 			}
 
@@ -463,9 +463,9 @@
 				/* If we can't read it, we don't need to continune to obsolete it. Continue */
 				continue;
 			}
-			if (retlen != sizeof(rd)) {
+			if (retlen != name_len+1) {
 				printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Short read (%d not %d) reading name from obsolete node at %08x\n",
-				       retlen, name_len, raw->flash_offset & ~3);
+				       retlen, name_len+1, raw->flash_offset & ~3);
 				continue;
 			}
 			if (memcmp(namebuf+1, fd->name, name_len))
@@ -527,7 +527,7 @@
 		   write it out again with the _same_ version as before */
 		ret = jffs2_flash_read(c, fn->raw->flash_offset & ~3, sizeof(ri), &readlen, (char *)&ri);
 		if (readlen != sizeof(ri) || ret) {
-			printk(KERN_WARNING "Node read failed in jffs2_garbage_collect_hole. Ret %d, retlen %d. Data will be lost by writing new hold node\n", ret, readlen);
+			printk(KERN_WARNING "Node read failed in jffs2_garbage_collect_hole. Ret %d, retlen %d. Data will be lost by writing new hole node\n", ret, readlen);
 			goto fill;
 		}
 		if (ri.nodetype != JFFS2_NODETYPE_INODE) {





More information about the linux-mtd-cvs mailing list