Commit 733802d9 authored by Artem B. Bityutskiy's avatar Artem B. Bityutskiy Committed by Thomas Gleixner

[JFFS2] Debug code simplification, update TODO

Simplify the debugging code further.
Update the TODO list
Signed-off-by: default avatarArtem B. Bityutskiy <dedekind@infradead.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent b523b3ba
$Id: TODO,v 1.10 2002/09/09 16:31:21 dwmw2 Exp $
$Id: TODO,v 1.18 2005/09/22 11:24:56 dedekind Exp $
- support asynchronous operation -- add a per-fs 'reserved_space' count,
let each outstanding write reserve the _maximum_ amount of physical
space it could take. Let GC flush the outstanding writes because the
reservations will necessarily be pessimistic. With this we could even
do shared writable mmap, if we can have a fs hook for do_wp_page() to
make the reservation.
- disable compression in commit_write()?
- fine-tune the allocation / GC thresholds
- chattr support - turning on/off and tuning compression per-inode
......@@ -11,26 +17,15 @@ $Id: TODO,v 1.10 2002/09/09 16:31:21 dwmw2 Exp $
- test, test, test
- NAND flash support:
- flush_wbuf using GC to fill it, don't just pad.
- Deal with write errors. Data don't get lost - we just have to write
the affected node(s) out again somewhere else.
- make fsync flush only if actually required
- make sys_sync() work.
- reboot notifier
- timed flush of old wbuf
- fix magical second arg of jffs2_flush_wbuf(). Split into two or more functions instead.
- almost done :)
- use bad block check instead of the hardwired byte check
- Optimisations:
- Stop GC from decompressing and immediately recompressing nodes which could
just be copied intact. (We now keep track of REF_PRISTINE flag. Easy now.)
- Furthermore, in the case where it could be copied intact we don't even need
to call iget() for it -- if we use (raw_node_raw->flash_offset & 2) as a flag
to show a node can be copied intact and it's _not_ in icache, we could just do
it, fix up the next_in_ino list and move on. We would need a way to find out
_whether_ it's in icache though -- if it's in icache we also need to do the
fragment lists, etc. P'raps a flag or pointer in the jffs2_inode_cache could
help. (We have half of this now.)
- Split writes so they go to two separate blocks rather than just c->nextblock.
By writing _new_ nodes to one block, and garbage-collected REF_PRISTINE
nodes to a different one, we can separate clean nodes from those which
are likely to become dirty, and end up with blocks which are each far
closer to 100% or 0% clean, hence speeding up later GC progress dramatically.
- Stop keeping name in-core with struct jffs2_full_dirent. If we keep the hash in
the full dirent, we only need to go to the flash in lookup() when we think we've
got a match, and in readdir().
......@@ -38,3 +33,8 @@ $Id: TODO,v 1.10 2002/09/09 16:31:21 dwmw2 Exp $
- Remove totlen from jffs2_raw_node_ref? Need to have totlen passed into
jffs2_mark_node_obsolete(). Can all callers work it out?
- Remove size from jffs2_raw_node_frag.
dedekind:
1. __jffs2_flush_wbuf() has a strange 'pad' parameter. Eliminate.
2. get_sb()->build_fs()->scan() path... Why get_sb() removes scan()'s crap in
case of failure? scan() does not clean everything. Fix.
This diff is collapsed.
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: debug.c,v 1.10 2005/09/14 16:57:32 dedekind Exp $
* $Id: debug.c,v 1.11 2005/09/21 13:28:35 dedekind Exp $
*
*/
#include <linux/kernel.h>
......@@ -15,6 +15,7 @@
#include <linux/pagemap.h>
#include <linux/crc32.h>
#include <linux/jffs2.h>
#include <linux/mtd/mtd.h>
#include "nodelist.h"
#include "debug.h"
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: debug.h,v 1.16 2005/09/14 16:57:32 dedekind Exp $
* $Id: debug.h,v 1.18 2005/09/21 10:26:26 dedekind Exp $
*
*/
#ifndef _JFFS2_DEBUG_H_
......@@ -23,16 +23,23 @@
/* Enable "paranoia" checks and dumps */
#define JFFS2_DBG_PARANOIA_CHECKS
#define JFFS2_DBG_DUMPS
/*
* By defining/undefining the below macros one may select debugging messages
* fro specific JFFS2 subsystems.
*/
#define JFFS2_DBG_READINODE_MESSAGES
#define JFFS2_DBG_FRAGTREE_MESSAGES
#define JFFS2_DBG_DENTLIST_MESSAGES
#define JFFS2_DBG_NODEREF_MESSAGES
#define JFFS2_DBG_INOCACHE_MESSAGES
#define JFFS2_DBG_SUMMARY_MESSAGES
#define JFFS2_DBG_FSBUILD_MESSAGES
#endif
#if CONFIG_JFFS2_FS_DEBUG == 2
#define JFFS2_DBG_FRAGTREE2_MESSAGES
#define JFFS2_DBG_MEMALLOC_MESSAGES
#endif
/* Sanity checks are supposed to be light-weight and enabled by default */
......@@ -40,7 +47,7 @@
/*
* Dx() are mainly used for debugging messages, they must go away and be
* superseded by nicer JFFS2_DBG_XXX() macros...
* superseded by nicer dbg_xxx() macros...
*/
#if CONFIG_JFFS2_FS_DEBUG > 0
#define D1(x) x
......@@ -105,56 +112,63 @@
*/
/* Read inode debugging messages */
#ifdef JFFS2_DBG_READINODE_MESSAGES
#define JFFS2_DBG_READINODE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#define dbg_readinode(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
#define JFFS2_DBG_READINODE(fmt, ...)
#define dbg_readinode(fmt, ...)
#endif
/* Fragtree build debugging messages */
#ifdef JFFS2_DBG_FRAGTREE_MESSAGES
#define JFFS2_DBG_FRAGTREE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#define dbg_fragtree(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
#define JFFS2_DBG_FRAGTREE(fmt, ...)
#define dbg_fragtree(fmt, ...)
#endif
#ifdef JFFS2_DBG_FRAGTREE2_MESSAGES
#define JFFS2_DBG_FRAGTREE2(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#define dbg_fragtree2(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
#define JFFS2_DBG_FRAGTREE2(fmt, ...)
#define dbg_fragtree2(fmt, ...)
#endif
/* Directory entry list manilulation debugging messages */
#ifdef JFFS2_DBG_DENTLIST_MESSAGES
#define JFFS2_DBG_DENTLIST(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#define dbg_dentlist(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
#define JFFS2_DBG_DENTLIST(fmt, ...)
#define dbg_dentlist(fmt, ...)
#endif
/* Print the messages about manipulating node_refs */
#ifdef JFFS2_DBG_NODEREF_MESSAGES
#define JFFS2_DBG_NODEREF(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#define dbg_noderef(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
#define JFFS2_DBG_NODEREF(fmt, ...)
#define dbg_noderef(fmt, ...)
#endif
/* Manipulations with the list of inodes (JFFS2 inocache) */
#ifdef JFFS2_DBG_INOCACHE_MESSAGES
#define JFFS2_DBG_INOCACHE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#define dbg_inocache(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
#define JFFS2_DBG_INOCACHE(fmt, ...)
#define dbg_inocache(fmt, ...)
#endif
/* Summary debugging messages */
#ifdef JFFS2_DBG_SUMMARY_MESSAGES
#define JFFS2_DBG_SUMMARY(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#define dbg_summary(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
#define dbg_summary(fmt, ...)
#endif
/* File system build messages */
#ifdef JFFS2_DBG_FSBUILD_MESSAGES
#define dbg_fsbuild(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
#define JFFS2_DBG_SUMMARY(fmt, ...)
#define dbg_fsbuild(fmt, ...)
#endif
/* Watch the object allocations */
#ifdef JFFS2_DBG_MEMALLOC_MESSAGES
#define JFFS2_DBG_MEMALLOC(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#define dbg_memalloc(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__)
#else
#define JFFS2_DBG_MEMALLOC(fmt, ...)
#define dbg_memalloc(fmt, ...)
#endif
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: erase.c,v 1.83 2005/07/22 10:32:08 dedekind Exp $
* $Id: erase.c,v 1.85 2005/09/20 14:53:15 dedekind Exp $
*
*/
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: malloc.c,v 1.29 2005/07/27 14:16:53 dedekind Exp $
* $Id: malloc.c,v 1.30 2005/09/20 14:27:34 dedekind Exp $
*
*/
......@@ -97,13 +97,13 @@ struct jffs2_full_dirent *jffs2_alloc_full_dirent(int namesize)
{
struct jffs2_full_dirent *ret;
ret = kmalloc(sizeof(struct jffs2_full_dirent) + namesize, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
dbg_memalloc("%p\n", ret);
return ret;
}
void jffs2_free_full_dirent(struct jffs2_full_dirent *x)
{
JFFS2_DBG_MEMALLOC("%p\n", x);
dbg_memalloc("%p\n", x);
kfree(x);
}
......@@ -111,13 +111,13 @@ struct jffs2_full_dnode *jffs2_alloc_full_dnode(void)
{
struct jffs2_full_dnode *ret;
ret = kmem_cache_alloc(full_dnode_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
dbg_memalloc("%p\n", ret);
return ret;
}
void jffs2_free_full_dnode(struct jffs2_full_dnode *x)
{
JFFS2_DBG_MEMALLOC("%p\n", x);
dbg_memalloc("%p\n", x);
kmem_cache_free(full_dnode_slab, x);
}
......@@ -125,13 +125,13 @@ struct jffs2_raw_dirent *jffs2_alloc_raw_dirent(void)
{
struct jffs2_raw_dirent *ret;
ret = kmem_cache_alloc(raw_dirent_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
dbg_memalloc("%p\n", ret);
return ret;
}
void jffs2_free_raw_dirent(struct jffs2_raw_dirent *x)
{
JFFS2_DBG_MEMALLOC("%p\n", x);
dbg_memalloc("%p\n", x);
kmem_cache_free(raw_dirent_slab, x);
}
......@@ -139,13 +139,13 @@ struct jffs2_raw_inode *jffs2_alloc_raw_inode(void)
{
struct jffs2_raw_inode *ret;
ret = kmem_cache_alloc(raw_inode_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
dbg_memalloc("%p\n", ret);
return ret;
}
void jffs2_free_raw_inode(struct jffs2_raw_inode *x)
{
JFFS2_DBG_MEMALLOC("%p\n", x);
dbg_memalloc("%p\n", x);
kmem_cache_free(raw_inode_slab, x);
}
......@@ -153,14 +153,14 @@ struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void)
{
struct jffs2_tmp_dnode_info *ret;
ret = kmem_cache_alloc(tmp_dnode_info_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n",
dbg_memalloc("%p\n",
ret);
return ret;
}
void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *x)
{
JFFS2_DBG_MEMALLOC("%p\n", x);
dbg_memalloc("%p\n", x);
kmem_cache_free(tmp_dnode_info_slab, x);
}
......@@ -168,13 +168,13 @@ struct jffs2_raw_node_ref *jffs2_alloc_raw_node_ref(void)
{
struct jffs2_raw_node_ref *ret;
ret = kmem_cache_alloc(raw_node_ref_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
dbg_memalloc("%p\n", ret);
return ret;
}
void jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *x)
{
JFFS2_DBG_MEMALLOC("%p\n", x);
dbg_memalloc("%p\n", x);
kmem_cache_free(raw_node_ref_slab, x);
}
......@@ -182,13 +182,13 @@ struct jffs2_node_frag *jffs2_alloc_node_frag(void)
{
struct jffs2_node_frag *ret;
ret = kmem_cache_alloc(node_frag_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
dbg_memalloc("%p\n", ret);
return ret;
}
void jffs2_free_node_frag(struct jffs2_node_frag *x)
{
JFFS2_DBG_MEMALLOC("%p\n", x);
dbg_memalloc("%p\n", x);
kmem_cache_free(node_frag_slab, x);
}
......@@ -196,12 +196,12 @@ struct jffs2_inode_cache *jffs2_alloc_inode_cache(void)
{
struct jffs2_inode_cache *ret;
ret = kmem_cache_alloc(inode_cache_slab, GFP_KERNEL);
JFFS2_DBG_MEMALLOC("%p\n", ret);
dbg_memalloc("%p\n", ret);
return ret;
}
void jffs2_free_inode_cache(struct jffs2_inode_cache *x)
{
JFFS2_DBG_MEMALLOC("%p\n", x);
dbg_memalloc("%p\n", x);
kmem_cache_free(inode_cache_slab, x);
}
This diff is collapsed.
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: nodemgmt.c,v 1.126 2005/09/16 12:58:17 havasi Exp $
* $Id: nodemgmt.c,v 1.127 2005/09/20 15:49:12 dedekind Exp $
*
*/
......@@ -273,7 +273,7 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uin
if (jeb) {
reserved_size = PAD(sumsize + c->summary->sum_size + JFFS2_SUMMARY_FRAME_SIZE);
JFFS2_DBG_SUMMARY("minsize=%d , jeb->free=%d ,"
dbg_summary("minsize=%d , jeb->free=%d ,"
"summary->size=%d , sumsize=%d\n",
minsize, jeb->free_size,
c->summary->sum_size, sumsize);
......@@ -291,7 +291,7 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uin
}
/* Writing out the collected summary information */
JFFS2_DBG_SUMMARY("generating summary for 0x%08x.\n", jeb->offset);
dbg_summary("generating summary for 0x%08x.\n", jeb->offset);
ret = jffs2_sum_write_sumnode(c);
if (ret)
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: os-linux.h,v 1.61 2005/09/07 08:34:54 havasi Exp $
* $Id: os-linux.h,v 1.63 2005/09/21 11:55:21 dedekind Exp $
*
*/
......@@ -80,8 +80,8 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
#define jffs2_flash_write(c, ofs, len, retlen, buf) jffs2_flash_direct_write(c, ofs, len, retlen, buf)
#define jffs2_flash_read(c, ofs, len, retlen, buf) ((c)->mtd->read((c)->mtd, ofs, len, retlen, buf))
#define jffs2_flush_wbuf_pad(c) ({ (void)(c), 0; })
#define jffs2_flush_wbuf_gc(c, i) ({ (void)(c), (void) i, 0; })
#define jffs2_flush_wbuf_pad(c) ({ do{} while(0); (void)(c), 0; })
#define jffs2_flush_wbuf_gc(c, i) ({ do{} while(0); (void)(c), (void) i, 0; })
#define jffs2_write_nand_badblock(c,jeb,bad_offset) (1)
#define jffs2_nand_flash_setup(c) (0)
#define jffs2_nand_flash_cleanup(c) do {} while(0)
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: readinode.c,v 1.141 2005/08/17 14:57:39 dedekind Exp $
* $Id: readinode.c,v 1.142 2005/09/20 14:27:34 dedekind Exp $
*
*/
......@@ -97,7 +97,7 @@ static struct jffs2_raw_node_ref *jffs2_first_valid_node(struct jffs2_raw_node_r
while (ref && ref->next_in_ino) {
if (!ref_obsolete(ref))
return ref;
JFFS2_DBG_NODEREF("node at 0x%08x is obsoleted. Ignoring.\n", ref_offset(ref));
dbg_noderef("node at 0x%08x is obsoleted. Ignoring.\n", ref_offset(ref));
ref = ref->next_in_ino;
}
return NULL;
......@@ -274,7 +274,7 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
len = min_t(uint32_t, rdlen - sizeof(*rd), csize);
tn->partial_crc = crc32(0, buf, len);
JFFS2_DBG_READINODE("Calculates CRC (%#08x) for %d bytes, csize %d\n", tn->partial_crc, len, csize);
dbg_readinode("Calculates CRC (%#08x) for %d bytes, csize %d\n", tn->partial_crc, len, csize);
/* If we actually calculated the whole data CRC
* and it is wrong, drop the node. */
......@@ -293,7 +293,7 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
*/
struct jffs2_eraseblock *jeb;
JFFS2_DBG_READINODE("the node has no data.\n");
dbg_readinode("the node has no data.\n");
jeb = &c->blocks[ref->flash_offset / c->sector_size];
len = ref_totlen(c, jeb, ref);
......@@ -327,7 +327,7 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
else // normal case...
tn->fn->size = je32_to_cpu(rd->dsize);
JFFS2_DBG_READINODE("dnode @%08x: ver %u, offset %#04x, dsize %#04x, csize %#04x\n",
dbg_readinode("dnode @%08x: ver %u, offset %#04x, dsize %#04x, csize %#04x\n",
ref_offset(ref), je32_to_cpu(rd->version), je32_to_cpu(rd->offset), je32_to_cpu(rd->dsize), csize);
jffs2_add_tn_to_tree(tn, tnp);
......@@ -424,7 +424,7 @@ static int read_more(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref,
len = right_size - *rdlen;
}
JFFS2_DBG_READINODE("read more %d bytes\n", len);
dbg_readinode("read more %d bytes\n", len);
err = jffs2_flash_read(c, offs, len, &retlen, bufstart);
if (err) {
......@@ -461,7 +461,7 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
*mctime_ver = 0;
JFFS2_DBG_READINODE("ino #%u\n", f->inocache->ino);
dbg_readinode("ino #%u\n", f->inocache->ino);
if (jffs2_is_writebuffered(c)) {
/*
......@@ -531,7 +531,7 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
len = JFFS2_MIN_NODE_HEADER;
}
JFFS2_DBG_READINODE("read %d bytes at %#08x(%d).\n", len, ref_offset(ref), ref_flags(ref));
dbg_readinode("read %d bytes at %#08x(%d).\n", len, ref_offset(ref), ref_flags(ref));
/* FIXME: point() */
err = jffs2_flash_read(c, ref_offset(ref), len,
......@@ -614,7 +614,7 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
*fdp = ret_fd;
kfree(buf);
JFFS2_DBG_READINODE("nodes of inode #%u were read, the highest version is %u, latest_mctime %u, mctime_ver %u.\n",
dbg_readinode("nodes of inode #%u were read, the highest version is %u, latest_mctime %u, mctime_ver %u.\n",
f->inocache->ino, *highest_version, *latest_mctime, *mctime_ver);
return 0;
......@@ -639,7 +639,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
size_t retlen;
int ret;
JFFS2_DBG_READINODE("ino #%u nlink is %d\n", f->inocache->ino, f->inocache->nlink);
dbg_readinode("ino #%u nlink is %d\n", f->inocache->ino, f->inocache->nlink);
/* Grab all nodes relevant to this ino */
ret = jffs2_get_inode_nodes(c, f, &tn_list, &fd_list, &f->highest_version, &latest_mctime, &mctime_ver);
......@@ -659,7 +659,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
tn = rb_entry(rb, struct jffs2_tmp_dnode_info, rb);
fn = tn->fn;
ret = 1;
JFFS2_DBG_READINODE("consider node ver %u, phys offset "
dbg_readinode("consider node ver %u, phys offset "
"%#08x(%d), range %u-%u.\n", tn->version,
ref_offset(fn->raw), ref_flags(fn->raw),
fn->ofs, fn->ofs + fn->size);
......@@ -703,7 +703,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
jffs2_free_tmp_dnode_info(tn);
if (ret) {
JFFS2_DBG_READINODE("delete dnode %u-%u.\n",
dbg_readinode("delete dnode %u-%u.\n",
fn->ofs, fn->ofs + fn->size);
jffs2_free_full_dnode(fn);
}
......@@ -803,7 +803,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
}
f->target[je32_to_cpu(latest_node->csize)] = '\0';
JFFS2_DBG_READINODE("symlink's target '%s' cached\n", f->target);
dbg_readinode("symlink's target '%s' cached\n", f->target);
}
/* fall through... */
......@@ -851,7 +851,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
int jffs2_do_read_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
uint32_t ino, struct jffs2_raw_inode *latest_node)
{
JFFS2_DBG_READINODE("read inode #%u\n", ino);
dbg_readinode("read inode #%u\n", ino);
retry_inocache:
spin_lock(&c->inocache_lock);
......@@ -870,7 +870,7 @@ int jffs2_do_read_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
/* If it's in either of these states, we need
to wait for whoever's got it to finish and
put it back. */
JFFS2_DBG_READINODE("waiting for ino #%u in state %d\n", ino, f->inocache->state);
dbg_readinode("waiting for ino #%u in state %d\n", ino, f->inocache->state);
sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock);
goto retry_inocache;
......@@ -897,7 +897,7 @@ int jffs2_do_read_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
JFFS2_ERROR("cannot allocate inocache for root inode\n");
return -ENOMEM;
}
JFFS2_DBG_READINODE("creating inocache for root inode\n");
dbg_readinode("creating inocache for root inode\n");
memset(f->inocache, 0, sizeof(struct jffs2_inode_cache));
f->inocache->ino = f->inocache->nlink = 1;
f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache;
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: scan.c,v 1.122 2005/09/07 08:34:54 havasi Exp $
* $Id: scan.c,v 1.124 2005/09/21 13:05:22 dedekind Exp $
*
*/
#include <linux/kernel.h>
......@@ -429,7 +429,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
noise = 10;
JFFS2_DBG_SUMMARY("no summary found in jeb 0x%08x. Apply original scan.\n",jeb->offset);
dbg_summary("no summary found in jeb 0x%08x. Apply original scan.\n",jeb->offset);
scan_more:
while(ofs < jeb->offset + c->sector_size) {
......@@ -684,7 +684,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
if (jffs2_sum_active()) {
if (PAD(s->sum_size + JFFS2_SUMMARY_FRAME_SIZE) > jeb->free_size) {
JFFS2_DBG_SUMMARY("There is not enough space for "
dbg_summary("There is not enough space for "
"summary information, disabling for this jeb!\n");
jffs2_sum_disable_collecting(s);
}
......@@ -920,76 +920,34 @@ void jffs2_rotate_lists(struct jffs2_sb_info *c)
x = count_list(&c->clean_list);
if (x) {
rotateby = pseudo_random % x;
D1(printk(KERN_DEBUG "Rotating clean_list by %d\n", rotateby));
rotate_list((&c->clean_list), rotateby);
D1(printk(KERN_DEBUG "Erase block at front of clean_list is at %08x\n",
list_entry(c->clean_list.next, struct jffs2_eraseblock, list)->offset));
} else {
D1(printk(KERN_DEBUG "Not rotating empty clean_list\n"));
}
x = count_list(&c->very_dirty_list);
if (x) {
rotateby = pseudo_random % x;
D1(printk(KERN_DEBUG "Rotating very_dirty_list by %d\n", rotateby));
rotate_list((&c->very_dirty_list), rotateby);
D1(printk(KERN_DEBUG "Erase block at front of very_dirty_list is at %08x\n",
list_entry(c->very_dirty_list.next, struct jffs2_eraseblock, list)->offset));
} else {
D1(printk(KERN_DEBUG "Not rotating empty very_dirty_list\n"));
}
x = count_list(&c->dirty_list);
if (x) {
rotateby = pseudo_random % x;
D1(printk(KERN_DEBUG "Rotating dirty_list by %d\n", rotateby));
rotate_list((&c->dirty_list), rotateby);
D1(printk(KERN_DEBUG "Erase block at front of dirty_list is at %08x\n",
list_entry(c->dirty_list.next, struct jffs2_eraseblock, list)->offset));
} else {
D1(printk(KERN_DEBUG "Not rotating empty dirty_list\n"));
}
x = count_list(&c->erasable_list);
if (x) {
rotateby = pseudo_random % x;
D1(printk(KERN_DEBUG "Rotating erasable_list by %d\n", rotateby));
rotate_list((&c->erasable_list), rotateby);
D1(printk(KERN_DEBUG "Erase block at front of erasable_list is at %08x\n",
list_entry(c->erasable_list.next, struct jffs2_eraseblock, list)->offset));
} else {
D1(printk(KERN_DEBUG "Not rotating empty erasable_list\n"));
}
if (c->nr_erasing_blocks) {
rotateby = pseudo_random % c->nr_erasing_blocks;
D1(printk(KERN_DEBUG "Rotating erase_pending_list by %d\n", rotateby));
rotate_list((&c->erase_pending_list), rotateby);
D1(printk(KERN_DEBUG "Erase block at front of erase_pending_list is at %08x\n",
list_entry(c->erase_pending_list.next, struct jffs2_eraseblock, list)->offset));
} else {
D1(printk(KERN_DEBUG "Not rotating empty erase_pending_list\n"));
}
if (c->nr_free_blocks) {
rotateby = pseudo_random % c->nr_free_blocks;
D1(printk(KERN_DEBUG "Rotating free_list by %d\n", rotateby));
rotate_list((&c->free_list), rotateby);
D1(printk(KERN_DEBUG "Erase block at front of free_list is at %08x\n",
list_entry(c->free_list.next, struct jffs2_eraseblock, list)->offset));
} else {
D1(printk(KERN_DEBUG "Not rotating empty free_list\n"));
}
}
......@@ -8,7 +8,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: summary.c,v 1.1 2005/09/07 08:34:54 havasi Exp $
* $Id: summary.c,v 1.3 2005/09/21 14:43:07 dedekind Exp $
*
*/
......@@ -38,17 +38,18 @@ int jffs2_sum_init(struct jffs2_sb_info *c)
if (!c->summary->sum_buf) {
JFFS2_WARNING("Can't allocate buffer for writing out summary information!\n");
kfree(c->summary);
return -ENOMEM;
}
JFFS2_DBG_SUMMARY("returned succesfully\n");
dbg_summary("returned succesfully\n");
return 0;
}
void jffs2_sum_exit(struct jffs2_sb_info *c)
{
JFFS2_DBG_SUMMARY("called\n");
dbg_summary("called\n");
jffs2_sum_disable_collecting(c->summary);
......@@ -71,13 +72,13 @@ static int jffs2_sum_add_mem(struct jffs2_summary *s, union jffs2_sum_mem *item)
case JFFS2_NODETYPE_INODE:
s->sum_size += JFFS2_SUMMARY_INODE_SIZE;
s->sum_num++;
JFFS2_DBG_SUMMARY("inode (%u) added to summary\n",
dbg_summary("inode (%u) added to summary\n",
je32_to_cpu(item->i.inode));
break;
case JFFS2_NODETYPE_DIRENT:
s->sum_size += JFFS2_SUMMARY_DIRENT_SIZE(item->d.nsize);
s->sum_num++;
JFFS2_DBG_SUMMARY("dirent (%u) added to summary\n",
dbg_summary("dirent (%u) added to summary\n",
je32_to_cpu(item->d.ino));
break;
default:
......@@ -93,7 +94,7 @@ static int jffs2_sum_add_mem(struct jffs2_summary *s, union jffs2_sum_mem *item)
int jffs2_sum_add_padding_mem(struct jffs2_summary *s, uint32_t size)
{
JFFS2_DBG_SUMMARY("called with %u\n", size);
dbg_summary("called with %u\n", size);
s->sum_padded += size;
return 0;
}
......@@ -147,7 +148,7 @@ static void jffs2_sum_clean_collected(struct jffs2_summary *s)
union jffs2_sum_mem *temp;
if (!s->sum_list_head) {
JFFS2_DBG_SUMMARY("already empty\n");
dbg_summary("already empty\n");
}
while (s->sum_list_head) {
temp = s->sum_list_head;
......@@ -161,14 +162,14 @@ static void jffs2_sum_clean_collected(struct jffs2_summary *s)
void jffs2_sum_reset_collected(struct jffs2_summary *s)
{
JFFS2_DBG_SUMMARY("called\n");
dbg_summary("called\n");
jffs2_sum_clean_collected(s);
s->sum_size = 0;
}
void jffs2_sum_disable_collecting(struct jffs2_summary *s)
{
JFFS2_DBG_SUMMARY("called\n");
dbg_summary("called\n");
jffs2_sum_clean_collected(s);
s->sum_size = JFFS2_SUMMARY_NOSUM_SIZE;
}
......@@ -182,7 +183,7 @@ int jffs2_sum_is_disabled(struct jffs2_summary *s)
void jffs2_sum_move_collected(struct jffs2_sb_info *c, struct jffs2_summary *s)
{
JFFS2_DBG_SUMMARY("oldsize=0x%x oldnum=%u => newsize=0x%x newnum=%u\n",
dbg_summary("oldsize=0x%x oldnum=%u => newsize=0x%x newnum=%u\n",
c->summary->sum_size, c->summary->sum_num,
s->sum_size, s->sum_num);
......@@ -260,16 +261,16 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs,
}
case JFFS2_NODETYPE_PADDING:
JFFS2_DBG_SUMMARY("node PADDING\n");
dbg_summary("node PADDING\n");
c->summary->sum_padded += je32_to_cpu(node->u.totlen);
break;
case JFFS2_NODETYPE_CLEANMARKER:
JFFS2_DBG_SUMMARY("node CLEANMARKER\n");
dbg_summary("node CLEANMARKER\n");
break;
case JFFS2_NODETYPE_SUMMARY:
JFFS2_DBG_SUMMARY("node SUMMARY\n");
dbg_summary("node SUMMARY\n");
break;
default:
......@@ -302,7 +303,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
sp = summary->sum;
for (i=0; i<je32_to_cpu(summary->sum_num); i++) {
JFFS2_DBG_SUMMARY("processing summary index %d\n", i);
dbg_summary("processing summary index %d\n", i);
switch (je16_to_cpu(((struct jffs2_sum_unknown_flash *)sp)->nodetype)) {
case JFFS2_NODETYPE_INODE: {
......@@ -311,7 +312,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
ino = je32_to_cpu(spi->inode);
JFFS2_DBG_SUMMARY("Inode at 0x%08x\n",
dbg_summary("Inode at 0x%08x\n",
jeb->offset + je32_to_cpu(spi->offset));
raw = jffs2_alloc_raw_node_ref();
......@@ -353,7 +354,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
struct jffs2_sum_dirent_flash *spd;
spd = sp;
JFFS2_DBG_SUMMARY("Dirent at 0x%08x\n",
dbg_summary("Dirent at 0x%08x\n",
jeb->offset + je32_to_cpu(spd->offset));
fd = jffs2_alloc_full_dirent(spd->nsize+1);
......@@ -434,7 +435,7 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb
sumsize = c->sector_size - ofs;
ofs += jeb->offset;
JFFS2_DBG_SUMMARY("summary found for 0x%08x at 0x%08x (0x%x bytes)\n",
dbg_summary("summary found for 0x%08x at 0x%08x (0x%x bytes)\n",
jeb->offset, ofs, sumsize);
summary = kmalloc(sumsize, GFP_KERNEL);
......@@ -457,40 +458,40 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb
crc = crc32(0, &crcnode, sizeof(crcnode)-4);
if (je32_to_cpu(summary->hdr_crc) != crc) {
JFFS2_DBG_SUMMARY("Summary node header is corrupt (bad CRC or "
dbg_summary("Summary node header is corrupt (bad CRC or "
"no summary at all)\n");
goto crc_err;
}
if (je32_to_cpu(summary->totlen) != sumsize) {
JFFS2_DBG_SUMMARY("Summary node is corrupt (wrong erasesize?)\n");
dbg_summary("Summary node is corrupt (wrong erasesize?)\n");
goto crc_err;
}
crc = crc32(0, summary, sizeof(struct jffs2_summary_node)-8);
if (je32_to_cpu(summary->node_crc) != crc) {
JFFS2_DBG_SUMMARY("Summary node is corrupt (bad CRC)\n");
dbg_summary("Summary node is corrupt (bad CRC)\n");
goto crc_err;
}
crc = crc32(0, summary->sum, sumsize - sizeof(struct jffs2_summary_node));
if (je32_to_cpu(summary->sum_crc) != crc) {
JFFS2_DBG_SUMMARY("Summary node data is corrupt (bad CRC)\n");
dbg_summary("Summary node data is corrupt (bad CRC)\n");
goto crc_err;
}
if ( je32_to_cpu(summary->cln_mkr) ) {
JFFS2_DBG_SUMMARY("Summary : CLEANMARKER node \n");
dbg_summary("Summary : CLEANMARKER node \n");
if (je32_to_cpu(summary->cln_mkr) != c->cleanmarker_size) {
JFFS2_DBG_SUMMARY("CLEANMARKER node has totlen 0x%x != normal 0x%x\n",
dbg_summary("CLEANMARKER node has totlen 0x%x != normal 0x%x\n",
je32_to_cpu(summary->cln_mkr), c->cleanmarker_size);
UNCHECKED_SPACE(PAD(je32_to_cpu(summary->cln_mkr)));
} else if (jeb->first_node) {
JFFS2_DBG_SUMMARY("CLEANMARKER node not first node in block "
dbg_summary("CLEANMARKER node not first node in block "
"(0x%08x)\n", jeb->offset);
UNCHECKED_SPACE(PAD(je32_to_cpu(summary->cln_mkr)));
} else {
......@@ -644,7 +645,7 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock
vecs[1].iov_base = c->summary->sum_buf;
vecs[1].iov_len = datasize;
JFFS2_DBG_SUMMARY("JFFS2: writing out data to flash to pos : 0x%08x\n",
dbg_summary("JFFS2: writing out data to flash to pos : 0x%08x\n",
jeb->offset + c->sector_size - jeb->free_size);
spin_unlock(&c->erase_completion_lock);
......@@ -674,7 +675,7 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c)
int datasize, infosize, padsize, ret;
struct jffs2_eraseblock *jeb;
JFFS2_DBG_SUMMARY("called\n");
dbg_summary("called\n");
jeb = c->nextblock;
......
......@@ -9,7 +9,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: wbuf.c,v 1.98 2005/09/07 08:34:55 havasi Exp $
* $Id: wbuf.c,v 1.99 2005/09/21 16:11:04 dedekind Exp $
*
*/
......@@ -33,9 +33,6 @@ static unsigned char *brokenbuf;
/* max. erase failures before we mark a block bad */
#define MAX_ERASE_FAILURES 2
/* two seconds timeout for timed wbuf-flushing */
#define WBUF_FLUSH_TIMEOUT 2 * HZ
struct jffs2_inodirty {
uint32_t ino;
struct jffs2_inodirty *next;
......
/* $Id: jffs2_fs_sb.h,v 1.53 2005/09/07 08:34:56 havasi Exp $ */
/* $Id: jffs2_fs_sb.h,v 1.54 2005/09/21 13:37:34 dedekind Exp $ */
#ifndef _JFFS2_FS_SB
#define _JFFS2_FS_SB
......@@ -95,12 +95,13 @@ struct jffs2_sb_info {
to an obsoleted node. I don't like this. Alternatives welcomed. */
struct semaphore erase_free_sem;
uint32_t wbuf_pagesize; /* 0 for NOR and other flashes with no wbuf */
#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
/* Write-behind buffer for NAND flash */
unsigned char *wbuf;
uint32_t wbuf_ofs;
uint32_t wbuf_len;
uint32_t wbuf_pagesize;
struct jffs2_inodirty *wbuf_inodes;
struct rw_semaphore wbuf_sem; /* Protects the write buffer */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment