mtd/fs/jffs3 read.c,3.2,3.3 debug.h,1.7,1.8
Artem Bityuckiy
dedekind at infradead.org
Fri Dec 17 13:50:32 EST 2004
Update of /home/cvs/mtd/fs/jffs3
In directory phoenix.infradead.org:/tmp/cvs-serv16732
Modified Files:
read.c debug.h
Log Message:
Change node read output.
Index: read.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/read.c,v
retrieving revision 3.2
retrieving revision 3.3
diff -u -r3.2 -r3.3
--- read.c 13 Dec 2004 15:37:37 -0000 3.2
+++ read.c 17 Dec 2004 18:50:29 -0000 3.3
@@ -39,24 +39,24 @@
ret = jffs3_flash_read(c, ref_offset(fd->raw), sizeof(*ri), &readlen, (char *)ri);
if (ret) {
jffs3_free_raw_inode(ri);
- printk(KERN_WARNING "Error reading node from 0x%08x: %d\n", ref_offset(fd->raw), ret);
+ WARNING_MSG("Error reading node from 0x%08x: %d\n", ref_offset(fd->raw), ret);
return ret;
}
if (readlen != sizeof(*ri)) {
jffs3_free_raw_inode(ri);
- printk(KERN_WARNING "Short read from 0x%08x: wanted 0x%zx bytes, got 0x%zx\n",
- ref_offset(fd->raw), sizeof(*ri), readlen);
+ WARNING_MSG("Short read from 0x%08x: wanted 0x%zx bytes, got 0x%zx\n",
+ ref_offset(fd->raw), sizeof(*ri), readlen);
return -EIO;
}
crc = crc32(0, ri, sizeof(*ri)-8);
- D1(printk(KERN_DEBUG "Node read from %08x: node_crc %08x, calculated CRC %08x. dsize %x, csize %x, offset %x, buf %p\n",
- ref_offset(fd->raw), je32_to_cpu(ri->node_crc),
- crc, je32_to_cpu(ri->dsize), je32_to_cpu(ri->csize),
- je32_to_cpu(ri->offset), buf));
+ DBG_READ(1, "Node read from %08x: node_crc %08x, calculated CRC %08x. "
+ "dsize %x, csize %x, offset %x, buf %p\n",
+ ref_offset(fd->raw), je32_to_cpu(ri->node_crc), crc,
+ je32_to_cpu(ri->dsize), je32_to_cpu(ri->csize), je32_to_cpu(ri->offset), buf);
if (crc != je32_to_cpu(ri->node_crc)) {
- printk(KERN_WARNING "Node CRC %08x != calculated CRC %08x for node at %08x\n",
- je32_to_cpu(ri->node_crc), crc, ref_offset(fd->raw));
+ WARNING_MSG("Node CRC %08x != calculated CRC %08x for node at %08x\n",
+ je32_to_cpu(ri->node_crc), crc, ref_offset(fd->raw));
ret = -EIO;
goto out_ri;
}
@@ -69,8 +69,8 @@
}
D1(if(ofs + len > je32_to_cpu(ri->dsize)) {
- printk(KERN_WARNING "jffs3_read_dnode() asked for %d bytes at %d from %d-byte node\n",
- len, ofs, je32_to_cpu(ri->dsize));
+ WARNING_MSG("asked for %d bytes at %d from %d-byte node\n",
+ len, ofs, je32_to_cpu(ri->dsize));
ret = -EINVAL;
goto out_ri;
});
@@ -110,10 +110,9 @@
decomprbuf = readbuf;
}
- D2(printk(KERN_DEBUG "Read %d bytes to %p\n", je32_to_cpu(ri->csize),
- readbuf));
+ DBG_READ(2, "Read %d bytes to %p\n", je32_to_cpu(ri->csize), readbuf);
ret = jffs3_flash_read(c, (ref_offset(fd->raw)) + sizeof(*ri),
- je32_to_cpu(ri->csize), &readlen, readbuf);
+ je32_to_cpu(ri->csize), &readlen, readbuf);
if (!ret && readlen != je32_to_cpu(ri->csize))
ret = -EIO;
@@ -122,18 +121,18 @@
crc = crc32(0, readbuf, je32_to_cpu(ri->csize));
if (crc != je32_to_cpu(ri->data_crc)) {
- printk(KERN_WARNING "Data CRC %08x != calculated CRC %08x for node at %08x\n",
- je32_to_cpu(ri->data_crc), crc, ref_offset(fd->raw));
+ WARNING_MSG("Data CRC %08x != calculated CRC %08x for node at %08x\n",
+ je32_to_cpu(ri->data_crc), crc, ref_offset(fd->raw));
ret = -EIO;
goto out_decomprbuf;
}
- D2(printk(KERN_DEBUG "Data CRC matches calculated CRC %08x\n", crc));
+ DBG_READ(2, "Data CRC matches calculated CRC %08x\n", crc);
if (ri->compr != JFFS3_COMPR_NONE) {
- D2(printk(KERN_DEBUG "Decompress %d bytes from %p to %d bytes at %p\n",
- je32_to_cpu(ri->csize), readbuf, je32_to_cpu(ri->dsize), decomprbuf));
+ DBG_READ(2, "Decompress %d bytes from %p to %d bytes at %p\n",
+ je32_to_cpu(ri->csize), readbuf, je32_to_cpu(ri->dsize), decomprbuf);
ret = jffs3_decompress(c, f, ri->compr | (ri->usercompr << 8), readbuf, decomprbuf, je32_to_cpu(ri->csize), je32_to_cpu(ri->dsize));
if (ret) {
- printk(KERN_WARNING "Error: jffs3_decompress returned %d\n", ret);
+ WARNING_MSG("jffs3_decompress returned %d\n", ret);
goto out_decomprbuf;
}
}
@@ -160,8 +159,7 @@
struct jffs3_node_frag *frag;
int ret;
- D1(printk(KERN_DEBUG "jffs3_read_inode_range: ino #%u, range 0x%08x-0x%08x\n",
- f->inocache->ino, offset, offset+len));
+ DBG_READ(1, "ino #%u, range 0x%08x-0x%08x\n", f->inocache->ino, offset, offset+len);
frag = jffs3_lookup_node_frag(&f->fragtree, offset);
@@ -169,22 +167,24 @@
frags, we read it twice. Don't do that. */
/* Now we're pointing at the first frag which overlaps our page */
while(offset < end) {
- D2(printk(KERN_DEBUG "jffs3_read_inode_range: offset %d, end %d\n", offset, end));
+ DBG_READ(2, "Offset %d, end %d\n", offset, end);
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));
+ WARNING_MSG("Eep. Hole in ino #%u fraglist. frag->ofs = 0x%08x, offset = 0x%08x\n",
+ f->inocache->ino, frag->ofs, offset);
holesize = min(holesize, frag->ofs - offset);
D2(jffs3_dbg_print_frag_list(f));
}
- D1(printk(KERN_DEBUG "Filling non-frag hole from %d-%d\n", offset, offset+holesize));
+ DBG_READ(1, "Filling non-frag hole from %d-%d\n", offset, offset+holesize);
memset(buf, 0, holesize);
buf += holesize;
offset += holesize;
continue;
} 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));
+ DBG_READ(1, "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);
buf += holeend - offset;
offset = holeend;
@@ -196,20 +196,20 @@
fragofs = offset - frag->ofs;
readlen = min(frag->size - fragofs, end - offset);
- D1(printk(KERN_DEBUG "Reading %d-%d from node at 0x%08x (%d)\n",
- frag->ofs+fragofs, frag->ofs+fragofs+readlen,
- ref_offset(frag->node->raw), ref_flags(frag->node->raw)));
+ DBG_READ(1, "Reading %d-%d from node at 0x%08x (%d)\n",
+ frag->ofs+fragofs, frag->ofs+fragofs+readlen,
+ ref_offset(frag->node->raw), ref_flags(frag->node->raw));
ret = jffs3_read_dnode(c, f, frag->node, buf, fragofs + frag->ofs - frag->node->ofs, readlen);
- D2(printk(KERN_DEBUG "node read done\n"));
+ DBG_READ(2, "Node read done\n");
if (ret) {
- D1(printk(KERN_DEBUG"jffs3_read_inode_range error %d\n",ret));
+ DBG_READ(1, "jffs3_read_inode_range error %d\n",ret);
memset(buf, 0, readlen);
return ret;
}
buf += readlen;
offset += readlen;
frag = frag_next(frag);
- D2(printk(KERN_DEBUG "node read was OK. Looping\n"));
+ DBG_READ(2, "Node read was OK. Looping\n");
}
}
return 0;
@@ -224,7 +224,7 @@
down(&f->sem);
if (!f->metadata) {
- printk(KERN_NOTICE "No metadata for symlink inode #%u\n", f->inocache->ino);
+ WARNING_MSG("No metadata for symlink inode #%u\n", f->inocache->ino);
up(&f->sem);
return ERR_PTR(-EINVAL);
}
Index: debug.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/debug.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- debug.h 17 Dec 2004 18:04:57 -0000 1.7
+++ debug.h 17 Dec 2004 18:50:29 -0000 1.8
@@ -30,16 +30,18 @@
#define JFFS3_DBG_WBUF 4 /* Write buffer */
#define JFFS3_DBG_ERASE 5 /* Block erase */
#define JFFS3_DBG_SALLOC 6 /* Main data structures allocation */
+#define JFFS3_DBG_READ 7 /* JFFS2 nodes reading */
#if CONFIG_JFFS3_FS_DEBUG > 0
#define JFFS3_DBG_PARANOIA_CHECKS 1
-/* By default print the debugging messages from almosr all JFFS3 subsystems */
+/* By default print the debugging messages from almost all JFFS3 subsystems */
#define JFFS3_DBG_SUBSYS_OTHER_PRINT 1
#define JFFS3_DBG_SUBSYS_SCAN_PRINT 1
#define JFFS3_DBG_SUBSYS_GC_PRINT 1
#define JFFS3_DBG_SUBSYS_WBUF_PRINT 1
#define JFFS3_DBG_SUBSYS_ERASE_PRINT 1
#define JFFS3_DBG_SUBSYS_SALLOC_PRINT 0
+#define JFFS3_DBG_SUBSYS_READ_PRINT 1
#else
#define JFFS3_DBG_SUBSYS_OTHER_PRINT 0
#define JFFS3_DBG_SUBSYS_SCAN_PRINT 0
@@ -47,6 +49,7 @@
#define JFFS3_DBG_SUBSYS_WBUF_PRINT 0
#define JFFS3_DBG_SUBSYS_ERASE_PRINT 0
#define JFFS3_DBG_SUBSYS_SALLOC_PRINT 0
+#define JFFS3_DBG_SUBSYS_READ_PRINT 0
#endif
/*
@@ -59,6 +62,10 @@
char *subsysname = NULL; \
if ((debug_level) >= CONFIG_JFFS3_FS_DEBUG) { \
switch (subsystem) { \
+ case JFFS3_DBG_READ: \
+ if (JFFS3_DBG_SUBSYS_READ_PRINT) \
+ subsysname = "read"; \
+ break; \
case JFFS3_DBG_SALLOC: \
if (JFFS3_DBG_SUBSYS_SALLOC_PRINT) \
subsysname = "salloc"; \
@@ -112,7 +119,10 @@
JFFS3DBG_SUBSYSTEM(JFFS3_DBG_ERASE, debug_level, args)
#define DBG_SALLOC(debug_level, args...) \
- JFFS3DBG_SUBSYSTEM(JFFS3_DBG_ERASE, debug_level, args)
+ JFFS3DBG_SUBSYSTEM(JFFS3_DBG_SALLOC, debug_level, args)
+
+#define DBG_READ(debug_level, args...) \
+ JFFS3DBG_SUBSYSTEM(JFFS3_DBG_READ, debug_level, args)
#define ERROR_MSG(args...) \
do { \
More information about the linux-mtd-cvs
mailing list