aboutsummaryrefslogtreecommitdiff
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 2112bab514c..11ee75922a5 100644
--- a/fs/jffs2/debug.h
+++ b/fs/jffs2/debug.h
@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
- * $Id: debug.h,v 1.8 2005/07/31 09:08:38 dedekind Exp $
+ * $Id: debug.h,v 1.10 2005/08/02 10:03:51 dedekind Exp $
*
*/
#ifndef _JFFS2_DEBUG_H_
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c
index 390ce06ab1a..007d52f394d 100644
--- a/fs/jffs2/nodelist.c
+++ b/fs/jffs2/nodelist.c
@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
- * $Id: nodelist.c,v 1.104 2005/08/01 12:05:19 dedekind Exp $
+ * $Id: nodelist.c,v 1.107 2005/08/03 09:26:46 dedekind Exp $
*
*/
@@ -60,7 +60,6 @@ void jffs2_truncate_fragtree(struct jffs2_sb_info *c, struct rb_root *list, uint
/* We know frag->ofs <= size. That's what lookup does for us */
if (frag && frag->ofs != size) {
if (frag->ofs+frag->size > size) {
- JFFS2_DBG_FRAGTREE2("truncating frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size);
frag->size = size - frag->ofs;
}
frag = frag_next(frag);
@@ -68,7 +67,6 @@ void jffs2_truncate_fragtree(struct jffs2_sb_info *c, struct rb_root *list, uint
while (frag && frag->ofs >= size) {
struct jffs2_node_frag *next = frag_next(frag);
- JFFS2_DBG_FRAGTREE("removing frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size);
frag_erase(frag, list);
jffs2_obsolete_node_frag(c, frag);
frag = next;
@@ -120,7 +118,6 @@ static void jffs2_fragtree_insert(struct jffs2_node_frag *newfrag, struct jffs2_
parent = *link;
base = rb_entry(parent, struct jffs2_node_frag, rb);
- JFFS2_DBG_FRAGTREE2("considering frag at 0x%08x\n", base->ofs);
if (newfrag->ofs > base->ofs)
link = &base->rb.rb_right;
else if (newfrag->ofs < base->ofs)
@@ -175,11 +172,11 @@ static int no_overlapping_node(struct jffs2_sb_info *c, struct rb_root *root,
/* By definition, the 'this' node has no right-hand child,
because there are no frags with offset greater than it.
So that's where we want to put the hole */
- JFFS2_DBG_FRAGTREE2("add hole frag %u-%u on the right of the new frag.\n",
+ JFFS2_DBG_FRAGTREE2("add hole frag %#04x-%#04x on the right of the new frag.\n",
holefrag->ofs, holefrag->ofs + holefrag->size);
rb_link_node(&holefrag->rb, &this->rb, &this->rb.rb_right);
} else {
- JFFS2_DBG_FRAGTREE2("Add hole frag %u-%u to the root of the tree.\n",
+ JFFS2_DBG_FRAGTREE2("Add hole frag %#04x-%#04x to the root of the tree.\n",
holefrag->ofs, holefrag->ofs + holefrag->size);
rb_link_node(&holefrag->rb, NULL, &root->rb_node);
}
@@ -475,7 +472,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
#endif
if (crc != tn->data_crc) {
- JFFS2_NOTICE("drong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n",
+ JFFS2_NOTICE("wrong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n",
ofs, tn->data_crc, crc);
return 1;
}
@@ -522,9 +519,8 @@ static inline int check_node(struct jffs2_sb_info *c, struct jffs2_inode_info *f
if (ref_flags(tn->fn->raw) != REF_UNCHECKED)
return 0;
- JFFS2_DBG_FRAGTREE2("check node %u-%u, phys offs %#08x.\n",
- tn->fn->ofs, tn->fn->ofs + tn->fn->size,
- ref_offset(tn->fn->raw));
+ JFFS2_DBG_FRAGTREE2("check node %#04x-%#04x, phys offs %#08x.\n",
+ tn->fn->ofs, tn->fn->ofs + tn->fn->size, ref_offset(tn->fn->raw));
ret = check_node_data(c, tn);
if (unlikely(ret < 0)) {
@@ -643,7 +639,7 @@ int jffs2_add_older_frag_to_fragtree(struct jffs2_sb_info *c, struct jffs2_inode
int err, checked = 0;
int ref_flag;
- JFFS2_DBG_FRAGTREE("insert fragment %#04x-%#04x\n", fn_ofs, fn_ofs + fn_size);
+ JFFS2_DBG_FRAGTREE("insert fragment %#04x-%#04x, ver %u\n", fn_ofs, fn_ofs + fn_size, tn->version);
/* Skip all the nodes which are completed before this one starts */
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_
while(next) {
frag = rb_entry(next, struct jffs2_node_frag, rb);
- JFFS2_DBG_FRAGTREE2("considering frag %#04x-%#04x (%p). left %p, right %p\n",
- frag->ofs, frag->ofs+frag->size, frag, frag->rb.rb_left, frag->rb.rb_right);
if (frag->ofs + frag->size <= offset) {
- JFFS2_DBG_FRAGTREE2("going right from frag %#04x-%#04x, before the region we care about\n",
- frag->ofs, frag->ofs+frag->size);
/* Remember the closest smaller match on the way down */
if (!prev || frag->ofs > prev->ofs)
prev = frag;
next = frag->rb.rb_right;
} else if (frag->ofs > offset) {
- JFFS2_DBG_FRAGTREE2("going left from frag %#04x-%#04x, after the region we care about\n",
- frag->ofs, frag->ofs+frag->size);
next = frag->rb.rb_left;
} else {
- JFFS2_DBG_FRAGTREE2("returning frag %#04x-%#04x, matched\n",
- frag->ofs, frag->ofs+frag->size);
return frag;
}
}
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 488787a823b..e6076fa5560 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
- * $Id: readinode.c,v 1.135 2005/08/01 12:05:19 dedekind Exp $
+ * $Id: readinode.c,v 1.137 2005/08/03 09:26:46 dedekind Exp $
*
*/
@@ -278,10 +278,11 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
/* If we actually calculated the whole data CRC
* and it is wrong, drop the node. */
- if (unlikely(tn->partial_crc
- != je32_to_cpu(rd->data_crc)) &&
- len == csize)
+ if (len == csize && unlikely(tn->partial_crc != je32_to_cpu(rd->data_crc))) {
+ JFFS2_NOTICE("wrong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n",
+ ref_offset(ref), tn->partial_crc, je32_to_cpu(rd->data_crc));
goto free_out;
+ }
} else if (csize == 0) {
/*
@@ -521,10 +522,8 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
bufstart = buf + (ref_offset(ref) % c->wbuf_pagesize);
/* We will read either one wbuf or 2 wbufs. */
len = c->wbuf_pagesize - (bufstart - buf);
- if (JFFS2_MIN_NODE_HEADER +
- (int)(bufstart - buf) > c->wbuf_pagesize) {
- /* The header spans the border of the
- * first wbuf */
+ if (JFFS2_MIN_NODE_HEADER + (int)(bufstart - buf) > c->wbuf_pagesize) {
+ /* The header spans the border of the first wbuf */
len += c->wbuf_pagesize;
}
} else {