]> err.no Git - linux-2.6/blobdiff - fs/jffs2/nodemgmt.c
[PATCH] do_notify_parent_cldstop() cleanup
[linux-2.6] / fs / jffs2 / nodemgmt.c
index f9dcac1415ac5e3d1e31b22a852e75e7f2d16d62..c1d8b5ed9ab95221b89b2af4bbcdd985de16775f 100644 (file)
@@ -7,7 +7,7 @@
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  *
- * $Id: nodemgmt.c,v 1.118 2005/02/27 23:01:32 dwmw2 Exp $
+ * $Id: nodemgmt.c,v 1.122 2005/05/06 09:30:27 dedekind Exp $
  *
  */
 
@@ -75,7 +75,7 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs
                        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) {
-                                       printk(KERN_NOTICE "jffs2_reserve_space(): Low on dirty space to GC, but it's a deletion. Allowing...\n");
+                                       D1(printk(KERN_NOTICE "jffs2_reserve_space(): Low on dirty space to GC, but it's a deletion. Allowing...\n"));
                                        break;
                                }
                                D1(printk(KERN_DEBUG "dirty size 0x%08x + unchecked_size 0x%08x < nospc_dirty_size 0x%08x, returning -ENOSPC\n",
@@ -98,7 +98,7 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs
                        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) {
-                                       printk(KERN_NOTICE "jffs2_reserve_space(): Low on possibly available space, but it's a deletion. Allowing...\n");
+                                       D1(printk(KERN_NOTICE "jffs2_reserve_space(): Low on possibly available space, but it's a deletion. Allowing...\n"));
                                        break;
                                }
 
@@ -403,7 +403,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
        jeb = &c->blocks[blocknr];
 
        if (jffs2_can_mark_obsolete(c) && !jffs2_is_readonly(c) &&
-           !(c->flags & JFFS2_SB_FLAG_MOUNTING)) {
+           !(c->flags & (JFFS2_SB_FLAG_SCANNING | JFFS2_SB_FLAG_BUILDING))) {
                /* Hm. This may confuse static lock analysis. If any of the above 
                   three conditions is false, we're going to return from this 
                   function without actually obliterating any nodes or freeing
@@ -437,7 +437,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
 
        // Take care, that wasted size is taken into concern
        if ((jeb->dirty_size || ISDIRTY(jeb->wasted_size + ref_totlen(c, jeb, ref))) && jeb != c->nextblock) {
-               D1(printk("Dirtying\n"));
+               D1(printk(KERN_DEBUG "Dirtying\n"));
                addedsize = ref_totlen(c, jeb, ref);
                jeb->dirty_size += ref_totlen(c, jeb, ref);
                c->dirty_size += ref_totlen(c, jeb, ref);
@@ -459,7 +459,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
                        }
                }
        } else {
-               D1(printk("Wasting\n"));
+               D1(printk(KERN_DEBUG "Wasting\n"));
                addedsize = 0;
                jeb->wasted_size += ref_totlen(c, jeb, ref);
                c->wasted_size += ref_totlen(c, jeb, ref);      
@@ -470,8 +470,8 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
 
        D1(ACCT_PARANOIA_CHECK(jeb));
 
-       if (c->flags & JFFS2_SB_FLAG_MOUNTING) {
-               /* Mount in progress. Don't muck about with the block
+       if (c->flags & JFFS2_SB_FLAG_SCANNING) {
+               /* Flash scanning is in progress. Don't muck about with the block
                   lists because they're not ready yet, and don't actually
                   obliterate nodes that look obsolete. If they weren't 
                   marked obsolete on the flash at the time they _became_
@@ -530,7 +530,8 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
 
        spin_unlock(&c->erase_completion_lock);
 
-       if (!jffs2_can_mark_obsolete(c) || jffs2_is_readonly(c)) {
+       if (!jffs2_can_mark_obsolete(c) || jffs2_is_readonly(c) ||
+               (c->flags & JFFS2_SB_FLAG_BUILDING)) {
                /* We didn't lock the erase_free_sem */
                return;
        }
@@ -593,7 +594,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
                *p = ref->next_in_ino;
                ref->next_in_ino = NULL;
 
-               if (ic->nodes == (void *)ic)
+               if (ic->nodes == (void *)ic && ic->nlink == 0)
                        jffs2_del_ino_cache(c, ic);
 
                spin_unlock(&c->erase_completion_lock);