]> Pileus Git - ~andy/linux/blobdiff - fs/jffs2/write.c
[JFFS2] Don't count all 'very dirty' blocks except in debug mode
[~andy/linux] / fs / jffs2 / write.c
index 1406f2ce20a72058ed5ea8c8ff3de727b612a40c..664c164aa67c19bef7583ce6fa7014cc715ffef5 100644 (file)
@@ -296,7 +296,8 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
                return ERR_PTR(ret?ret:-EIO);
        }
        /* Mark the space used */
-       fd->raw = jffs2_add_physical_node_ref(c, flash_ofs | REF_PRISTINE, PAD(sizeof(*rd)+namelen), f->inocache);
+       fd->raw = jffs2_add_physical_node_ref(c, flash_ofs | dirent_node_state(rd),
+                                             PAD(sizeof(*rd)+namelen), f->inocache);
        if (IS_ERR(fd->raw)) {
                void *hold_err = fd->raw;
                /* Release the full_dirent which is now useless, and return */
@@ -565,6 +566,9 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f,
                struct jffs2_full_dirent **prev = &dir_f->dents;
                uint32_t nhash = full_name_hash(name, namelen);
 
+               /* We don't actually want to reserve any space, but we do
+                  want to be holding the alloc_sem when we write to flash */
+               down(&c->alloc_sem);
                down(&dir_f->sem);
 
                while ((*prev) && (*prev)->nhash <= nhash) {