summaryrefslogtreecommitdiff
path: root/fs/jffs2/gc.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-05-22 15:23:10 +0100
committerDavid Woodhouse <dwmw2@infradead.org>2006-05-22 15:23:10 +0100
commitfcb7578719529898aef9edce8e409e457a1c2d15 (patch)
tree58022b22d175b69e4b267f2f19ab26d93f7d4910 /fs/jffs2/gc.c
parenta1b563d652b54647ffacb2d6edf7859d3e97a723 (diff)
[JFFS2] Extend jffs2_link_node_ref() to link into per-inode list too.
Let's avoid the potential for forgetting to set ref->next_in_ino, by doing it within jffs2_link_node_ref() instead. This highlights the ugliness of what we're currently doing with xattr_datum and xattr_ref structures -- we should find a nicer way of dealing with that. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/gc.c')
-rw-r--r--fs/jffs2/gc.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c
index 4773ba24304..153755bc1d5 100644
--- a/fs/jffs2/gc.c
+++ b/fs/jffs2/gc.c
@@ -634,11 +634,8 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n",
rawlen, phys_ofs, ret, retlen);
if (retlen) {
- /* Doesn't belong to any inode */
- nraw->next_in_ino = NULL;
-
nraw->flash_offset |= REF_OBSOLETE;
- jffs2_add_physical_node_ref(c, nraw, rawlen);
+ jffs2_add_physical_node_ref(c, nraw, rawlen, NULL);
jffs2_mark_node_obsolete(c, nraw);
} else {
printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", nraw->flash_offset);
@@ -678,18 +675,8 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
goto out_node;
}
nraw->flash_offset |= REF_PRISTINE;
- jffs2_add_physical_node_ref(c, nraw, rawlen);
+ jffs2_add_physical_node_ref(c, nraw, rawlen, ic);
- if (ic) {
- /* Link into per-inode list. This is safe because of the ic
- state being INO_STATE_GC. Note that if we're doing this
- for an inode which is in-core, the 'nraw' pointer is then
- going to be fetched from ic->nodes by our caller. */
- spin_lock(&c->erase_completion_lock);
- nraw->next_in_ino = ic->nodes;
- ic->nodes = nraw;
- spin_unlock(&c->erase_completion_lock);
- }
jffs2_mark_node_obsolete(c, raw);
D1(printk(KERN_DEBUG "WHEEE! GC REF_PRISTINE node at 0x%08x succeeded\n", ref_offset(raw)));