jffs2: Use pr_fmt and remove jffs: from formats
[deliverable/linux.git] / fs / jffs2 / nodemgmt.c
index 694aa5b035057d5fa17ab8a475dfd41d0c9e681d..6784d1e7a7eb3440b7e7707a4659f79e8cec7433 100644 (file)
@@ -9,6 +9,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/mtd/mtd.h>
 #include <linux/compiler.h>
@@ -46,10 +48,10 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
        /* align it */
        minsize = PAD(minsize);
 
-       D1(printk(KERN_DEBUG "jffs2_reserve_space(): Requested 0x%x bytes\n", minsize));
+       jffs2_dbg(1, "%s(): Requested 0x%x bytes\n", __func__, minsize);
        mutex_lock(&c->alloc_sem);
 
-       D1(printk(KERN_DEBUG "jffs2_reserve_space(): alloc sem got\n"));
+       jffs2_dbg(1, "%s(): alloc sem got\n", __func__);
 
        spin_lock(&c->erase_completion_lock);
 
@@ -73,11 +75,13 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
                        dirty = c->dirty_size + c->erasing_size - c->nr_erasing_blocks * c->sector_size + c->unchecked_size;
                        if (dirty < c->nospc_dirty_size) {
                                if (prio == ALLOC_DELETION && c->nr_free_blocks + c->nr_erasing_blocks >= c->resv_blocks_deletion) {
-                                       D1(printk(KERN_NOTICE "jffs2_reserve_space(): Low on dirty space to GC, but it's a deletion. Allowing...\n"));
+                                       jffs2_dbg(1, "%s(): Low on dirty space to GC, but it's a deletion. Allowing...\n",
+                                                 __func__);
                                        break;
                                }
-                               D1(printk(KERN_DEBUG "dirty size 0x%08x + unchecked_size 0x%08x < nospc_dirty_size 0x%08x, returning -ENOSPC\n",
-                                         dirty, c->unchecked_size, c->sector_size));
+                               jffs2_dbg(1, "dirty size 0x%08x + unchecked_size 0x%08x < nospc_dirty_size 0x%08x, returning -ENOSPC\n",
+                                         dirty, c->unchecked_size,
+                                         c->sector_size);
 
                                spin_unlock(&c->erase_completion_lock);
                                mutex_unlock(&c->alloc_sem);
@@ -96,12 +100,13 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
                        avail = c->free_size + c->dirty_size + c->erasing_size + c->unchecked_size;
                        if ( (avail / c->sector_size) <= blocksneeded) {
                                if (prio == ALLOC_DELETION && c->nr_free_blocks + c->nr_erasing_blocks >= c->resv_blocks_deletion) {
-                                       D1(printk(KERN_NOTICE "jffs2_reserve_space(): Low on possibly available space, but it's a deletion. Allowing...\n"));
+                                       jffs2_dbg(1, "%s(): Low on possibly available space, but it's a deletion. Allowing...\n",
+                                                 __func__);
                                        break;
                                }
 
-                               D1(printk(KERN_DEBUG "max. available size 0x%08x  < blocksneeded * sector_size 0x%08x, returning -ENOSPC\n",
-                                         avail, blocksneeded * c->sector_size));
+                               jffs2_dbg(1, "max. available size 0x%08x  < blocksneeded * sector_size 0x%08x, returning -ENOSPC\n",
+                                         avail, blocksneeded * c->sector_size);
                                spin_unlock(&c->erase_completion_lock);
                                mutex_unlock(&c->alloc_sem);
                                return -ENOSPC;
@@ -109,9 +114,14 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
 
                        mutex_unlock(&c->alloc_sem);
 
-                       D1(printk(KERN_DEBUG "Triggering GC pass. nr_free_blocks %d, nr_erasing_blocks %d, free_size 0x%08x, dirty_size 0x%08x, wasted_size 0x%08x, used_size 0x%08x, erasing_size 0x%08x, bad_size 0x%08x (total 0x%08x of 0x%08x)\n",
-                                 c->nr_free_blocks, c->nr_erasing_blocks, c->free_size, c->dirty_size, c->wasted_size, c->used_size, c->erasing_size, c->bad_size,
-                                 c->free_size + c->dirty_size + c->wasted_size + c->used_size + c->erasing_size + c->bad_size, c->flash_size));
+                       jffs2_dbg(1, "Triggering GC pass. nr_free_blocks %d, nr_erasing_blocks %d, free_size 0x%08x, dirty_size 0x%08x, wasted_size 0x%08x, used_size 0x%08x, erasing_size 0x%08x, bad_size 0x%08x (total 0x%08x of 0x%08x)\n",
+                                 c->nr_free_blocks, c->nr_erasing_blocks,
+                                 c->free_size, c->dirty_size, c->wasted_size,
+                                 c->used_size, c->erasing_size, c->bad_size,
+                                 c->free_size + c->dirty_size +
+                                 c->wasted_size + c->used_size +
+                                 c->erasing_size + c->bad_size,
+                                 c->flash_size);
                        spin_unlock(&c->erase_completion_lock);
 
                        ret = jffs2_garbage_collect_pass(c);
@@ -124,7 +134,8 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
                                        DECLARE_WAITQUEUE(wait, current);
                                        set_current_state(TASK_UNINTERRUPTIBLE);
                                        add_wait_queue(&c->erase_wait, &wait);
-                                       D1(printk(KERN_DEBUG "%s waiting for erase to complete\n", __func__));
+                                       jffs2_dbg(1, "%s waiting for erase to complete\n",
+                                                 __func__);
                                        spin_unlock(&c->erase_completion_lock);
 
                                        schedule();
@@ -144,7 +155,7 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
 
                ret = jffs2_do_reserve_space(c, minsize, len, sumsize);
                if (ret) {
-                       D1(printk(KERN_DEBUG "jffs2_reserve_space: ret is %d\n", ret));
+                       jffs2_dbg(1, "%s(): ret is %d\n", __func__, ret);
                }
        }
        spin_unlock(&c->erase_completion_lock);
@@ -161,13 +172,14 @@ int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize,
        int ret = -EAGAIN;
        minsize = PAD(minsize);
 
-       D1(printk(KERN_DEBUG "jffs2_reserve_space_gc(): Requested 0x%x bytes\n", minsize));
+       jffs2_dbg(1, "%s(): Requested 0x%x bytes\n", __func__, minsize);
 
        spin_lock(&c->erase_completion_lock);
        while(ret == -EAGAIN) {
                ret = jffs2_do_reserve_space(c, minsize, len, sumsize);
                if (ret) {
-                       D1(printk(KERN_DEBUG "jffs2_reserve_space_gc: looping, ret is %d\n", ret));
+                       jffs2_dbg(1, "%s(): looping, ret is %d\n",
+                                 __func__, ret);
                }
        }
        spin_unlock(&c->erase_completion_lock);
@@ -184,8 +196,8 @@ static void jffs2_close_nextblock(struct jffs2_sb_info *c, struct jffs2_eraseblo
 {
 
        if (c->nextblock == NULL) {
-               D1(printk(KERN_DEBUG "jffs2_close_nextblock: Erase block at 0x%08x has already been placed in a list\n",
-                 jeb->offset));
+               jffs2_dbg(1, "%s(): Erase block at 0x%08x has already been placed in a list\n",
+                         __func__, jeb->offset);
                return;
        }
        /* Check, if we have a dirty block now, or if it was dirty already */
@@ -195,17 +207,20 @@ static void jffs2_close_nextblock(struct jffs2_sb_info *c, struct jffs2_eraseblo
                jeb->dirty_size += jeb->wasted_size;
                jeb->wasted_size = 0;
                if (VERYDIRTY(c, jeb->dirty_size)) {
-                       D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to very_dirty_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n",
-                         jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size));
+                       jffs2_dbg(1, "Adding full erase block at 0x%08x to very_dirty_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n",
+                                 jeb->offset, jeb->free_size, jeb->dirty_size,
+                                 jeb->used_size);
                        list_add_tail(&jeb->list, &c->very_dirty_list);
                } else {
-                       D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to dirty_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n",
-                         jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size));
+                       jffs2_dbg(1, "Adding full erase block at 0x%08x to dirty_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n",
+                                 jeb->offset, jeb->free_size, jeb->dirty_size,
+                                 jeb->used_size);
                        list_add_tail(&jeb->list, &c->dirty_list);
                }
        } else {
-               D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to clean_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n",
-                 jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size));
+               jffs2_dbg(1, "Adding full erase block at 0x%08x to clean_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n",
+                         jeb->offset, jeb->free_size, jeb->dirty_size,
+                         jeb->used_size);
                list_add_tail(&jeb->list, &c->clean_list);
        }
        c->nextblock = NULL;
@@ -230,13 +245,14 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
                        list_move_tail(&ejeb->list, &c->erase_pending_list);
                        c->nr_erasing_blocks++;
                        jffs2_garbage_collect_trigger(c);
-                       D1(printk(KERN_DEBUG "jffs2_find_nextblock: Triggering erase of erasable block at 0x%08x\n",
-                                 ejeb->offset));
+                       jffs2_dbg(1, "%s(): Triggering erase of erasable block at 0x%08x\n",
+                                 __func__, ejeb->offset);
                }
 
                if (!c->nr_erasing_blocks &&
                        !list_empty(&c->erasable_pending_wbuf_list)) {
-                       D1(printk(KERN_DEBUG "jffs2_find_nextblock: Flushing write buffer\n"));
+                       jffs2_dbg(1, "%s(): Flushing write buffer\n",
+                                 __func__);
                        /* c->nextblock is NULL, no update to c->nextblock allowed */
                        spin_unlock(&c->erase_completion_lock);
                        jffs2_flush_wbuf_pad(c);
@@ -248,9 +264,11 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
                if (!c->nr_erasing_blocks) {
                        /* Ouch. We're in GC, or we wouldn't have got here.
                           And there's no space left. At all. */
-                       printk(KERN_CRIT "Argh. No free space left for GC. nr_erasing_blocks is %d. nr_free_blocks is %d. (erasableempty: %s, erasingempty: %s, erasependingempty: %s)\n",
-                                  c->nr_erasing_blocks, c->nr_free_blocks, list_empty(&c->erasable_list)?"yes":"no",
-                                  list_empty(&c->erasing_list)?"yes":"no", list_empty(&c->erase_pending_list)?"yes":"no");
+                       pr_crit("Argh. No free space left for GC. nr_erasing_blocks is %d. nr_free_blocks is %d. (erasableempty: %s, erasingempty: %s, erasependingempty: %s)\n",
+                               c->nr_erasing_blocks, c->nr_free_blocks,
+                               list_empty(&c->erasable_list) ? "yes" : "no",
+                               list_empty(&c->erasing_list) ? "yes" : "no",
+                               list_empty(&c->erase_pending_list) ? "yes" : "no");
                        return -ENOSPC;
                }
 
@@ -278,7 +296,8 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
                c->wbuf_ofs = 0xffffffff;
 #endif
 
-       D1(printk(KERN_DEBUG "jffs2_find_nextblock(): new nextblock = 0x%08x\n", c->nextblock->offset));
+       jffs2_dbg(1, "%s(): new nextblock = 0x%08x\n",
+                 __func__, c->nextblock->offset);
 
        return 0;
 }
@@ -345,7 +364,8 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
 
                        if (jffs2_wbuf_dirty(c)) {
                                spin_unlock(&c->erase_completion_lock);
-                               D1(printk(KERN_DEBUG "jffs2_do_reserve_space: Flushing write buffer\n"));
+                               jffs2_dbg(1, "%s(): Flushing write buffer\n",
+                                         __func__);
                                jffs2_flush_wbuf_pad(c);
                                spin_lock(&c->erase_completion_lock);
                                jeb = c->nextblock;
@@ -387,7 +407,8 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
                jeb = c->nextblock;
 
                if (jeb->free_size != c->sector_size - c->cleanmarker_size) {
-                       printk(KERN_WARNING "Eep. Block 0x%08x taken from free_list had free_size of 0x%08x!!\n", jeb->offset, jeb->free_size);
+                       pr_warn("Eep. Block 0x%08x taken from free_list had free_size of 0x%08x!!\n",
+                               jeb->offset, jeb->free_size);
                        goto restart;
                }
        }
@@ -408,8 +429,9 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
                spin_lock(&c->erase_completion_lock);
        }
 
-       D1(printk(KERN_DEBUG "jffs2_do_reserve_space(): Giving 0x%x bytes at 0x%x\n",
-                 *len, jeb->offset + (c->sector_size - jeb->free_size)));
+       jffs2_dbg(1, "%s(): Giving 0x%x bytes at 0x%x\n",
+                 __func__,
+                 *len, jeb->offset + (c->sector_size - jeb->free_size));
        return 0;
 }
 
@@ -434,20 +456,22 @@ struct jffs2_raw_node_ref *jffs2_add_physical_node_ref(struct jffs2_sb_info *c,
 
        jeb = &c->blocks[ofs / c->sector_size];
 
-       D1(printk(KERN_DEBUG "jffs2_add_physical_node_ref(): Node at 0x%x(%d), size 0x%x\n",
-                 ofs & ~3, ofs & 3, len));
+       jffs2_dbg(1, "%s(): Node at 0x%x(%d), size 0x%x\n",
+                 __func__, ofs & ~3, ofs & 3, len);
 #if 1
        /* Allow non-obsolete nodes only to be added at the end of c->nextblock, 
           if c->nextblock is set. Note that wbuf.c will file obsolete nodes
           even after refiling c->nextblock */
        if ((c->nextblock || ((ofs & 3) != REF_OBSOLETE))
            && (jeb != c->nextblock || (ofs & ~3) != jeb->offset + (c->sector_size - jeb->free_size))) {
-               printk(KERN_WARNING "argh. node added in wrong place at 0x%08x(%d)\n", ofs & ~3, ofs & 3);
+               pr_warn("argh. node added in wrong place at 0x%08x(%d)\n",
+                       ofs & ~3, ofs & 3);
                if (c->nextblock)
-                       printk(KERN_WARNING "nextblock 0x%08x", c->nextblock->offset);
+                       pr_warn("nextblock 0x%08x", c->nextblock->offset);
                else
-                       printk(KERN_WARNING "No nextblock");
-               printk(", expected at %08x\n", jeb->offset + (c->sector_size - jeb->free_size));
+                       pr_warn("No nextblock");
+               pr_cont(", expected at %08x\n",
+                       jeb->offset + (c->sector_size - jeb->free_size));
                return ERR_PTR(-EINVAL);
        }
 #endif
@@ -457,8 +481,9 @@ struct jffs2_raw_node_ref *jffs2_add_physical_node_ref(struct jffs2_sb_info *c,
 
        if (!jeb->free_size && !jeb->dirty_size && !ISDIRTY(jeb->wasted_size)) {
                /* If it lives on the dirty_list, jffs2_reserve_space will put it there */
-               D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to clean_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n",
-                         jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size));
+               jffs2_dbg(1, "Adding full erase block at 0x%08x to clean_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n",
+                         jeb->offset, jeb->free_size, jeb->dirty_size,
+                         jeb->used_size);
                if (jffs2_wbuf_dirty(c)) {
                        /* Flush the last write in the block if it's outstanding */
                        spin_unlock(&c->erase_completion_lock);
@@ -480,7 +505,7 @@ struct jffs2_raw_node_ref *jffs2_add_physical_node_ref(struct jffs2_sb_info *c,
 
 void jffs2_complete_reservation(struct jffs2_sb_info *c)
 {
-       D1(printk(KERN_DEBUG "jffs2_complete_reservation()\n"));
+       jffs2_dbg(1, "jffs2_complete_reservation()\n");
        spin_lock(&c->erase_completion_lock);
        jffs2_garbage_collect_trigger(c);
        spin_unlock(&c->erase_completion_lock);
@@ -493,7 +518,7 @@ static inline int on_list(struct list_head *obj, struct list_head *head)
 
        list_for_each(this, head) {
                if (this == obj) {
-                       D1(printk("%p is on list at %p\n", obj, head));
+                       jffs2_dbg(1, "%p is on list at %p\n", obj, head);
                        return 1;
 
                }
@@ -511,16 +536,18 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
        uint32_t freed_len;
 
        if(unlikely(!ref)) {
-               printk(KERN_NOTICE "EEEEEK. jffs2_mark_node_obsolete called with NULL node\n");
+               pr_notice("EEEEEK. jffs2_mark_node_obsolete called with NULL node\n");
                return;
        }
        if (ref_obsolete(ref)) {
-               D1(printk(KERN_DEBUG "jffs2_mark_node_obsolete called with already obsolete node at 0x%08x\n", ref_offset(ref)));
+               jffs2_dbg(1, "%s(): called with already obsolete node at 0x%08x\n",
+                         __func__, ref_offset(ref));
                return;
        }
        blocknr = ref->flash_offset / c->sector_size;
        if (blocknr >= c->nr_blocks) {
-               printk(KERN_NOTICE "raw node at 0x%08x is off the end of device!\n", ref->flash_offset);
+               pr_notice("raw node at 0x%08x is off the end of device!\n",
+                         ref->flash_offset);
                BUG();
        }
        jeb = &c->blocks[blocknr];
@@ -542,27 +569,31 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
 
        if (ref_flags(ref) == REF_UNCHECKED) {
                D1(if (unlikely(jeb->unchecked_size < freed_len)) {
-                       printk(KERN_NOTICE "raw unchecked node of size 0x%08x freed from erase block %d at 0x%08x, but unchecked_size was already 0x%08x\n",
-                              freed_len, blocknr, ref->flash_offset, jeb->used_size);
+                               pr_notice("raw unchecked node of size 0x%08x freed from erase block %d at 0x%08x, but unchecked_size was already 0x%08x\n",
+                                         freed_len, blocknr,
+                                         ref->flash_offset, jeb->used_size);
                        BUG();
                })
-               D1(printk(KERN_DEBUG "Obsoleting previously unchecked node at 0x%08x of len %x: ", ref_offset(ref), freed_len));
+                       jffs2_dbg(1, "Obsoleting previously unchecked node at 0x%08x of len %x\n",
+                                 ref_offset(ref), freed_len);
                jeb->unchecked_size -= freed_len;
                c->unchecked_size -= freed_len;
        } else {
                D1(if (unlikely(jeb->used_size < freed_len)) {
-                       printk(KERN_NOTICE "raw node of size 0x%08x freed from erase block %d at 0x%08x, but used_size was already 0x%08x\n",
-                              freed_len, blocknr, ref->flash_offset, jeb->used_size);
+                               pr_notice("raw node of size 0x%08x freed from erase block %d at 0x%08x, but used_size was already 0x%08x\n",
+                                         freed_len, blocknr,
+                                         ref->flash_offset, jeb->used_size);
                        BUG();
                })
-               D1(printk(KERN_DEBUG "Obsoleting node at 0x%08x of len %#x: ", ref_offset(ref), freed_len));
+                       jffs2_dbg(1, "Obsoleting node at 0x%08x of len %#x: ",
+                                 ref_offset(ref), freed_len);
                jeb->used_size -= freed_len;
                c->used_size -= freed_len;
        }
 
        // Take care, that wasted size is taken into concern
        if ((jeb->dirty_size || ISDIRTY(jeb->wasted_size + freed_len)) && jeb != c->nextblock) {
-               D1(printk("Dirtying\n"));
+               jffs2_dbg(1, "Dirtying\n");
                addedsize = freed_len;
                jeb->dirty_size += freed_len;
                c->dirty_size += freed_len;
@@ -570,12 +601,12 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
                /* Convert wasted space to dirty, if not a bad block */
                if (jeb->wasted_size) {
                        if (on_list(&jeb->list, &c->bad_used_list)) {
-                               D1(printk(KERN_DEBUG "Leaving block at %08x on the bad_used_list\n",
-                                         jeb->offset));
+                               jffs2_dbg(1, "Leaving block at %08x on the bad_used_list\n",
+                                         jeb->offset);
                                addedsize = 0; /* To fool the refiling code later */
                        } else {
-                               D1(printk(KERN_DEBUG "Converting %d bytes of wasted space to dirty in block at %08x\n",
-                                         jeb->wasted_size, jeb->offset));
+                               jffs2_dbg(1, "Converting %d bytes of wasted space to dirty in block at %08x\n",
+                                         jeb->wasted_size, jeb->offset);
                                addedsize += jeb->wasted_size;
                                jeb->dirty_size += jeb->wasted_size;
                                c->dirty_size += jeb->wasted_size;
@@ -584,7 +615,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
                        }
                }
        } else {
-               D1(printk("Wasting\n"));
+               jffs2_dbg(1, "Wasting\n");
                addedsize = 0;
                jeb->wasted_size += freed_len;
                c->wasted_size += freed_len;
@@ -606,50 +637,57 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
        }
 
        if (jeb == c->nextblock) {
-               D2(printk(KERN_DEBUG "Not moving nextblock 0x%08x to dirty/erase_pending list\n", jeb->offset));
+               jffs2_dbg(2, "Not moving nextblock 0x%08x to dirty/erase_pending list\n",
+                         jeb->offset);
        } else if (!jeb->used_size && !jeb->unchecked_size) {
                if (jeb == c->gcblock) {
-                       D1(printk(KERN_DEBUG "gcblock at 0x%08x completely dirtied. Clearing gcblock...\n", jeb->offset));
+                       jffs2_dbg(1, "gcblock at 0x%08x completely dirtied. Clearing gcblock...\n",
+                                 jeb->offset);
                        c->gcblock = NULL;
                } else {
-                       D1(printk(KERN_DEBUG "Eraseblock at 0x%08x completely dirtied. Removing from (dirty?) list...\n", jeb->offset));
+                       jffs2_dbg(1, "Eraseblock at 0x%08x completely dirtied. Removing from (dirty?) list...\n",
+                                 jeb->offset);
                        list_del(&jeb->list);
                }
                if (jffs2_wbuf_dirty(c)) {
-                       D1(printk(KERN_DEBUG "...and adding to erasable_pending_wbuf_list\n"));
+                       jffs2_dbg(1, "...and adding to erasable_pending_wbuf_list\n");
                        list_add_tail(&jeb->list, &c->erasable_pending_wbuf_list);
                } else {
                        if (jiffies & 127) {
                                /* Most of the time, we just erase it immediately. Otherwise we
                                   spend ages scanning it on mount, etc. */
-                               D1(printk(KERN_DEBUG "...and adding to erase_pending_list\n"));
+                               jffs2_dbg(1, "...and adding to erase_pending_list\n");
                                list_add_tail(&jeb->list, &c->erase_pending_list);
                                c->nr_erasing_blocks++;
                                jffs2_garbage_collect_trigger(c);
                        } else {
                                /* Sometimes, however, we leave it elsewhere so it doesn't get
                                   immediately reused, and we spread the load a bit. */
-                               D1(printk(KERN_DEBUG "...and adding to erasable_list\n"));
+                               jffs2_dbg(1, "...and adding to erasable_list\n");
                                list_add_tail(&jeb->list, &c->erasable_list);
                        }
                }
-               D1(printk(KERN_DEBUG "Done OK\n"));
+               jffs2_dbg(1, "Done OK\n");
        } else if (jeb == c->gcblock) {
-               D2(printk(KERN_DEBUG "Not moving gcblock 0x%08x to dirty_list\n", jeb->offset));
+               jffs2_dbg(2, "Not moving gcblock 0x%08x to dirty_list\n",
+                         jeb->offset);
        } else if (ISDIRTY(jeb->dirty_size) && !ISDIRTY(jeb->dirty_size - addedsize)) {
-               D1(printk(KERN_DEBUG "Eraseblock at 0x%08x is freshly dirtied. Removing from clean list...\n", jeb->offset));
+               jffs2_dbg(1, "Eraseblock at 0x%08x is freshly dirtied. Removing from clean list...\n",
+                         jeb->offset);
                list_del(&jeb->list);
-               D1(printk(KERN_DEBUG "...and adding to dirty_list\n"));
+               jffs2_dbg(1, "...and adding to dirty_list\n");
                list_add_tail(&jeb->list, &c->dirty_list);
        } else if (VERYDIRTY(c, jeb->dirty_size) &&
                   !VERYDIRTY(c, jeb->dirty_size - addedsize)) {
-               D1(printk(KERN_DEBUG "Eraseblock at 0x%08x is now very dirty. Removing from dirty list...\n", jeb->offset));
+               jffs2_dbg(1, "Eraseblock at 0x%08x is now very dirty. Removing from dirty list...\n",
+                         jeb->offset);
                list_del(&jeb->list);
-               D1(printk(KERN_DEBUG "...and adding to very_dirty_list\n"));
+               jffs2_dbg(1, "...and adding to very_dirty_list\n");
                list_add_tail(&jeb->list, &c->very_dirty_list);
        } else {
-               D1(printk(KERN_DEBUG "Eraseblock at 0x%08x not moved anywhere. (free 0x%08x, dirty 0x%08x, used 0x%08x)\n",
-                         jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size));
+               jffs2_dbg(1, "Eraseblock at 0x%08x not moved anywhere. (free 0x%08x, dirty 0x%08x, used 0x%08x)\n",
+                         jeb->offset, jeb->free_size, jeb->dirty_size,
+                         jeb->used_size);
        }
 
        spin_unlock(&c->erase_completion_lock);
@@ -665,33 +703,40 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
           the block hasn't _already_ been erased, and that 'ref' itself hasn't been freed yet
           by jffs2_free_jeb_node_refs() in erase.c. Which is nice. */
 
-       D1(printk(KERN_DEBUG "obliterating obsoleted node at 0x%08x\n", ref_offset(ref)));
+       jffs2_dbg(1, "obliterating obsoleted node at 0x%08x\n",
+                 ref_offset(ref));
        ret = jffs2_flash_read(c, ref_offset(ref), sizeof(n), &retlen, (char *)&n);
        if (ret) {
-               printk(KERN_WARNING "Read error reading from obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret);
+               pr_warn("Read error reading from obsoleted node at 0x%08x: %d\n",
+                       ref_offset(ref), ret);
                goto out_erase_sem;
        }
        if (retlen != sizeof(n)) {
-               printk(KERN_WARNING "Short read from obsoleted node at 0x%08x: %zd\n", ref_offset(ref), retlen);
+               pr_warn("Short read from obsoleted node at 0x%08x: %zd\n",
+                       ref_offset(ref), retlen);
                goto out_erase_sem;
        }
        if (PAD(je32_to_cpu(n.totlen)) != PAD(freed_len)) {
-               printk(KERN_WARNING "Node totlen on flash (0x%08x) != totlen from node ref (0x%08x)\n", je32_to_cpu(n.totlen), freed_len);
+               pr_warn("Node totlen on flash (0x%08x) != totlen from node ref (0x%08x)\n",
+                       je32_to_cpu(n.totlen), freed_len);
                goto out_erase_sem;
        }
        if (!(je16_to_cpu(n.nodetype) & JFFS2_NODE_ACCURATE)) {
-               D1(printk(KERN_DEBUG "Node at 0x%08x was already marked obsolete (nodetype 0x%04x)\n", ref_offset(ref), je16_to_cpu(n.nodetype)));
+               jffs2_dbg(1, "Node at 0x%08x was already marked obsolete (nodetype 0x%04x)\n",
+                         ref_offset(ref), je16_to_cpu(n.nodetype));
                goto out_erase_sem;
        }
        /* XXX FIXME: This is ugly now */
        n.nodetype = cpu_to_je16(je16_to_cpu(n.nodetype) & ~JFFS2_NODE_ACCURATE);
        ret = jffs2_flash_write(c, ref_offset(ref), sizeof(n), &retlen, (char *)&n);
        if (ret) {
-               printk(KERN_WARNING "Write error in obliterating obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret);
+               pr_warn("Write error in obliterating obsoleted node at 0x%08x: %d\n",
+                       ref_offset(ref), ret);
                goto out_erase_sem;
        }
        if (retlen != sizeof(n)) {
-               printk(KERN_WARNING "Short write in obliterating obsoleted node at 0x%08x: %zd\n", ref_offset(ref), retlen);
+               pr_warn("Short write in obliterating obsoleted node at 0x%08x: %zd\n",
+                       ref_offset(ref), retlen);
                goto out_erase_sem;
        }
 
@@ -751,8 +796,8 @@ int jffs2_thread_should_wake(struct jffs2_sb_info *c)
                return 1;
 
        if (c->unchecked_size) {
-               D1(printk(KERN_DEBUG "jffs2_thread_should_wake(): unchecked_size %d, checked_ino #%d\n",
-                         c->unchecked_size, c->checked_ino));
+               jffs2_dbg(1, "jffs2_thread_should_wake(): unchecked_size %d, checked_ino #%d\n",
+                         c->unchecked_size, c->checked_ino);
                return 1;
        }
 
@@ -780,8 +825,9 @@ int jffs2_thread_should_wake(struct jffs2_sb_info *c)
                }
        }
 
-       D1(printk(KERN_DEBUG "jffs2_thread_should_wake(): nr_free_blocks %d, nr_erasing_blocks %d, dirty_size 0x%x, vdirty_blocks %d: %s\n",
-                 c->nr_free_blocks, c->nr_erasing_blocks, c->dirty_size, nr_very_dirty, ret?"yes":"no"));
+       jffs2_dbg(1, "%s(): nr_free_blocks %d, nr_erasing_blocks %d, dirty_size 0x%x, vdirty_blocks %d: %s\n",
+                 __func__, c->nr_free_blocks, c->nr_erasing_blocks,
+                 c->dirty_size, nr_very_dirty, ret ? "yes" : "no");
 
        return ret;
 }
This page took 0.041525 seconds and 5 git commands to generate.