aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/jffs2/debug.h2
-rw-r--r--fs/jffs2/nodelist.c26
-rw-r--r--fs/jffs2/readinode.c15
3 files changed, 15 insertions, 28 deletions
diff --git a/fs/jffs2/debug.h b/fs/jffs2/debug.h
index 2112bab514c3..11ee75922a5e 100644
--- a/fs/jffs2/debug.h
+++ b/fs/jffs2/debug.h
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: debug.h,v 1.8 2005/07/31 09:08:38 dedekind Exp $ 10 * $Id: debug.h,v 1.10 2005/08/02 10:03:51 dedekind Exp $
11 * 11 *
12 */ 12 */
13#ifndef _JFFS2_DEBUG_H_ 13#ifndef _JFFS2_DEBUG_H_
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c
index 390ce06ab1a7..007d52f394dd 100644
--- a/fs/jffs2/nodelist.c
+++ b/fs/jffs2/nodelist.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: nodelist.c,v 1.104 2005/08/01 12:05:19 dedekind Exp $ 10 * $Id: nodelist.c,v 1.107 2005/08/03 09:26:46 dedekind Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -60,7 +60,6 @@ void jffs2_truncate_fragtree(struct jffs2_sb_info *c, struct rb_root *list, uint
60 /* We know frag->ofs <= size. That's what lookup does for us */ 60 /* We know frag->ofs <= size. That's what lookup does for us */
61 if (frag && frag->ofs != size) { 61 if (frag && frag->ofs != size) {
62 if (frag->ofs+frag->size > size) { 62 if (frag->ofs+frag->size > size) {
63 JFFS2_DBG_FRAGTREE2("truncating frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size);
64 frag->size = size - frag->ofs; 63 frag->size = size - frag->ofs;
65 } 64 }
66 frag = frag_next(frag); 65 frag = frag_next(frag);
@@ -68,7 +67,6 @@ void jffs2_truncate_fragtree(struct jffs2_sb_info *c, struct rb_root *list, uint
68 while (frag && frag->ofs >= size) { 67 while (frag && frag->ofs >= size) {
69 struct jffs2_node_frag *next = frag_next(frag); 68 struct jffs2_node_frag *next = frag_next(frag);
70 69
71 JFFS2_DBG_FRAGTREE("removing frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size);
72 frag_erase(frag, list); 70 frag_erase(frag, list);
73 jffs2_obsolete_node_frag(c, frag); 71 jffs2_obsolete_node_frag(c, frag);
74 frag = next; 72 frag = next;
@@ -120,7 +118,6 @@ static void jffs2_fragtree_insert(struct jffs2_node_frag *newfrag, struct jffs2_
120 parent = *link; 118 parent = *link;
121 base = rb_entry(parent, struct jffs2_node_frag, rb); 119 base = rb_entry(parent, struct jffs2_node_frag, rb);
122 120
123 JFFS2_DBG_FRAGTREE2("considering frag at 0x%08x\n", base->ofs);
124 if (newfrag->ofs > base->ofs) 121 if (newfrag->ofs > base->ofs)
125 link = &base->rb.rb_right; 122 link = &base->rb.rb_right;
126 else if (newfrag->ofs < base->ofs) 123 else if (newfrag->ofs < base->ofs)
@@ -175,11 +172,11 @@ static int no_overlapping_node(struct jffs2_sb_info *c, struct rb_root *root,
175 /* By definition, the 'this' node has no right-hand child, 172 /* By definition, the 'this' node has no right-hand child,
176 because there are no frags with offset greater than it. 173 because there are no frags with offset greater than it.
177 So that's where we want to put the hole */ 174 So that's where we want to put the hole */
178 JFFS2_DBG_FRAGTREE2("add hole frag %u-%u on the right of the new frag.\n", 175 JFFS2_DBG_FRAGTREE2("add hole frag %#04x-%#04x on the right of the new frag.\n",
179 holefrag->ofs, holefrag->ofs + holefrag->size); 176 holefrag->ofs, holefrag->ofs + holefrag->size);
180 rb_link_node(&holefrag->rb, &this->rb, &this->rb.rb_right); 177 rb_link_node(&holefrag->rb, &this->rb, &this->rb.rb_right);
181 } else { 178 } else {
182 JFFS2_DBG_FRAGTREE2("Add hole frag %u-%u to the root of the tree.\n", 179 JFFS2_DBG_FRAGTREE2("Add hole frag %#04x-%#04x to the root of the tree.\n",
183 holefrag->ofs, holefrag->ofs + holefrag->size); 180 holefrag->ofs, holefrag->ofs + holefrag->size);
184 rb_link_node(&holefrag->rb, NULL, &root->rb_node); 181 rb_link_node(&holefrag->rb, NULL, &root->rb_node);
185 } 182 }
@@ -475,7 +472,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
475#endif 472#endif
476 473
477 if (crc != tn->data_crc) { 474 if (crc != tn->data_crc) {
478 JFFS2_NOTICE("drong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n", 475 JFFS2_NOTICE("wrong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n",
479 ofs, tn->data_crc, crc); 476 ofs, tn->data_crc, crc);
480 return 1; 477 return 1;
481 } 478 }
@@ -522,9 +519,8 @@ static inline int check_node(struct jffs2_sb_info *c, struct jffs2_inode_info *f
522 if (ref_flags(tn->fn->raw) != REF_UNCHECKED) 519 if (ref_flags(tn->fn->raw) != REF_UNCHECKED)
523 return 0; 520 return 0;
524 521
525 JFFS2_DBG_FRAGTREE2("check node %u-%u, phys offs %#08x.\n", 522 JFFS2_DBG_FRAGTREE2("check node %#04x-%#04x, phys offs %#08x.\n",
526 tn->fn->ofs, tn->fn->ofs + tn->fn->size, 523 tn->fn->ofs, tn->fn->ofs + tn->fn->size, ref_offset(tn->fn->raw));
527 ref_offset(tn->fn->raw));
528 524
529 ret = check_node_data(c, tn); 525 ret = check_node_data(c, tn);
530 if (unlikely(ret < 0)) { 526 if (unlikely(ret < 0)) {
@@ -643,7 +639,7 @@ int jffs2_add_older_frag_to_fragtree(struct jffs2_sb_info *c, struct jffs2_inode
643 int err, checked = 0; 639 int err, checked = 0;
644 int ref_flag; 640 int ref_flag;
645 641
646 JFFS2_DBG_FRAGTREE("insert fragment %#04x-%#04x\n", fn_ofs, fn_ofs + fn_size); 642 JFFS2_DBG_FRAGTREE("insert fragment %#04x-%#04x, ver %u\n", fn_ofs, fn_ofs + fn_size, tn->version);
647 643
648 /* Skip all the nodes which are completed before this one starts */ 644 /* Skip all the nodes which are completed before this one starts */
649 this = jffs2_lookup_node_frag(root, fn_ofs); 645 this = jffs2_lookup_node_frag(root, fn_ofs);
@@ -975,22 +971,14 @@ struct jffs2_node_frag *jffs2_lookup_node_frag(struct rb_root *fragtree, uint32_
975 while(next) { 971 while(next) {
976 frag = rb_entry(next, struct jffs2_node_frag, rb); 972 frag = rb_entry(next, struct jffs2_node_frag, rb);
977 973
978 JFFS2_DBG_FRAGTREE2("considering frag %#04x-%#04x (%p). left %p, right %p\n",
979 frag->ofs, frag->ofs+frag->size, frag, frag->rb.rb_left, frag->rb.rb_right);
980 if (frag->ofs + frag->size <= offset) { 974 if (frag->ofs + frag->size <= offset) {
981 JFFS2_DBG_FRAGTREE2("going right from frag %#04x-%#04x, before the region we care about\n",
982 frag->ofs, frag->ofs+frag->size);
983 /* Remember the closest smaller match on the way down */ 975 /* Remember the closest smaller match on the way down */
984 if (!prev || frag->ofs > prev->ofs) 976 if (!prev || frag->ofs > prev->ofs)
985 prev = frag; 977 prev = frag;
986 next = frag->rb.rb_right; 978 next = frag->rb.rb_right;
987 } else if (frag->ofs > offset) { 979 } else if (frag->ofs > offset) {
988 JFFS2_DBG_FRAGTREE2("going left from frag %#04x-%#04x, after the region we care about\n",
989 frag->ofs, frag->ofs+frag->size);
990 next = frag->rb.rb_left; 980 next = frag->rb.rb_left;
991 } else { 981 } else {
992 JFFS2_DBG_FRAGTREE2("returning frag %#04x-%#04x, matched\n",
993 frag->ofs, frag->ofs+frag->size);
994 return frag; 982 return frag;
995 } 983 }
996 } 984 }
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 488787a823b6..e6076fa5560f 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: readinode.c,v 1.135 2005/08/01 12:05:19 dedekind Exp $ 10 * $Id: readinode.c,v 1.137 2005/08/03 09:26:46 dedekind Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -278,10 +278,11 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
278 278
279 /* If we actually calculated the whole data CRC 279 /* If we actually calculated the whole data CRC
280 * and it is wrong, drop the node. */ 280 * and it is wrong, drop the node. */
281 if (unlikely(tn->partial_crc 281 if (len == csize && unlikely(tn->partial_crc != je32_to_cpu(rd->data_crc))) {
282 != je32_to_cpu(rd->data_crc)) && 282 JFFS2_NOTICE("wrong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n",
283 len == csize) 283 ref_offset(ref), tn->partial_crc, je32_to_cpu(rd->data_crc));
284 goto free_out; 284 goto free_out;
285 }
285 286
286 } else if (csize == 0) { 287 } else if (csize == 0) {
287 /* 288 /*
@@ -521,10 +522,8 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
521 bufstart = buf + (ref_offset(ref) % c->wbuf_pagesize); 522 bufstart = buf + (ref_offset(ref) % c->wbuf_pagesize);
522 /* We will read either one wbuf or 2 wbufs. */ 523 /* We will read either one wbuf or 2 wbufs. */
523 len = c->wbuf_pagesize - (bufstart - buf); 524 len = c->wbuf_pagesize - (bufstart - buf);
524 if (JFFS2_MIN_NODE_HEADER + 525 if (JFFS2_MIN_NODE_HEADER + (int)(bufstart - buf) > c->wbuf_pagesize) {
525 (int)(bufstart - buf) > c->wbuf_pagesize) { 526 /* The header spans the border of the first wbuf */
526 /* The header spans the border of the
527 * first wbuf */
528 len += c->wbuf_pagesize; 527 len += c->wbuf_pagesize;
529 } 528 }
530 } else { 529 } else {