diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-05-20 23:36:45 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-20 23:36:45 -0400 |
commit | b64335f2b740d6f5dbf5d3b04af30d407bf599f5 (patch) | |
tree | 442e85ebc977f8d01bf9c1fe6dfbe898788422c5 /fs/jffs2 | |
parent | 49f11d40751b974f3b829f208eefa6f97a10cac8 (diff) |
[JFFS2] Add length argument to jffs2_add_physical_node_ref()
If __totlen is going away, we need to pass the length in separately.
Also stop callers from needlessly setting ref->next_phys to NULL,
since that's done for them... and since that'll also be going away soon.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2')
-rw-r--r-- | fs/jffs2/gc.c | 6 | ||||
-rw-r--r-- | fs/jffs2/nodelist.h | 2 | ||||
-rw-r--r-- | fs/jffs2/nodemgmt.c | 6 | ||||
-rw-r--r-- | fs/jffs2/wbuf.c | 4 | ||||
-rw-r--r-- | fs/jffs2/write.c | 12 | ||||
-rw-r--r-- | fs/jffs2/xattr.c | 14 |
6 files changed, 15 insertions, 29 deletions
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c index b0a5c407b476..4773ba24304f 100644 --- a/fs/jffs2/gc.c +++ b/fs/jffs2/gc.c | |||
@@ -627,8 +627,6 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c, | |||
627 | /* OK, all the CRCs are good; this node can just be copied as-is. */ | 627 | /* OK, all the CRCs are good; this node can just be copied as-is. */ |
628 | retry: | 628 | retry: |
629 | nraw->flash_offset = phys_ofs; | 629 | nraw->flash_offset = phys_ofs; |
630 | nraw->__totlen = rawlen; | ||
631 | nraw->next_phys = NULL; | ||
632 | 630 | ||
633 | ret = jffs2_flash_write(c, phys_ofs, rawlen, &retlen, (char *)node); | 631 | ret = jffs2_flash_write(c, phys_ofs, rawlen, &retlen, (char *)node); |
634 | 632 | ||
@@ -640,7 +638,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c, | |||
640 | nraw->next_in_ino = NULL; | 638 | nraw->next_in_ino = NULL; |
641 | 639 | ||
642 | nraw->flash_offset |= REF_OBSOLETE; | 640 | nraw->flash_offset |= REF_OBSOLETE; |
643 | jffs2_add_physical_node_ref(c, nraw); | 641 | jffs2_add_physical_node_ref(c, nraw, rawlen); |
644 | jffs2_mark_node_obsolete(c, nraw); | 642 | jffs2_mark_node_obsolete(c, nraw); |
645 | } else { | 643 | } else { |
646 | printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", nraw->flash_offset); | 644 | printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", nraw->flash_offset); |
@@ -680,7 +678,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c, | |||
680 | goto out_node; | 678 | goto out_node; |
681 | } | 679 | } |
682 | nraw->flash_offset |= REF_PRISTINE; | 680 | nraw->flash_offset |= REF_PRISTINE; |
683 | jffs2_add_physical_node_ref(c, nraw); | 681 | jffs2_add_physical_node_ref(c, nraw, rawlen); |
684 | 682 | ||
685 | if (ic) { | 683 | if (ic) { |
686 | /* Link into per-inode list. This is safe because of the ic | 684 | /* Link into per-inode list. This is safe because of the ic |
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h index ca15b3c731cf..94ef88787347 100644 --- a/fs/jffs2/nodelist.h +++ b/fs/jffs2/nodelist.h | |||
@@ -362,7 +362,7 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs | |||
362 | uint32_t *len, int prio, uint32_t sumsize); | 362 | uint32_t *len, int prio, uint32_t sumsize); |
363 | int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, | 363 | int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, |
364 | uint32_t *len, uint32_t sumsize); | 364 | uint32_t *len, uint32_t sumsize); |
365 | int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new); | 365 | int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new, uint32_t len); |
366 | void jffs2_complete_reservation(struct jffs2_sb_info *c); | 366 | void jffs2_complete_reservation(struct jffs2_sb_info *c); |
367 | void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *raw); | 367 | void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *raw); |
368 | 368 | ||
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c index d6eab1b7ad53..4701556be49d 100644 --- a/fs/jffs2/nodemgmt.c +++ b/fs/jffs2/nodemgmt.c | |||
@@ -374,7 +374,6 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uin | |||
374 | * @c: superblock info | 374 | * @c: superblock info |
375 | * @new: new node reference to add | 375 | * @new: new node reference to add |
376 | * @len: length of this physical node | 376 | * @len: length of this physical node |
377 | * @dirty: dirty flag for new node | ||
378 | * | 377 | * |
379 | * Should only be used to report nodes for which space has been allocated | 378 | * Should only be used to report nodes for which space has been allocated |
380 | * by jffs2_reserve_space. | 379 | * by jffs2_reserve_space. |
@@ -382,13 +381,12 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uin | |||
382 | * Must be called with the alloc_sem held. | 381 | * Must be called with the alloc_sem held. |
383 | */ | 382 | */ |
384 | 383 | ||
385 | int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new) | 384 | int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new, uint32_t len) |
386 | { | 385 | { |
387 | struct jffs2_eraseblock *jeb; | 386 | struct jffs2_eraseblock *jeb; |
388 | uint32_t len; | ||
389 | 387 | ||
390 | jeb = &c->blocks[new->flash_offset / c->sector_size]; | 388 | jeb = &c->blocks[new->flash_offset / c->sector_size]; |
391 | len = ref_totlen(c, jeb, new); | 389 | new->__totlen = len; |
392 | 390 | ||
393 | D1(printk(KERN_DEBUG "jffs2_add_physical_node_ref(): Node at 0x%x(%d), size 0x%x\n", ref_offset(new), ref_flags(new), len)); | 391 | D1(printk(KERN_DEBUG "jffs2_add_physical_node_ref(): Node at 0x%x(%d), size 0x%x\n", ref_offset(new), ref_flags(new), len)); |
394 | #if 1 | 392 | #if 1 |
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c index 4cebf0e57c46..676b83410f8c 100644 --- a/fs/jffs2/wbuf.c +++ b/fs/jffs2/wbuf.c | |||
@@ -312,11 +312,9 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) | |||
312 | return; | 312 | return; |
313 | 313 | ||
314 | raw2->flash_offset = ofs | REF_OBSOLETE; | 314 | raw2->flash_offset = ofs | REF_OBSOLETE; |
315 | raw2->__totlen = ref_totlen(c, jeb, *first_raw); | ||
316 | raw2->next_phys = NULL; | ||
317 | raw2->next_in_ino = NULL; | 315 | raw2->next_in_ino = NULL; |
318 | 316 | ||
319 | jffs2_add_physical_node_ref(c, raw2); | 317 | jffs2_add_physical_node_ref(c, raw2, ref_totlen(c, jeb, *first_raw)); |
320 | } | 318 | } |
321 | return; | 319 | return; |
322 | } | 320 | } |
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c index ff2b00b604ec..4462541d11f8 100644 --- a/fs/jffs2/write.c +++ b/fs/jffs2/write.c | |||
@@ -103,8 +103,6 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 | |||
103 | fn->raw = raw; | 103 | fn->raw = raw; |
104 | 104 | ||
105 | raw->flash_offset = flash_ofs; | 105 | raw->flash_offset = flash_ofs; |
106 | raw->__totlen = PAD(sizeof(*ri)+datalen); | ||
107 | raw->next_phys = NULL; | ||
108 | 106 | ||
109 | if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(ri->version) < f->highest_version)) { | 107 | if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(ri->version) < f->highest_version)) { |
110 | BUG_ON(!retried); | 108 | BUG_ON(!retried); |
@@ -133,7 +131,7 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 | |||
133 | any node we write before the original intended end of | 131 | any node we write before the original intended end of |
134 | this node */ | 132 | this node */ |
135 | raw->flash_offset |= REF_OBSOLETE; | 133 | raw->flash_offset |= REF_OBSOLETE; |
136 | jffs2_add_physical_node_ref(c, raw); | 134 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*ri)+datalen)); |
137 | jffs2_mark_node_obsolete(c, raw); | 135 | jffs2_mark_node_obsolete(c, raw); |
138 | } else { | 136 | } else { |
139 | 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); |
@@ -191,7 +189,7 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 | |||
191 | } else { | 189 | } else { |
192 | raw->flash_offset |= REF_NORMAL; | 190 | raw->flash_offset |= REF_NORMAL; |
193 | } | 191 | } |
194 | jffs2_add_physical_node_ref(c, raw); | 192 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*ri)+datalen)); |
195 | 193 | ||
196 | /* Link into per-inode list */ | 194 | /* Link into per-inode list */ |
197 | spin_lock(&c->erase_completion_lock); | 195 | spin_lock(&c->erase_completion_lock); |
@@ -259,8 +257,6 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff | |||
259 | fd->raw = raw; | 257 | fd->raw = raw; |
260 | 258 | ||
261 | raw->flash_offset = flash_ofs; | 259 | raw->flash_offset = flash_ofs; |
262 | raw->__totlen = PAD(sizeof(*rd)+namelen); | ||
263 | raw->next_phys = NULL; | ||
264 | 260 | ||
265 | if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(rd->version) < f->highest_version)) { | 261 | if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(rd->version) < f->highest_version)) { |
266 | BUG_ON(!retried); | 262 | BUG_ON(!retried); |
@@ -281,7 +277,7 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff | |||
281 | if (retlen) { | 277 | if (retlen) { |
282 | raw->next_in_ino = NULL; | 278 | raw->next_in_ino = NULL; |
283 | raw->flash_offset |= REF_OBSOLETE; | 279 | raw->flash_offset |= REF_OBSOLETE; |
284 | jffs2_add_physical_node_ref(c, raw); | 280 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*rd)+namelen)); |
285 | jffs2_mark_node_obsolete(c, raw); | 281 | jffs2_mark_node_obsolete(c, raw); |
286 | } else { | 282 | } else { |
287 | printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset); | 283 | printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset); |
@@ -327,7 +323,7 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff | |||
327 | } | 323 | } |
328 | /* Mark the space used */ | 324 | /* Mark the space used */ |
329 | raw->flash_offset |= REF_PRISTINE; | 325 | raw->flash_offset |= REF_PRISTINE; |
330 | jffs2_add_physical_node_ref(c, raw); | 326 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(*rd)+namelen)); |
331 | 327 | ||
332 | spin_lock(&c->erase_completion_lock); | 328 | spin_lock(&c->erase_completion_lock); |
333 | raw->next_in_ino = f->inocache->nodes; | 329 | raw->next_in_ino = f->inocache->nodes; |
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c index 057bd4dcf665..e16f8460ff04 100644 --- a/fs/jffs2/xattr.c +++ b/fs/jffs2/xattr.c | |||
@@ -322,8 +322,6 @@ static int save_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x | |||
322 | if (!raw) | 322 | if (!raw) |
323 | return -ENOMEM; | 323 | return -ENOMEM; |
324 | raw->flash_offset = phys_ofs; | 324 | raw->flash_offset = phys_ofs; |
325 | raw->__totlen = PAD(totlen); | ||
326 | raw->next_phys = NULL; | ||
327 | raw->next_in_ino = (void *)xd; | 325 | raw->next_in_ino = (void *)xd; |
328 | 326 | ||
329 | /* Setup raw-xattr */ | 327 | /* Setup raw-xattr */ |
@@ -348,17 +346,17 @@ static int save_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x | |||
348 | if (length) { | 346 | if (length) { |
349 | raw->flash_offset |= REF_OBSOLETE; | 347 | raw->flash_offset |= REF_OBSOLETE; |
350 | raw->next_in_ino = NULL; | 348 | raw->next_in_ino = NULL; |
351 | jffs2_add_physical_node_ref(c, raw); | 349 | jffs2_add_physical_node_ref(c, raw, PAD(totlen)); |
352 | jffs2_mark_node_obsolete(c, raw); | 350 | jffs2_mark_node_obsolete(c, raw); |
353 | } else { | 351 | } else { |
354 | jffs2_free_raw_node_ref(raw); | 352 | jffs2_free_raw_node_ref(raw); |
355 | } | 353 | } |
356 | return rc; | 354 | return rc; |
357 | } | 355 | } |
358 | BUG_ON(raw->__totlen < sizeof(struct jffs2_raw_xattr)); | 356 | |
359 | /* success */ | 357 | /* success */ |
360 | raw->flash_offset |= REF_PRISTINE; | 358 | raw->flash_offset |= REF_PRISTINE; |
361 | jffs2_add_physical_node_ref(c, raw); | 359 | jffs2_add_physical_node_ref(c, raw, PAD(totlen)); |
362 | if (xd->node) | 360 | if (xd->node) |
363 | delete_xattr_datum_node(c, xd); | 361 | delete_xattr_datum_node(c, xd); |
364 | xd->node = raw; | 362 | xd->node = raw; |
@@ -568,8 +566,6 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref, | |||
568 | if (!raw) | 566 | if (!raw) |
569 | return -ENOMEM; | 567 | return -ENOMEM; |
570 | raw->flash_offset = phys_ofs; | 568 | raw->flash_offset = phys_ofs; |
571 | raw->__totlen = PAD(sizeof(rr)); | ||
572 | raw->next_phys = NULL; | ||
573 | raw->next_in_ino = (void *)ref; | 569 | raw->next_in_ino = (void *)ref; |
574 | 570 | ||
575 | rr.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); | 571 | rr.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); |
@@ -589,7 +585,7 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref, | |||
589 | if (length) { | 585 | if (length) { |
590 | raw->flash_offset |= REF_OBSOLETE; | 586 | raw->flash_offset |= REF_OBSOLETE; |
591 | raw->next_in_ino = NULL; | 587 | raw->next_in_ino = NULL; |
592 | jffs2_add_physical_node_ref(c, raw); | 588 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(rr))); |
593 | jffs2_mark_node_obsolete(c, raw); | 589 | jffs2_mark_node_obsolete(c, raw); |
594 | } else { | 590 | } else { |
595 | jffs2_free_raw_node_ref(raw); | 591 | jffs2_free_raw_node_ref(raw); |
@@ -598,7 +594,7 @@ static int save_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref, | |||
598 | } | 594 | } |
599 | raw->flash_offset |= REF_PRISTINE; | 595 | raw->flash_offset |= REF_PRISTINE; |
600 | 596 | ||
601 | jffs2_add_physical_node_ref(c, raw); | 597 | jffs2_add_physical_node_ref(c, raw, PAD(sizeof(rr))); |
602 | if (ref->node) | 598 | if (ref->node) |
603 | delete_xattr_ref_node(c, ref); | 599 | delete_xattr_ref_node(c, ref); |
604 | ref->node = raw; | 600 | ref->node = raw; |