mtd/fs/jffs3 debug.h,1.14,1.15 readinode.c,3.2,3.3 write.c,3.4,3.5
Artem Bityuckiy
dedekind at infradead.org
Wed Dec 22 10:18:33 EST 2004
Update of /home/cvs/mtd/fs/jffs3
In directory phoenix.infradead.org:/tmp/cvs-serv30777
Modified Files:
debug.h readinode.c write.c
Log Message:
More prink changes.
Index: debug.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/debug.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- debug.h 21 Dec 2004 17:12:56 -0000 1.14
+++ debug.h 22 Dec 2004 15:18:30 -0000 1.15
@@ -49,10 +49,11 @@
#define JFFS3_DBG_COMPR 11 /* Compression */
#define JFFS3_DBG_SUMMARY 12 /* Summaries processing */
#define JFFS3_DBG_RI 13 /* Read inode */
-#define JFFS3_DBG_BI 14 /* Build inode (after reading) */
+#define JFFS3_DBG_BI 14 /* Build inode's fragtree/dirents list */
#define JFFS3_DBG_RSV 15 /* Flash space reservation */
#define JFFS3_DBG_NR 16 /* Manipulating raw_node_ref objects */
#define JFFS3_DBG_BL 17 /* Manipulating block lists */
+#define JFFS3_DBG_WRITE 18 /* JFFS2 nodes creation and writing */
#if CONFIG_JFFS3_FS_DEBUG > 0
#define JFFS3_DBG_PARANOIA_CHECKS 1
@@ -74,6 +75,7 @@
#define JFFS3_DBG_SUBSYS_RSV_PRINT 1
#define JFFS3_DBG_SUBSYS_NR_PRINT 1
#define JFFS3_DBG_SUBSYS_BL_PRINT 1
+#define JFFS3_DBG_SUBSYS_WRITE_PRINT 1
#else
#define JFFS3_DBG_SUBSYS_OTHER_PRINT 0
#define JFFS3_DBG_SUBSYS_SCAN_PRINT 0
@@ -92,6 +94,7 @@
#define JFFS3_DBG_SUBSYS_RSV_PRINT 0
#define JFFS3_DBG_SUBSYS_NR_PRINT 0
#define JFFS3_DBG_SUBSYS_BL_PRINT 0
+#define JFFS3_DBG_SUBSYS_WRITE_PRINT 0
#endif
/*
@@ -104,6 +107,10 @@
char *subsysname = NULL; \
if ((debug_level) >= CONFIG_JFFS3_FS_DEBUG) { \
switch (subsystem) { \
+ case JFFS3_DBG_WRITE: \
+ if (JFFS3_DBG_SUBSYS_WRITE_PRINT) \
+ subsysname = "write"; \
+ break; \
case JFFS3_DBG_NR: \
if (JFFS3_DBG_SUBSYS_NR_PRINT) \
subsysname = "nr"; \
@@ -238,6 +245,9 @@
#define DBG_BL(debug_level, args...) \
JFFS3DBG_SUBSYSTEM(JFFS3_DBG_BL, debug_level, args)
+#define DBG_WRITE(debug_level, args...) \
+ JFFS3DBG_SUBSYSTEM(JFFS3_DBG_WRITE, debug_level, args)
+
/*
* Please, use this macro in case of critical error which makes JFFS3
* futher unworkable or when you use BUG().
Index: readinode.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/readinode.c,v
retrieving revision 3.2
retrieving revision 3.3
diff -u -r3.2 -r3.3
--- readinode.c 13 Dec 2004 15:38:48 -0000 3.2
+++ readinode.c 22 Dec 2004 15:18:30 -0000 3.3
@@ -29,14 +29,14 @@
this->node->frags--;
if (!this->node->frags) {
/* The node has no valid frags left. It's totally obsoleted */
- D2(printk(KERN_DEBUG "Marking old node @0x%08x (0x%04x-0x%04x) obsolete\n",
- ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size));
+ DBG_BI(2, "Marking old node @0x%08x (0x%04x-0x%04x) obsolete\n",
+ ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size);
jffs3_mark_node_obsolete(c, this->node->raw);
jffs3_free_full_dnode(this->node);
} else {
- D2(printk(KERN_DEBUG "Marking old node @0x%08x (0x%04x-0x%04x) REF_NORMAL. frags is %d\n",
+ DBG_BI(2, "Marking old node @0x%08x (0x%04x-0x%04x) REF_NORMAL. frags is %d\n",
ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size,
- this->node->frags));
+ this->node->frags);
mark_ref_normal(this->node->raw);
}
@@ -52,14 +52,14 @@
int ret;
struct jffs3_node_frag *newfrag;
- D1(printk(KERN_DEBUG "jffs3_add_full_dnode_to_inode(ino #%u, f %p, fn %p)\n", f->inocache->ino, f, fn));
+ DBG_BI(1, "enter, ino #%u, f %p, fn %p)\n", f->inocache->ino, f, fn);
newfrag = jffs3_alloc_node_frag();
if (unlikely(!newfrag))
return -ENOMEM;
- D2(printk(KERN_DEBUG "adding node %04x-%04x @0x%08x on flash, newfrag *%p\n",
- fn->ofs, fn->ofs+fn->size, ref_offset(fn->raw), newfrag));
+ DBG_BI(2, "adding node %04x-%04x @0x%08x on flash, newfrag *%p\n",
+ fn->ofs, fn->ofs+fn->size, ref_offset(fn->raw), newfrag);
if (unlikely(!fn->size)) {
jffs3_free_node_frag(newfrag);
@@ -110,11 +110,12 @@
this = jffs3_lookup_node_frag(list, newfrag->node->ofs);
if (this) {
- D2(printk(KERN_DEBUG "j_a_f_d_t_f: Lookup gave frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
- this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this));
+ DBG_BI(2, "Lookup gave frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
+ this->ofs, this->ofs+this->size,
+ this->node ? (ref_offset(this->node->raw)) : 0xffffffff, this);
lastend = this->ofs + this->size;
} else {
- D2(printk(KERN_DEBUG "j_a_f_d_t_f: Lookup gave no frag\n"));
+ DBG_BI(2, "Lookup gave no frag\n");
lastend = 0;
}
@@ -146,10 +147,10 @@
/* 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 */
- D2(printk(KERN_DEBUG "Adding hole frag (%p) on right of node at (%p)\n", holefrag, this));
+ DBG_BI(2, "Adding hole frag (%p) on right of node at (%p)\n", holefrag, this);
rb_link_node(&holefrag->rb, &this->rb, &this->rb.rb_right);
} else {
- D2(printk(KERN_DEBUG "Adding hole frag (%p) at root of tree\n", holefrag));
+ DBG_BI(2, "Adding hole frag (%p) at root of tree\n", holefrag);
rb_link_node(&holefrag->rb, NULL, &list->rb_node);
}
rb_insert_color(&holefrag->rb, list);
@@ -159,18 +160,19 @@
/* 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 */
- D2(printk(KERN_DEBUG "Adding new frag (%p) on right of node at (%p)\n", newfrag, this));
+ DBG_BI(2, "Adding new frag (%p) on right of node at (%p)\n", newfrag, this);
rb_link_node(&newfrag->rb, &this->rb, &this->rb.rb_right);
} else {
- D2(printk(KERN_DEBUG "Adding new frag (%p) at root of tree\n", newfrag));
+ DBG_BI(2, "Adding new frag (%p) at root of tree\n", newfrag);
rb_link_node(&newfrag->rb, NULL, &list->rb_node);
}
rb_insert_color(&newfrag->rb, list);
return 0;
}
- D2(printk(KERN_DEBUG "j_a_f_d_t_f: dealing with frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
- this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this));
+ DBG_BI(2, "dealing with frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
+ this->ofs, this->ofs+this->size,
+ this->node ? (ref_offset(this->node->raw)) : 0xffffffff, this);
/* OK. 'this' is pointing at the first frag that newfrag->ofs at least partially obsoletes,
* - i.e. newfrag->ofs < this->ofs+this->size && newfrag->ofs >= this->ofs
@@ -191,11 +193,13 @@
jffs3_free_node_frag(newfrag);
return -ENOMEM;
}
- D2(printk(KERN_DEBUG "split old frag 0x%04x-0x%04x -->", this->ofs, this->ofs+this->size);
+
+ D2(
+ DBG_BI(2, "split old frag 0x%04x-0x%04x -->", this->ofs, this->ofs+this->size);
if (this->node)
- printk("phys 0x%08x\n", ref_offset(this->node->raw));
+ DBG_BI(2, "phys 0x%08x\n", ref_offset(this->node->raw));
else
- printk("hole\n");
+ DBG_BI(2, "hole\n");
)
/* New second frag pointing to this's node */
@@ -231,14 +235,14 @@
} else {
/* New frag starts at the same point as 'this' used to. Replace
it in the tree without doing a delete and insertion */
- D2(printk(KERN_DEBUG "Inserting newfrag (*%p),%d-%d in before 'this' (*%p),%d-%d\n",
+ DBG_BI(2, "Inserting newfrag (*%p),%d-%d in before 'this' (*%p),%d-%d\n",
newfrag, newfrag->ofs, newfrag->ofs+newfrag->size,
- this, this->ofs, this->ofs+this->size));
+ this, this->ofs, this->ofs+this->size);
rb_replace_node(&this->rb, &newfrag->rb, list);
if (newfrag->ofs + newfrag->size >= this->ofs+this->size) {
- D2(printk(KERN_DEBUG "Obsoleting node frag %p (%x-%x)\n", this, this->ofs, this->ofs+this->size));
+ DBG_BI(2, "Obsoleting node frag %p (%x-%x)\n", this, this->ofs, this->ofs+this->size);
jffs3_obsolete_node_frag(c, this);
} else {
this->ofs += newfrag->size;
@@ -254,7 +258,8 @@
*/
while ((this = frag_next(newfrag)) && newfrag->ofs + newfrag->size >= this->ofs + this->size) {
/* 'this' frag is obsoleted completely. */
- D2(printk(KERN_DEBUG "Obsoleting node frag %p (%x-%x) and removing from tree\n", this, this->ofs, this->ofs+this->size));
+ DBG_BI(2, "Obsoleting node frag %p (%x-%x) and removing from tree\n",
+ this, this->ofs, this->ofs+this->size);
rb_erase(&this->rb, list);
jffs3_obsolete_node_frag(c, this);
}
@@ -280,12 +285,12 @@
{
struct jffs3_node_frag *frag = jffs3_lookup_node_frag(list, size);
- D1(printk(KERN_DEBUG "Truncating fraglist to 0x%08x bytes\n", size));
+ DBG_BI(1, "Truncating fraglist to 0x%08x bytes\n", size);
/* We know frag->ofs <= size. That's what lookup does for us */
if (frag && frag->ofs != size) {
if (frag->ofs+frag->size >= size) {
- D1(printk(KERN_DEBUG "Truncating frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size));
+ DBG_BI(1, "Truncating frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size);
frag->size = size - frag->ofs;
}
frag = frag_next(frag);
@@ -293,7 +298,7 @@
while (frag && frag->ofs >= size) {
struct jffs3_node_frag *next = frag_next(frag);
- D1(printk(KERN_DEBUG "Removing frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size));
+ DBG_BI(1, "Removing frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size);
frag_erase(frag, list);
jffs3_obsolete_node_frag(c, frag);
frag = next;
@@ -309,13 +314,13 @@
int jffs3_do_read_inode(struct jffs3_sb_info *c, struct jffs3_inode_info *f,
uint32_t ino, struct jffs3_raw_inode *latest_node)
{
- D2(printk(KERN_DEBUG "jffs3_do_read_inode(): getting inocache\n"));
+ DBG_RI(2, "entering\n");
retry_inocache:
spin_lock(&c->inocache_lock);
f->inocache = jffs3_get_ino_cache(c, ino);
- D2(printk(KERN_DEBUG "jffs3_do_read_inode(): Got inocache at %p\n", f->inocache));
+ DBG_RI(2, "Got inocache at %p\n", f->inocache);
if (f->inocache) {
/* Check its state. We may need to wait before we can use it */
@@ -330,8 +335,8 @@
/* If it's in either of these states, we need
to wait for whoever's got it to finish and
put it back. */
- D1(printk(KERN_DEBUG "jffs3_get_ino_cache_read waiting for ino #%u in state %d\n",
- ino, f->inocache->state));
+ DBG_RI(1, "waiting for ino #%u in state %d\n",
+ ino, f->inocache->state);
sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock);
goto retry_inocache;
@@ -340,7 +345,8 @@
/* Eep. This should never happen. It can
happen if Linux calls read_inode() again
before clear_inode() has finished though. */
- printk(KERN_WARNING "Eep. Trying to read_inode #%u when it's already in state %d!\n", ino, f->inocache->state);
+ WARNING_MSG("Eep. Trying to read_inode #%u when it's "
+ "already in state %d!\n", ino, f->inocache->state);
/* Fail. That's probably better than allowing it to succeed */
f->inocache = NULL;
break;
@@ -355,10 +361,10 @@
/* Special case - no root inode on medium */
f->inocache = jffs3_alloc_inode_cache();
if (!f->inocache) {
- printk(KERN_CRIT "jffs3_do_read_inode(): Cannot allocate inocache for root inode\n");
+ WARNING_MSG("jffs3_do_read_inode(): Cannot allocate inocache for root inode\n");
return -ENOMEM;
}
- D1(printk(KERN_DEBUG "jffs3_do_read_inode(): Creating inocache for root inode\n"));
+ DBG_RI(1, "Creating inocache for root inode\n");
memset(f->inocache, 0, sizeof(struct jffs3_inode_cache));
f->inocache->ino = f->inocache->nlink = 1;
f->inocache->nodes = (struct jffs3_raw_node_ref *)f->inocache;
@@ -366,7 +372,7 @@
jffs3_add_ino_cache(c, f->inocache);
}
if (!f->inocache) {
- printk(KERN_WARNING "jffs3_do_read_inode() on nonexistent ino %u\n", ino);
+ WARNING_MSG("on nonexistent ino %u\n", ino);
return -ENOENT;
}
@@ -408,13 +414,13 @@
size_t retlen;
int ret;
- D1(printk(KERN_DEBUG "jffs3_do_read_inode_internal(): ino #%u nlink is %d\n", f->inocache->ino, f->inocache->nlink));
+ DBG_RI(1, "ino #%u nlink is %d\n", f->inocache->ino, f->inocache->nlink);
/* Grab all nodes relevant to this ino */
ret = jffs3_get_inode_nodes(c, f, &tn_list, &fd_list, &f->highest_version, &latest_mctime, &mctime_ver);
if (ret) {
- printk(KERN_CRIT "jffs3_get_inode_nodes() for ino %u returned %d\n", f->inocache->ino, ret);
+ WARNING_MSG("for ino %u returned %d\n", f->inocache->ino, ret);
if (f->inocache->state == INO_STATE_READING)
jffs3_set_inocache_state(c, f->inocache, INO_STATE_CHECKEDABSENT);
return ret;
@@ -428,7 +434,7 @@
if (f->metadata) {
if (likely(tn->version >= mdata_ver)) {
- D1(printk(KERN_DEBUG "Obsoleting old metadata at 0x%08x\n", ref_offset(f->metadata->raw)));
+ DBG_RI(1, "Obsoleting old metadata at 0x%08x\n", ref_offset(f->metadata->raw));
jffs3_mark_node_obsolete(c, f->metadata->raw);
jffs3_free_full_dnode(f->metadata);
f->metadata = NULL;
@@ -436,8 +442,9 @@
mdata_ver = 0;
} else {
/* This should never happen. */
- printk(KERN_WARNING "Er. New metadata at 0x%08x with ver %d is actually older than previous ver %d at 0x%08x\n",
- ref_offset(fn->raw), tn->version, mdata_ver, ref_offset(f->metadata->raw));
+ WARNING_MSG("Er. New metadata at 0x%08x with ver %d is actually older "
+ "than previous ver %d at 0x%08x\n",
+ ref_offset(fn->raw), tn->version, mdata_ver, ref_offset(f->metadata->raw));
jffs3_mark_node_obsolete(c, fn->raw);
jffs3_free_full_dnode(fn);
/* Fill in latest_node from the metadata, not this one we're about to free... */
@@ -450,7 +457,7 @@
jffs3_add_full_dnode_to_inode(c, f, fn);
} else {
/* Zero-sized node at end of version list. Just a metadata update */
- D1(printk(KERN_DEBUG "metadata @%08x: ver %d\n", ref_offset(fn->raw), tn->version));
+ DBG_RI(1, "metadata @%08x: ver %d\n", ref_offset(fn->raw), tn->version);
f->metadata = fn;
mdata_ver = tn->version;
}
@@ -464,13 +471,14 @@
if (!fn) {
/* No data nodes for this inode. */
if (f->inocache->ino != 1) {
- printk(KERN_WARNING "jffs3_do_read_inode(): No data nodes found for ino #%u\n", f->inocache->ino);
if (!fd_list) {
+ WARNING_MSG("No data nodes found for ino #%u\n", f->inocache->ino);
if (f->inocache->state == INO_STATE_READING)
jffs3_set_inocache_state(c, f->inocache, INO_STATE_CHECKEDABSENT);
return -EIO;
- }
- printk(KERN_WARNING "jffs3_do_read_inode(): But it has children so we fake some modes for it\n");
+ } else
+ DBG_RI(1, "No data nodes found for ino #%u, but it has children "
+ "so we fake some modes for it\n", f->inocache->ino);
}
latest_node->mode = cpu_to_jemode(S_IFDIR|S_IRUGO|S_IWUSR|S_IXUGO);
latest_node->version = cpu_to_je32(0);
@@ -485,8 +493,8 @@
ret = jffs3_flash_read(c, ref_offset(fn->raw), sizeof(*latest_node), &retlen, (void *)latest_node);
if (ret || retlen != sizeof(*latest_node)) {
- printk(KERN_NOTICE "MTD read in jffs3_do_read_inode() failed: Returned %d, %zd of %zd bytes read\n",
- ret, retlen, sizeof(*latest_node));
+ WARNING_MSG("MTD read failed: Returned %d, %zd of %zd bytes read\n",
+ ret, retlen, sizeof(*latest_node));
/* FIXME: If this fails, there seems to be a memory leak. Find it. */
up(&f->sem);
jffs3_do_clear_inode(c, f);
@@ -495,7 +503,8 @@
crc = crc32(0, latest_node, sizeof(*latest_node)-8);
if (crc != je32_to_cpu(latest_node->node_crc)) {
- printk(KERN_NOTICE "CRC failed for read_inode of inode %u at physical location 0x%x\n", f->inocache->ino, ref_offset(fn->raw));
+ WARNING_MSG("CRC failed for read_inode of inode %u at physical location 0x%x\n",
+ f->inocache->ino, ref_offset(fn->raw));
up(&f->sem);
jffs3_do_clear_inode(c, f);
return -EIO;
@@ -530,14 +539,14 @@
/* Certain inode types should have only one data node, and it's
kept as the metadata node */
if (f->metadata) {
- printk(KERN_WARNING "Argh. Special inode #%u with mode 0%o had metadata node\n",
+ WARNING_MSG("Argh. Special inode #%u with mode 0%o had metadata node\n",
f->inocache->ino, jemode_to_cpu(latest_node->mode));
up(&f->sem);
jffs3_do_clear_inode(c, f);
return -EIO;
}
if (!frag_first(&f->fragtree)) {
- printk(KERN_WARNING "Argh. Special inode #%u with mode 0%o has no fragments\n",
+ WARNING_MSG("Argh. Special inode #%u with mode 0%o has no fragments\n",
f->inocache->ino, jemode_to_cpu(latest_node->mode));
up(&f->sem);
jffs3_do_clear_inode(c, f);
@@ -545,7 +554,7 @@
}
/* ASSERT: f->fraglist != NULL */
if (frag_next(frag_first(&f->fragtree))) {
- printk(KERN_WARNING "Argh. Special inode #%u with mode 0x%x had more than one node\n",
+ WARNING_MSG("Argh. Special inode #%u with mode 0x%x had more than one node\n",
f->inocache->ino, jemode_to_cpu(latest_node->mode));
/* FIXME: Deal with it - check crc32, check for duplicate node, check times and discard the older one */
up(&f->sem);
Index: write.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/write.c,v
retrieving revision 3.4
retrieving revision 3.5
diff -u -r3.4 -r3.5
--- write.c 21 Dec 2004 15:18:51 -0000 3.4
+++ write.c 22 Dec 2004 15:18:30 -0000 3.5
@@ -40,7 +40,7 @@
ri->ino = cpu_to_je32(f->inocache->ino);
- D1(printk(KERN_DEBUG "jffs3_do_new_inode(): Assigned ino# %d\n", f->inocache->ino));
+ DBG(1, "Assigned ino# %d\n", f->inocache->ino);
jffs3_add_ino_cache(c, f->inocache);
ri->magic = cpu_to_je16(JFFS3_MAGIC_BITMASK);
@@ -70,10 +70,9 @@
unsigned long cnt = 2;
D1(if(je32_to_cpu(ri->hdr_crc) != crc32(0, ri, sizeof(struct jffs3_unknown_node)-4)) {
- printk(KERN_CRIT "Eep. CRC not correct in jffs3_write_dnode()\n");
+ ERROR_MSG("Eep. CRC not correct\n");
BUG();
- }
- );
+ });
vecs[0].iov_base = ri;
vecs[0].iov_len = sizeof(*ri);
vecs[1].iov_base = (unsigned char *)data;
@@ -82,7 +81,9 @@
jffs3_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len);
if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) {
- printk(KERN_WARNING "jffs3_write_dnode: ri->totlen (0x%08x) != sizeof(*ri) (0x%08zx) + datalen (0x%08x)\n", je32_to_cpu(ri->totlen), sizeof(*ri), datalen);
+ WARNING_MSG("ri->totlen (0x%08x) != sizeof(*ri) "
+ "(0x%08zx) + datalen (0x%08x)\n",
+ je32_to_cpu(ri->totlen), sizeof(*ri), datalen);
}
raw = jffs3_alloc_raw_node_ref();
if (!raw)
@@ -112,7 +113,7 @@
(alloc_mode==ALLOC_GC)?0:f->inocache->ino);
if (ret || (retlen != sizeof(*ri) + datalen)) {
- printk(KERN_NOTICE "Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n",
+ WARNING_MSG("Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n",
sizeof(*ri)+datalen, flash_ofs, ret, retlen);
/* Mark the space as dirtied */
@@ -129,7 +130,8 @@
jffs3_add_physical_node_ref(c, raw);
jffs3_mark_node_obsolete(c, raw);
} else {
- printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset);
+ WARNING_MSG("Not marking the space at 0x%08x as dirty because "
+ "the flash driver returned retlen zero\n", raw->flash_offset);
jffs3_free_raw_node_ref(raw);
}
if (!retried && alloc_mode != ALLOC_NORETRY && (raw = jffs3_alloc_raw_node_ref())) {
@@ -139,7 +141,7 @@
retried = 1;
- D1(printk(KERN_DEBUG "Retrying failed write.\n"));
+ DBG_WRITE(1, "Retrying failed write.\n");
jffs3_dbg_acct_sanity_check(c, jeb);
jffs3_dbg_acct_paranoia_check(c, jeb);
@@ -156,14 +158,14 @@
}
if (!ret) {
- D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", flash_ofs));
+ DBG_WRITE(1, "Allocated space at 0x%08x to retry failed write.\n", flash_ofs);
jffs3_dbg_acct_sanity_check(c, jeb);
jffs3_dbg_acct_paranoia_check(c, jeb);
goto retry;
}
- D1(printk(KERN_DEBUG "Failed to allocate space to retry failed write: %d!\n", ret));
+ DBG_WRITE(1, "Failed to allocate space to retry failed write: %d!\n", ret);
jffs3_free_raw_node_ref(raw);
}
/* Release the full_dnode which is now useless, and return */
@@ -190,10 +192,11 @@
f->inocache->nodes = raw;
spin_unlock(&c->erase_completion_lock);
- D1(printk(KERN_DEBUG "jffs3_write_dnode wrote node at 0x%08x(%d) with dsize 0x%x, csize 0x%x, node_crc 0x%08x, data_crc 0x%08x, totlen 0x%08x\n",
- flash_ofs, ref_flags(raw), je32_to_cpu(ri->dsize),
- je32_to_cpu(ri->csize), je32_to_cpu(ri->node_crc),
- je32_to_cpu(ri->data_crc), je32_to_cpu(ri->totlen)));
+ DBG_WRITE(1, "wrote node at 0x%08x(%d) with dsize 0x%x, csize 0x%x, "
+ "node_crc 0x%08x, data_crc 0x%08x, totlen 0x%08x\n",
+ flash_ofs, ref_flags(raw), je32_to_cpu(ri->dsize),
+ je32_to_cpu(ri->csize), je32_to_cpu(ri->node_crc),
+ je32_to_cpu(ri->data_crc), je32_to_cpu(ri->totlen));
if (retried) {
jffs3_dbg_acct_sanity_check(c, NULL);
@@ -211,15 +214,14 @@
int retried = 0;
int ret;
- D1(printk(KERN_DEBUG "jffs3_write_dirent(ino #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x)\n",
+ DBG_WRITE(1, "entering, ino #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x\n",
je32_to_cpu(rd->pino), name, name, je32_to_cpu(rd->ino),
- je32_to_cpu(rd->name_crc)));
+ je32_to_cpu(rd->name_crc));
D1(if(je32_to_cpu(rd->hdr_crc) != crc32(0, rd, sizeof(struct jffs3_unknown_node)-4)) {
- printk(KERN_CRIT "Eep. CRC not correct in jffs3_write_dirent()\n");
+ ERROR_MSG("Eep. CRC not correct\n");
BUG();
- }
- );
+ });
vecs[0].iov_base = rd;
vecs[0].iov_len = sizeof(*rd);
@@ -255,8 +257,8 @@
ret = jffs3_flash_writev(c, vecs, 2, flash_ofs, &retlen,
(alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino));
if (ret || (retlen != sizeof(*rd) + namelen)) {
- printk(KERN_NOTICE "Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n",
- sizeof(*rd)+namelen, flash_ofs, ret, retlen);
+ WARNING_MSG("Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n",
+ sizeof(*rd)+namelen, flash_ofs, ret, retlen);
/* Mark the space as dirtied */
if (retlen) {
raw->next_in_ino = NULL;
@@ -264,7 +266,8 @@
jffs3_add_physical_node_ref(c, raw);
jffs3_mark_node_obsolete(c, raw);
} else {
- printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset);
+ WARNING_MSG("Not marking the space at 0x%08x as dirty because "
+ "the flash driver returned retlen zero\n", raw->flash_offset);
jffs3_free_raw_node_ref(raw);
}
if (!retried && (raw = jffs3_alloc_raw_node_ref())) {
@@ -274,7 +277,7 @@
retried = 1;
- D1(printk(KERN_DEBUG "Retrying failed write.\n"));
+ DBG_WRITE(1, "Retrying failed write.\n");
jffs3_dbg_acct_sanity_check(c, jeb);
jffs3_dbg_acct_paranoia_check(c, jeb);
@@ -291,12 +294,12 @@
}
if (!ret) {
- D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", flash_ofs));
+ DBG_WRITE(1, "Allocated space at 0x%08x to retry failed write.\n", flash_ofs);
jffs3_dbg_acct_sanity_check(c, jeb);
jffs3_dbg_acct_paranoia_check(c, jeb);
goto retry;
}
- D1(printk(KERN_DEBUG "Failed to allocate space to retry failed write: %d!\n", ret));
+ DBG_WRITE(1, "Failed to allocate space to retry failed write: %d!\n", ret);
jffs3_free_raw_node_ref(raw);
}
/* Release the full_dnode which is now useless, and return */
@@ -329,8 +332,8 @@
int ret = 0;
uint32_t writtenlen = 0;
- D1(printk(KERN_DEBUG "jffs3_write_inode_range(): Ino #%u, ofs 0x%x, len 0x%x\n",
- f->inocache->ino, offset, writelen));
+ DBG_WRITE(1, "Ino #%u, ofs 0x%x, len 0x%x\n",
+ f->inocache->ino, offset, writelen);
while(writelen) {
struct jffs3_full_dnode *fn;
@@ -341,11 +344,11 @@
int retried = 0;
retry:
- D2(printk(KERN_DEBUG "jffs3_commit_write() loop: 0x%x to write to 0x%x\n", writelen, offset));
+ DBG_WRITE(2, "loop: 0x%x to write to 0x%x\n", writelen, offset);
ret = jffs3_reserve_space(c, sizeof(*ri) + JFFS3_MIN_DATA_LEN, &phys_ofs, &alloclen, ALLOC_NORMAL, JFFS3_SUMMARY_INODE_SIZE);
if (ret) {
- D1(printk(KERN_DEBUG "jffs3_reserve_space returned %d\n", ret));
+ DBG_WRITE(1, "jffs3_reserve_space returned %d\n", ret);
break;
}
down(&f->sem);
@@ -381,7 +384,7 @@
if (!retried) {
/* Write error to be retried */
retried = 1;
- D1(printk(KERN_DEBUG "Retrying node write in jffs3_write_inode_range()\n"));
+ DBG_WRITE(1, "Retrying node write\n");
goto retry;
}
break;
@@ -394,7 +397,7 @@
}
if (ret) {
/* Eep */
- D1(printk(KERN_DEBUG "Eep. add_full_dnode_to_inode() failed in commit_write, returned %d\n", ret));
+ DBG_WRITE(1, "Eep. add_full_dnode_to_inode() failed in commit_write, returned %d\n", ret);
jffs3_mark_node_obsolete(c, fn->raw);
jffs3_free_full_dnode(fn);
@@ -405,11 +408,11 @@
up(&f->sem);
jffs3_complete_reservation(c);
if (!datalen) {
- printk(KERN_WARNING "Eep. We didn't actually write any data in jffs3_write_inode_range()\n");
+ WARNING_MSG("Eep. We didn't actually write any data\n");
ret = -EIO;
break;
}
- D1(printk(KERN_DEBUG "increasing writtenlen by %d\n", datalen));
+ DBG_WRITE(1, "increasing writtenlen by %d\n", datalen);
writtenlen += datalen;
offset += datalen;
writelen -= datalen;
@@ -431,7 +434,7 @@
* Just the node will do for now, though
*/
ret = jffs3_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL, JFFS3_SUMMARY_INODE_SIZE);
- D1(printk(KERN_DEBUG "jffs3_do_create(): reserved 0x%x bytes\n", alloclen));
+ DBG_WRITE(1, "reserved 0x%x bytes\n", alloclen);
if (ret) {
up(&f->sem);
return ret;
@@ -442,11 +445,11 @@
fn = jffs3_write_dnode(c, f, ri, NULL, 0, phys_ofs, ALLOC_NORMAL);
- D1(printk(KERN_DEBUG "jffs3_do_create created file with mode 0x%x\n",
- jemode_to_cpu(ri->mode)));
+ DBG_WRITE(1, "created file with mode 0x%x\n",
+ jemode_to_cpu(ri->mode));
if (IS_ERR(fn)) {
- D1(printk(KERN_DEBUG "jffs3_write_dnode() failed\n"));
+ DBG_WRITE(1, "failed\n");
/* Eeek. Wave bye bye */
up(&f->sem);
jffs3_complete_reservation(c);
@@ -463,7 +466,7 @@
if (ret) {
/* Eep. */
- D1(printk(KERN_DEBUG "jffs3_reserve_space() for dirent failed\n"));
+ DBG_WRITE(1, "jffs3_reserve_space() for dirent failed\n");
return ret;
}
@@ -577,8 +580,8 @@
!(*prev)->name[namelen]) {
struct jffs3_full_dirent *this = *prev;
- D1(printk(KERN_DEBUG "Marking old dirent node (ino #%u) @%08x obsolete\n",
- this->ino, ref_offset(this->raw)));
+ DBG_WRITE(1, "Marking old dirent node (ino #%u) @%08x obsolete\n",
+ this->ino, ref_offset(this->raw));
*prev = this->next;
jffs3_mark_node_obsolete(c, (this->raw));
@@ -604,10 +607,11 @@
dead_f->dents = fd->next;
if (fd->ino) {
- printk(KERN_WARNING "Deleting inode #%u with active dentry \"%s\"->ino #%u\n",
+ WARNING_MSG("Deleting inode #%u with active dentry \"%s\"->ino #%u\n",
dead_f->inocache->ino, fd->name, fd->ino);
} else {
- D1(printk(KERN_DEBUG "Removing deletion dirent for \"%s\" from dir ino #%u\n", fd->name, dead_f->inocache->ino));
+ DBG_WRITE(1, "Removing deletion dirent for \"%s\" from dir ino #%u\n",
+ fd->name, dead_f->inocache->ino);
}
jffs3_mark_node_obsolete(c, fd->raw);
jffs3_free_full_dirent(fd);
More information about the linux-mtd-cvs
mailing list