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/write.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/write.c')
-rw-r--r-- | fs/jffs2/write.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c index 4462541d11f8..319a70f531f8 100644 --- a/fs/jffs2/write.c +++ b/fs/jffs2/write.c | |||
@@ -122,16 +122,13 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 | |||
122 | 122 | ||
123 | /* Mark the space as dirtied */ | 123 | /* Mark the space as dirtied */ |
124 | if (retlen) { | 124 | if (retlen) { |
125 | /* Doesn't belong to any inode */ | ||
126 | raw->next_in_ino = NULL; | ||
127 | |||
128 | /* Don't change raw->size to match retlen. We may have | 125 | /* Don't change raw->size to match retlen. We may have |
129 | written the node header already, and only the data will | 126 | written the node header already, and only the data will |
130 | seem corrupted, in which case the scan would skip over | 127 | seem corrupted, in which case the scan would skip over |
131 | any node we write before the original intended end of | 128 | any node we write before the original intended end of |
132 | this node */ | 129 | this node */ |
133 | raw->flash_offset |= REF_OBSOLETE; | 130 | raw->flash_offset |= REF_OBSOLETE; |
134 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*ri)+datalen)); | 131 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*ri)+datalen), NULL); |
135 | jffs2_mark_node_obsolete(c, raw); | 132 | jffs2_mark_node_obsolete(c, raw); |
136 | } else { | 133 | } else { |
137 | printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset); | 134 | printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset); |
@@ -189,13 +186,7 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 | |||
189 | } else { | 186 | } else { |
190 | raw->flash_offset |= REF_NORMAL; | 187 | raw->flash_offset |= REF_NORMAL; |
191 | } | 188 | } |
192 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*ri)+datalen)); | 189 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*ri)+datalen), f->inocache); |
193 | |||
194 | /* Link into per-inode list */ | ||
195 | spin_lock(&c->erase_completion_lock); | ||
196 | raw->next_in_ino = f->inocache->nodes; | ||
197 | f->inocache->nodes = raw; | ||
198 | spin_unlock(&c->erase_completion_lock); | ||
199 | 190 | ||
200 | D1(printk(KERN_DEBUG "jffs2_write_dnode wrote node at 0x%08x(%d) with dsize 0x%x, csize 0x%x, node_crc 0x%08x, data_crc 0x%08x, totlen 0x%08x\n", | 191 | D1(printk(KERN_DEBUG "jffs2_write_dnode wrote node at 0x%08x(%d) with dsize 0x%x, csize 0x%x, node_crc 0x%08x, data_crc 0x%08x, totlen 0x%08x\n", |
201 | flash_ofs, ref_flags(raw), je32_to_cpu(ri->dsize), | 192 | flash_ofs, ref_flags(raw), je32_to_cpu(ri->dsize), |
@@ -275,9 +266,8 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff | |||
275 | sizeof(*rd)+namelen, flash_ofs, ret, retlen); | 266 | sizeof(*rd)+namelen, flash_ofs, ret, retlen); |
276 | /* Mark the space as dirtied */ | 267 | /* Mark the space as dirtied */ |
277 | if (retlen) { | 268 | if (retlen) { |
278 | raw->next_in_ino = NULL; | ||
279 | raw->flash_offset |= REF_OBSOLETE; | 269 | raw->flash_offset |= REF_OBSOLETE; |
280 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*rd)+namelen)); | 270 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*rd)+namelen), NULL); |
281 | jffs2_mark_node_obsolete(c, raw); | 271 | jffs2_mark_node_obsolete(c, raw); |
282 | } else { | 272 | } else { |
283 | printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset); | 273 | printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset); |
@@ -323,12 +313,7 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff | |||
323 | } | 313 | } |
324 | /* Mark the space used */ | 314 | /* Mark the space used */ |
325 | raw->flash_offset |= REF_PRISTINE; | 315 | raw->flash_offset |= REF_PRISTINE; |
326 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*rd)+namelen)); | 316 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*rd)+namelen), f->inocache); |
327 | |||
328 | spin_lock(&c->erase_completion_lock); | ||
329 | raw->next_in_ino = f->inocache->nodes; | ||
330 | f->inocache->nodes = raw; | ||
331 | spin_unlock(&c->erase_completion_lock); | ||
332 | 317 | ||
333 | if (retried) { | 318 | if (retried) { |
334 | jffs2_dbg_acct_sanity_check(c,NULL); | 319 | jffs2_dbg_acct_sanity_check(c,NULL); |