mtd/fs/jffs2 read.c,1.31,1.32

David Woodhouse dwmw2 at infradead.org
Tue Jul 15 06:11:40 EDT 2003


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

Modified Files:
	read.c 
Log Message:
Remove overzealous frag-overlap check in jffs2_read_inode_range().
The eCos port reads with offset starting somewhere other than the
beginning of a page, and falsely triggers it.


Index: read.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/read.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- read.c	14 Jan 2003 14:06:22 -0000	1.31
+++ read.c	15 Jul 2003 10:11:37 -0000	1.32
@@ -165,7 +165,7 @@
 	/* Now we're pointing at the first frag which overlaps our page */
 	while(offset < end) {
 		D2(printk(KERN_DEBUG "jffs2_read_inode_range: offset %d, end %d\n", offset, end));
-		if (!frag || frag->ofs > offset) {
+		if (unlikely(!frag || frag->ofs > offset)) {
 			uint32_t holesize = end - offset;
 			if (frag) {
 				D1(printk(KERN_NOTICE "Eep. Hole in ino #%u fraglist. frag->ofs = 0x%08x, offset = 0x%08x\n", f->inocache->ino, frag->ofs, offset));
@@ -177,13 +177,7 @@
 			buf += holesize;
 			offset += holesize;
 			continue;
-		} else if (frag->ofs < offset && (offset & (PAGE_CACHE_SIZE-1)) != 0) {
-			D1(printk(KERN_NOTICE "Eep. Overlap in ino #%u fraglist. frag->ofs = 0x%08x, offset = 0x%08x\n",
-				  f->inocache->ino, frag->ofs, offset));
-			D1(jffs2_print_frag_list(f));
-			memset(buf, 0, end - offset);
-			return -EIO;
-		} else if (!frag->node) {
+		} else if (unlikely(!frag->node)) {
 			uint32_t holeend = min(end, frag->ofs + frag->size);
 			D1(printk(KERN_DEBUG "Filling frag hole from %d-%d (frag 0x%x 0x%x)\n", offset, holeend, frag->ofs, frag->ofs + frag->size));
 			memset(buf, 0, holeend - offset);




More information about the linux-mtd-cvs mailing list