diff options
author | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-23 06:37:31 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-23 06:37:31 -0400 |
commit | 4cbb9b80e171107c6c34116283fe38e5a396c68b (patch) | |
tree | 9463f2e4774f14752cf4bb52431e14e569256f72 /fs/jffs2/write.c | |
parent | 6dfc6d250d0b7ebaa6423c44dcd09fcfe68deabd (diff) | |
parent | 9fe4854cd1f60273f9a3ece053f4789605f58a5e (diff) |
Merge branch 'master' of /home/tglx/work/kernel/git/mtd-2.6/
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2/write.c')
-rw-r--r-- | fs/jffs2/write.c | 85 |
1 files changed, 39 insertions, 46 deletions
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c index 4462541d11f8..0e12b7561b71 100644 --- a/fs/jffs2/write.c +++ b/fs/jffs2/write.c | |||
@@ -56,12 +56,15 @@ int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, uint | |||
56 | /* jffs2_write_dnode - given a raw_inode, allocate a full_dnode for it, | 56 | /* jffs2_write_dnode - given a raw_inode, allocate a full_dnode for it, |
57 | write it to the flash, link it into the existing inode/fragment list */ | 57 | write it to the flash, link it into the existing inode/fragment list */ |
58 | 58 | ||
59 | struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const unsigned char *data, uint32_t datalen, uint32_t flash_ofs, int alloc_mode) | 59 | struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, |
60 | struct jffs2_raw_inode *ri, const unsigned char *data, | ||
61 | uint32_t datalen, int alloc_mode) | ||
60 | 62 | ||
61 | { | 63 | { |
62 | struct jffs2_raw_node_ref *raw; | 64 | struct jffs2_raw_node_ref *raw; |
63 | struct jffs2_full_dnode *fn; | 65 | struct jffs2_full_dnode *fn; |
64 | size_t retlen; | 66 | size_t retlen; |
67 | uint32_t flash_ofs; | ||
65 | struct kvec vecs[2]; | 68 | struct kvec vecs[2]; |
66 | int ret; | 69 | int ret; |
67 | int retried = 0; | 70 | int retried = 0; |
@@ -77,8 +80,6 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 | |||
77 | vecs[1].iov_base = (unsigned char *)data; | 80 | vecs[1].iov_base = (unsigned char *)data; |
78 | vecs[1].iov_len = datalen; | 81 | vecs[1].iov_len = datalen; |
79 | 82 | ||
80 | jffs2_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len); | ||
81 | |||
82 | if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) { | 83 | if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) { |
83 | printk(KERN_WARNING "jffs2_write_dnode: ri->totlen (0x%08x) != sizeof(*ri) (0x%08zx) + datalen (0x%08x)\n", je32_to_cpu(ri->totlen), sizeof(*ri), datalen); | 84 | printk(KERN_WARNING "jffs2_write_dnode: ri->totlen (0x%08x) != sizeof(*ri) (0x%08zx) + datalen (0x%08x)\n", je32_to_cpu(ri->totlen), sizeof(*ri), datalen); |
84 | } | 85 | } |
@@ -102,7 +103,9 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 | |||
102 | retry: | 103 | retry: |
103 | fn->raw = raw; | 104 | fn->raw = raw; |
104 | 105 | ||
105 | raw->flash_offset = flash_ofs; | 106 | raw->flash_offset = flash_ofs = write_ofs(c); |
107 | |||
108 | jffs2_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len); | ||
106 | 109 | ||
107 | if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(ri->version) < f->highest_version)) { | 110 | if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(ri->version) < f->highest_version)) { |
108 | BUG_ON(!retried); | 111 | BUG_ON(!retried); |
@@ -122,16 +125,13 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 | |||
122 | 125 | ||
123 | /* Mark the space as dirtied */ | 126 | /* Mark the space as dirtied */ |
124 | if (retlen) { | 127 | 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 | 128 | /* Don't change raw->size to match retlen. We may have |
129 | written the node header already, and only the data will | 129 | written the node header already, and only the data will |
130 | seem corrupted, in which case the scan would skip over | 130 | seem corrupted, in which case the scan would skip over |
131 | any node we write before the original intended end of | 131 | any node we write before the original intended end of |
132 | this node */ | 132 | this node */ |
133 | raw->flash_offset |= REF_OBSOLETE; | 133 | raw->flash_offset |= REF_OBSOLETE; |
134 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*ri)+datalen)); | 134 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*ri)+datalen), NULL); |
135 | jffs2_mark_node_obsolete(c, raw); | 135 | jffs2_mark_node_obsolete(c, raw); |
136 | } else { | 136 | } 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); | 137 | printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset); |
@@ -150,19 +150,20 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 | |||
150 | jffs2_dbg_acct_paranoia_check(c, jeb); | 150 | jffs2_dbg_acct_paranoia_check(c, jeb); |
151 | 151 | ||
152 | if (alloc_mode == ALLOC_GC) { | 152 | if (alloc_mode == ALLOC_GC) { |
153 | ret = jffs2_reserve_space_gc(c, sizeof(*ri) + datalen, &flash_ofs, | 153 | ret = jffs2_reserve_space_gc(c, sizeof(*ri) + datalen, &dummy, |
154 | &dummy, JFFS2_SUMMARY_INODE_SIZE); | 154 | JFFS2_SUMMARY_INODE_SIZE); |
155 | } else { | 155 | } else { |
156 | /* Locking pain */ | 156 | /* Locking pain */ |
157 | up(&f->sem); | 157 | up(&f->sem); |
158 | jffs2_complete_reservation(c); | 158 | jffs2_complete_reservation(c); |
159 | 159 | ||
160 | ret = jffs2_reserve_space(c, sizeof(*ri) + datalen, &flash_ofs, | 160 | ret = jffs2_reserve_space(c, sizeof(*ri) + datalen, &dummy, |
161 | &dummy, alloc_mode, JFFS2_SUMMARY_INODE_SIZE); | 161 | alloc_mode, JFFS2_SUMMARY_INODE_SIZE); |
162 | down(&f->sem); | 162 | down(&f->sem); |
163 | } | 163 | } |
164 | 164 | ||
165 | if (!ret) { | 165 | if (!ret) { |
166 | flash_ofs = write_ofs(c); | ||
166 | D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", flash_ofs)); | 167 | D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", flash_ofs)); |
167 | 168 | ||
168 | jffs2_dbg_acct_sanity_check(c,jeb); | 169 | jffs2_dbg_acct_sanity_check(c,jeb); |
@@ -189,13 +190,7 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 | |||
189 | } else { | 190 | } else { |
190 | raw->flash_offset |= REF_NORMAL; | 191 | raw->flash_offset |= REF_NORMAL; |
191 | } | 192 | } |
192 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*ri)+datalen)); | 193 | 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 | 194 | ||
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", | 195 | 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), | 196 | flash_ofs, ref_flags(raw), je32_to_cpu(ri->dsize), |
@@ -209,12 +204,15 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 | |||
209 | return fn; | 204 | return fn; |
210 | } | 205 | } |
211 | 206 | ||
212 | struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_dirent *rd, const unsigned char *name, uint32_t namelen, uint32_t flash_ofs, int alloc_mode) | 207 | struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jffs2_inode_info *f, |
208 | struct jffs2_raw_dirent *rd, const unsigned char *name, | ||
209 | uint32_t namelen, int alloc_mode) | ||
213 | { | 210 | { |
214 | struct jffs2_raw_node_ref *raw; | 211 | struct jffs2_raw_node_ref *raw; |
215 | struct jffs2_full_dirent *fd; | 212 | struct jffs2_full_dirent *fd; |
216 | size_t retlen; | 213 | size_t retlen; |
217 | struct kvec vecs[2]; | 214 | struct kvec vecs[2]; |
215 | uint32_t flash_ofs = write_ofs(c); | ||
218 | int retried = 0; | 216 | int retried = 0; |
219 | int ret; | 217 | int ret; |
220 | 218 | ||
@@ -275,9 +273,8 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff | |||
275 | sizeof(*rd)+namelen, flash_ofs, ret, retlen); | 273 | sizeof(*rd)+namelen, flash_ofs, ret, retlen); |
276 | /* Mark the space as dirtied */ | 274 | /* Mark the space as dirtied */ |
277 | if (retlen) { | 275 | if (retlen) { |
278 | raw->next_in_ino = NULL; | ||
279 | raw->flash_offset |= REF_OBSOLETE; | 276 | raw->flash_offset |= REF_OBSOLETE; |
280 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*rd)+namelen)); | 277 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*rd)+namelen), NULL); |
281 | jffs2_mark_node_obsolete(c, raw); | 278 | jffs2_mark_node_obsolete(c, raw); |
282 | } else { | 279 | } 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); | 280 | printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset); |
@@ -296,19 +293,20 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff | |||
296 | jffs2_dbg_acct_paranoia_check(c, jeb); | 293 | jffs2_dbg_acct_paranoia_check(c, jeb); |
297 | 294 | ||
298 | if (alloc_mode == ALLOC_GC) { | 295 | if (alloc_mode == ALLOC_GC) { |
299 | ret = jffs2_reserve_space_gc(c, sizeof(*rd) + namelen, &flash_ofs, | 296 | ret = jffs2_reserve_space_gc(c, sizeof(*rd) + namelen, &dummy, |
300 | &dummy, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | 297 | JFFS2_SUMMARY_DIRENT_SIZE(namelen)); |
301 | } else { | 298 | } else { |
302 | /* Locking pain */ | 299 | /* Locking pain */ |
303 | up(&f->sem); | 300 | up(&f->sem); |
304 | jffs2_complete_reservation(c); | 301 | jffs2_complete_reservation(c); |
305 | 302 | ||
306 | ret = jffs2_reserve_space(c, sizeof(*rd) + namelen, &flash_ofs, | 303 | ret = jffs2_reserve_space(c, sizeof(*rd) + namelen, &dummy, |
307 | &dummy, alloc_mode, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | 304 | alloc_mode, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); |
308 | down(&f->sem); | 305 | down(&f->sem); |
309 | } | 306 | } |
310 | 307 | ||
311 | if (!ret) { | 308 | if (!ret) { |
309 | flash_ofs = write_ofs(c); | ||
312 | D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", flash_ofs)); | 310 | D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", flash_ofs)); |
313 | jffs2_dbg_acct_sanity_check(c,jeb); | 311 | jffs2_dbg_acct_sanity_check(c,jeb); |
314 | jffs2_dbg_acct_paranoia_check(c, jeb); | 312 | jffs2_dbg_acct_paranoia_check(c, jeb); |
@@ -323,12 +321,7 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff | |||
323 | } | 321 | } |
324 | /* Mark the space used */ | 322 | /* Mark the space used */ |
325 | raw->flash_offset |= REF_PRISTINE; | 323 | raw->flash_offset |= REF_PRISTINE; |
326 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*rd)+namelen)); | 324 | 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 | 325 | ||
333 | if (retried) { | 326 | if (retried) { |
334 | jffs2_dbg_acct_sanity_check(c,NULL); | 327 | jffs2_dbg_acct_sanity_check(c,NULL); |
@@ -354,14 +347,14 @@ int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
354 | struct jffs2_full_dnode *fn; | 347 | struct jffs2_full_dnode *fn; |
355 | unsigned char *comprbuf = NULL; | 348 | unsigned char *comprbuf = NULL; |
356 | uint16_t comprtype = JFFS2_COMPR_NONE; | 349 | uint16_t comprtype = JFFS2_COMPR_NONE; |
357 | uint32_t phys_ofs, alloclen; | 350 | uint32_t alloclen; |
358 | uint32_t datalen, cdatalen; | 351 | uint32_t datalen, cdatalen; |
359 | int retried = 0; | 352 | int retried = 0; |
360 | 353 | ||
361 | retry: | 354 | retry: |
362 | D2(printk(KERN_DEBUG "jffs2_commit_write() loop: 0x%x to write to 0x%x\n", writelen, offset)); | 355 | D2(printk(KERN_DEBUG "jffs2_commit_write() loop: 0x%x to write to 0x%x\n", writelen, offset)); |
363 | 356 | ||
364 | ret = jffs2_reserve_space(c, sizeof(*ri) + JFFS2_MIN_DATA_LEN, &phys_ofs, | 357 | ret = jffs2_reserve_space(c, sizeof(*ri) + JFFS2_MIN_DATA_LEN, |
365 | &alloclen, ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); | 358 | &alloclen, ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); |
366 | if (ret) { | 359 | if (ret) { |
367 | D1(printk(KERN_DEBUG "jffs2_reserve_space returned %d\n", ret)); | 360 | D1(printk(KERN_DEBUG "jffs2_reserve_space returned %d\n", ret)); |
@@ -389,7 +382,7 @@ int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
389 | ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); | 382 | ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); |
390 | ri->data_crc = cpu_to_je32(crc32(0, comprbuf, cdatalen)); | 383 | ri->data_crc = cpu_to_je32(crc32(0, comprbuf, cdatalen)); |
391 | 384 | ||
392 | fn = jffs2_write_dnode(c, f, ri, comprbuf, cdatalen, phys_ofs, ALLOC_NORETRY); | 385 | fn = jffs2_write_dnode(c, f, ri, comprbuf, cdatalen, ALLOC_NORETRY); |
393 | 386 | ||
394 | jffs2_free_comprbuf(comprbuf, buf); | 387 | jffs2_free_comprbuf(comprbuf, buf); |
395 | 388 | ||
@@ -443,13 +436,13 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str | |||
443 | struct jffs2_raw_dirent *rd; | 436 | struct jffs2_raw_dirent *rd; |
444 | struct jffs2_full_dnode *fn; | 437 | struct jffs2_full_dnode *fn; |
445 | struct jffs2_full_dirent *fd; | 438 | struct jffs2_full_dirent *fd; |
446 | uint32_t alloclen, phys_ofs; | 439 | uint32_t alloclen; |
447 | int ret; | 440 | int ret; |
448 | 441 | ||
449 | /* Try to reserve enough space for both node and dirent. | 442 | /* Try to reserve enough space for both node and dirent. |
450 | * Just the node will do for now, though | 443 | * Just the node will do for now, though |
451 | */ | 444 | */ |
452 | ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL, | 445 | ret = jffs2_reserve_space(c, sizeof(*ri), &alloclen, ALLOC_NORMAL, |
453 | JFFS2_SUMMARY_INODE_SIZE); | 446 | JFFS2_SUMMARY_INODE_SIZE); |
454 | D1(printk(KERN_DEBUG "jffs2_do_create(): reserved 0x%x bytes\n", alloclen)); | 447 | D1(printk(KERN_DEBUG "jffs2_do_create(): reserved 0x%x bytes\n", alloclen)); |
455 | if (ret) { | 448 | if (ret) { |
@@ -460,7 +453,7 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str | |||
460 | ri->data_crc = cpu_to_je32(0); | 453 | ri->data_crc = cpu_to_je32(0); |
461 | ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); | 454 | ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); |
462 | 455 | ||
463 | fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, ALLOC_NORMAL); | 456 | fn = jffs2_write_dnode(c, f, ri, NULL, 0, ALLOC_NORMAL); |
464 | 457 | ||
465 | D1(printk(KERN_DEBUG "jffs2_do_create created file with mode 0x%x\n", | 458 | D1(printk(KERN_DEBUG "jffs2_do_create created file with mode 0x%x\n", |
466 | jemode_to_cpu(ri->mode))); | 459 | jemode_to_cpu(ri->mode))); |
@@ -479,7 +472,7 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str | |||
479 | 472 | ||
480 | up(&f->sem); | 473 | up(&f->sem); |
481 | jffs2_complete_reservation(c); | 474 | jffs2_complete_reservation(c); |
482 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, | 475 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen, |
483 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | 476 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); |
484 | 477 | ||
485 | if (ret) { | 478 | if (ret) { |
@@ -511,7 +504,7 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str | |||
511 | rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); | 504 | rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); |
512 | rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); | 505 | rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); |
513 | 506 | ||
514 | fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, phys_ofs, ALLOC_NORMAL); | 507 | fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, ALLOC_NORMAL); |
515 | 508 | ||
516 | jffs2_free_raw_dirent(rd); | 509 | jffs2_free_raw_dirent(rd); |
517 | 510 | ||
@@ -540,7 +533,7 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, | |||
540 | { | 533 | { |
541 | struct jffs2_raw_dirent *rd; | 534 | struct jffs2_raw_dirent *rd; |
542 | struct jffs2_full_dirent *fd; | 535 | struct jffs2_full_dirent *fd; |
543 | uint32_t alloclen, phys_ofs; | 536 | uint32_t alloclen; |
544 | int ret; | 537 | int ret; |
545 | 538 | ||
546 | if (1 /* alternative branch needs testing */ || | 539 | if (1 /* alternative branch needs testing */ || |
@@ -551,7 +544,7 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, | |||
551 | if (!rd) | 544 | if (!rd) |
552 | return -ENOMEM; | 545 | return -ENOMEM; |
553 | 546 | ||
554 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, | 547 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen, |
555 | ALLOC_DELETION, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | 548 | ALLOC_DELETION, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); |
556 | if (ret) { | 549 | if (ret) { |
557 | jffs2_free_raw_dirent(rd); | 550 | jffs2_free_raw_dirent(rd); |
@@ -575,7 +568,7 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, | |||
575 | rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); | 568 | rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); |
576 | rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); | 569 | rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); |
577 | 570 | ||
578 | fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, phys_ofs, ALLOC_DELETION); | 571 | fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, ALLOC_DELETION); |
579 | 572 | ||
580 | jffs2_free_raw_dirent(rd); | 573 | jffs2_free_raw_dirent(rd); |
581 | 574 | ||
@@ -654,14 +647,14 @@ int jffs2_do_link (struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint | |||
654 | { | 647 | { |
655 | struct jffs2_raw_dirent *rd; | 648 | struct jffs2_raw_dirent *rd; |
656 | struct jffs2_full_dirent *fd; | 649 | struct jffs2_full_dirent *fd; |
657 | uint32_t alloclen, phys_ofs; | 650 | uint32_t alloclen; |
658 | int ret; | 651 | int ret; |
659 | 652 | ||
660 | rd = jffs2_alloc_raw_dirent(); | 653 | rd = jffs2_alloc_raw_dirent(); |
661 | if (!rd) | 654 | if (!rd) |
662 | return -ENOMEM; | 655 | return -ENOMEM; |
663 | 656 | ||
664 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, | 657 | ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen, |
665 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); | 658 | ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); |
666 | if (ret) { | 659 | if (ret) { |
667 | jffs2_free_raw_dirent(rd); | 660 | jffs2_free_raw_dirent(rd); |
@@ -687,7 +680,7 @@ int jffs2_do_link (struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint | |||
687 | rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); | 680 | rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); |
688 | rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); | 681 | rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); |
689 | 682 | ||
690 | fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, phys_ofs, ALLOC_NORMAL); | 683 | fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, ALLOC_NORMAL); |
691 | 684 | ||
692 | jffs2_free_raw_dirent(rd); | 685 | jffs2_free_raw_dirent(rd); |
693 | 686 | ||