diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-05-22 10:23:10 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-22 10:23:10 -0400 |
commit | fcb7578719529898aef9edce8e409e457a1c2d15 (patch) | |
tree | 58022b22d175b69e4b267f2f19ab26d93f7d4910 /fs/jffs2/gc.c | |
parent | a1b563d652b54647ffacb2d6edf7859d3e97a723 (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.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c index 4773ba24304f..153755bc1d53 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, | |||
634 | printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n", | 634 | printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n", |
635 | rawlen, phys_ofs, ret, retlen); | 635 | rawlen, phys_ofs, ret, retlen); |
636 | if (retlen) { | 636 | if (retlen) { |
637 | /* Doesn't belong to any inode */ | ||
638 | nraw->next_in_ino = NULL; | ||
639 | |||
640 | nraw->flash_offset |= REF_OBSOLETE; | 637 | nraw->flash_offset |= REF_OBSOLETE; |
641 | jffs2_add_physical_node_ref(c, nraw, rawlen); | 638 | jffs2_add_physical_node_ref(c, nraw, rawlen, NULL); |
642 | jffs2_mark_node_obsolete(c, nraw); | 639 | jffs2_mark_node_obsolete(c, nraw); |
643 | } else { | 640 | } else { |
644 | printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", nraw->flash_offset); | 641 | 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, | |||
678 | goto out_node; | 675 | goto out_node; |
679 | } | 676 | } |
680 | nraw->flash_offset |= REF_PRISTINE; | 677 | nraw->flash_offset |= REF_PRISTINE; |
681 | jffs2_add_physical_node_ref(c, nraw, rawlen); | 678 | jffs2_add_physical_node_ref(c, nraw, rawlen, ic); |
682 | 679 | ||
683 | if (ic) { | ||
684 | /* Link into per-inode list. This is safe because of the ic | ||
685 | state being INO_STATE_GC. Note that if we're doing this | ||
686 | for an inode which is in-core, the 'nraw' pointer is then | ||
687 | going to be fetched from ic->nodes by our caller. */ | ||
688 | spin_lock(&c->erase_completion_lock); | ||
689 | nraw->next_in_ino = ic->nodes; | ||
690 | ic->nodes = nraw; | ||
691 | spin_unlock(&c->erase_completion_lock); | ||
692 | } | ||
693 | jffs2_mark_node_obsolete(c, raw); | 680 | jffs2_mark_node_obsolete(c, raw); |
694 | D1(printk(KERN_DEBUG "WHEEE! GC REF_PRISTINE node at 0x%08x succeeded\n", ref_offset(raw))); | 681 | D1(printk(KERN_DEBUG "WHEEE! GC REF_PRISTINE node at 0x%08x succeeded\n", ref_offset(raw))); |
695 | 682 | ||