aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-06-29 08:39:57 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-06-29 08:39:57 -0400
commit43dfa07fbb6b8bd5b6173a5bab48470f578c8e5b (patch)
tree2818c8f74de363c2a4084b9b050685d0a17beec9 /fs/jffs2
parent663d77a7ccfd407cf7491dbd53c7c17eef58c96a (diff)
[JFFS2] Deletion dirents should be REF_NORMAL, not REF_PRISTINE.
Otherwise they'll never actually get garbage-collected. Noted by Jonathan Larmour. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/nodelist.h5
-rw-r--r--fs/jffs2/readinode.c2
-rw-r--r--fs/jffs2/scan.c3
-rw-r--r--fs/jffs2/write.c3
4 files changed, 10 insertions, 3 deletions
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
index 25126a062cae..bc5509fe577b 100644
--- a/fs/jffs2/nodelist.h
+++ b/fs/jffs2/nodelist.h
@@ -139,6 +139,11 @@ static inline struct jffs2_inode_cache *jffs2_raw_ref_to_ic(struct jffs2_raw_nod
139#define ref_obsolete(ref) (((ref)->flash_offset & 3) == REF_OBSOLETE) 139#define ref_obsolete(ref) (((ref)->flash_offset & 3) == REF_OBSOLETE)
140#define mark_ref_normal(ref) do { (ref)->flash_offset = ref_offset(ref) | REF_NORMAL; } while(0) 140#define mark_ref_normal(ref) do { (ref)->flash_offset = ref_offset(ref) | REF_NORMAL; } while(0)
141 141
142/* Dirent nodes should be REF_PRISTINE only if they are not a deletion
143 dirent. Deletion dirents should be REF_NORMAL so that GC gets to
144 throw them away when appropriate */
145#define dirent_node_state(rd) ( (je32_to_cpu((rd)->ino)?REF_PRISTINE:REF_NORMAL) )
146
142/* NB: REF_PRISTINE for an inode-less node (ref->next_in_ino == NULL) indicates 147/* NB: REF_PRISTINE for an inode-less node (ref->next_in_ino == NULL) indicates
143 it is an unknown node of type JFFS2_NODETYPE_RWCOMPAT_COPY, so it'll get 148 it is an unknown node of type JFFS2_NODETYPE_RWCOMPAT_COPY, so it'll get
144 copied. If you need to do anything different to GC inode-less nodes, then 149 copied. If you need to do anything different to GC inode-less nodes, then
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 12e83f67eee4..b66eb0c4a0c5 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -615,7 +615,7 @@ static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r
615 jeb->unchecked_size -= len; 615 jeb->unchecked_size -= len;
616 c->used_size += len; 616 c->used_size += len;
617 c->unchecked_size -= len; 617 c->unchecked_size -= len;
618 ref->flash_offset = ref_offset(ref) | REF_PRISTINE; 618 ref->flash_offset = ref_offset(ref) | dirent_node_state(rd);
619 spin_unlock(&c->erase_completion_lock); 619 spin_unlock(&c->erase_completion_lock);
620 } 620 }
621 621
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 2a1c976c7924..6c75cd433342 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -1049,7 +1049,8 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
1049 return -ENOMEM; 1049 return -ENOMEM;
1050 } 1050 }
1051 1051
1052 fd->raw = jffs2_link_node_ref(c, jeb, ofs | REF_PRISTINE, PAD(je32_to_cpu(rd->totlen)), ic); 1052 fd->raw = jffs2_link_node_ref(c, jeb, ofs | dirent_node_state(rd),
1053 PAD(je32_to_cpu(rd->totlen)), ic);
1053 1054
1054 fd->next = NULL; 1055 fd->next = NULL;
1055 fd->version = je32_to_cpu(rd->version); 1056 fd->version = je32_to_cpu(rd->version);
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c
index 1406f2ce20a7..bc6185933664 100644
--- a/fs/jffs2/write.c
+++ b/fs/jffs2/write.c
@@ -296,7 +296,8 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
296 return ERR_PTR(ret?ret:-EIO); 296 return ERR_PTR(ret?ret:-EIO);
297 } 297 }
298 /* Mark the space used */ 298 /* Mark the space used */
299 fd->raw = jffs2_add_physical_node_ref(c, flash_ofs | REF_PRISTINE, PAD(sizeof(*rd)+namelen), f->inocache); 299 fd->raw = jffs2_add_physical_node_ref(c, flash_ofs | dirent_node_state(rd),
300 PAD(sizeof(*rd)+namelen), f->inocache);
300 if (IS_ERR(fd->raw)) { 301 if (IS_ERR(fd->raw)) {
301 void *hold_err = fd->raw; 302 void *hold_err = fd->raw;
302 /* Release the full_dirent which is now useless, and return */ 303 /* Release the full_dirent which is now useless, and return */