diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-05-20 14:45:26 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-20 14:45:26 -0400 |
commit | f1f9671bd8f7d2ac6a918bad806ab5bdc0daaf4e (patch) | |
tree | f1fb5992fbd299375c911eb4c36d7fc8774f9208 | |
parent | 0cfc7da3ff4b39a3aac261ab3f6b1329e2485653 (diff) |
[JFFS2] Introduce jffs2_link_node_ref() function to reduce code duplication
The same sequence of code was repeated in many places, to add a new
struct jffs2_raw_node_ref to an eraseblock and adjust the space accounting
accordingly. Move it out-of-line.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
-rw-r--r-- | fs/jffs2/erase.c | 18 | ||||
-rw-r--r-- | fs/jffs2/nodelist.c | 34 | ||||
-rw-r--r-- | fs/jffs2/nodelist.h | 2 | ||||
-rw-r--r-- | fs/jffs2/nodemgmt.c | 16 | ||||
-rw-r--r-- | fs/jffs2/scan.c | 49 | ||||
-rw-r--r-- | fs/jffs2/summary.c | 71 |
6 files changed, 68 insertions, 122 deletions
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c index dad68fdffe9e..fecf5584f830 100644 --- a/fs/jffs2/erase.c +++ b/fs/jffs2/erase.c | |||
@@ -373,12 +373,8 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb | |||
373 | goto filebad; | 373 | goto filebad; |
374 | } | 374 | } |
375 | 375 | ||
376 | jeb->first_node = jeb->last_node = NULL; | 376 | /* Everything else got zeroed before the erase */ |
377 | jeb->free_size = c->sector_size; | 377 | jeb->free_size = c->sector_size; |
378 | jeb->used_size = 0; | ||
379 | jeb->dirty_size = 0; | ||
380 | jeb->wasted_size = 0; | ||
381 | |||
382 | } else { | 378 | } else { |
383 | 379 | ||
384 | struct kvec vecs[1]; | 380 | struct kvec vecs[1]; |
@@ -412,17 +408,13 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb | |||
412 | goto filebad; | 408 | goto filebad; |
413 | } | 409 | } |
414 | 410 | ||
411 | /* Everything else got zeroed before the erase */ | ||
412 | jeb->free_size = c->sector_size; | ||
413 | |||
415 | marker_ref->next_in_ino = NULL; | 414 | marker_ref->next_in_ino = NULL; |
416 | marker_ref->next_phys = NULL; | ||
417 | marker_ref->flash_offset = jeb->offset | REF_NORMAL; | 415 | marker_ref->flash_offset = jeb->offset | REF_NORMAL; |
418 | marker_ref->__totlen = c->cleanmarker_size; | ||
419 | |||
420 | jeb->first_node = jeb->last_node = marker_ref; | ||
421 | 416 | ||
422 | jeb->free_size = c->sector_size - c->cleanmarker_size; | 417 | jffs2_link_node_ref(c, jeb, marker_ref, c->cleanmarker_size); |
423 | jeb->used_size = c->cleanmarker_size; | ||
424 | jeb->dirty_size = 0; | ||
425 | jeb->wasted_size = 0; | ||
426 | } | 418 | } |
427 | 419 | ||
428 | spin_lock(&c->erase_completion_lock); | 420 | spin_lock(&c->erase_completion_lock); |
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c index 4973cd648ba8..1fc8aedb56fb 100644 --- a/fs/jffs2/nodelist.c +++ b/fs/jffs2/nodelist.c | |||
@@ -1046,3 +1046,37 @@ void jffs2_kill_fragtree(struct rb_root *root, struct jffs2_sb_info *c) | |||
1046 | cond_resched(); | 1046 | cond_resched(); |
1047 | } | 1047 | } |
1048 | } | 1048 | } |
1049 | |||
1050 | void jffs2_link_node_ref(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, | ||
1051 | struct jffs2_raw_node_ref *ref, uint32_t len) | ||
1052 | { | ||
1053 | if (!jeb->first_node) | ||
1054 | jeb->first_node = ref; | ||
1055 | if (jeb->last_node) | ||
1056 | jeb->last_node->next_phys = ref; | ||
1057 | jeb->last_node = ref; | ||
1058 | |||
1059 | switch(ref_flags(ref)) { | ||
1060 | case REF_UNCHECKED: | ||
1061 | c->unchecked_size += len; | ||
1062 | jeb->unchecked_size += len; | ||
1063 | break; | ||
1064 | |||
1065 | case REF_NORMAL: | ||
1066 | case REF_PRISTINE: | ||
1067 | c->used_size += len; | ||
1068 | jeb->used_size += len; | ||
1069 | break; | ||
1070 | |||
1071 | case REF_OBSOLETE: | ||
1072 | c->dirty_size += len; | ||
1073 | jeb->used_size += len; | ||
1074 | break; | ||
1075 | } | ||
1076 | c->free_size -= len; | ||
1077 | jeb->free_size -= len; | ||
1078 | |||
1079 | /* Set __totlen field... for now */ | ||
1080 | ref->__totlen = len; | ||
1081 | ref->next_phys = NULL; | ||
1082 | } | ||
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h index 8dda98ff5561..bac4ec35bbd0 100644 --- a/fs/jffs2/nodelist.h +++ b/fs/jffs2/nodelist.h | |||
@@ -348,6 +348,8 @@ void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *t | |||
348 | int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_full_dnode *fn); | 348 | int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_full_dnode *fn); |
349 | void jffs2_truncate_fragtree (struct jffs2_sb_info *c, struct rb_root *list, uint32_t size); | 349 | void jffs2_truncate_fragtree (struct jffs2_sb_info *c, struct rb_root *list, uint32_t size); |
350 | int jffs2_add_older_frag_to_fragtree(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_tmp_dnode_info *tn); | 350 | int jffs2_add_older_frag_to_fragtree(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_tmp_dnode_info *tn); |
351 | void jffs2_link_node_ref(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, | ||
352 | struct jffs2_raw_node_ref *ref, uint32_t len); | ||
351 | 353 | ||
352 | /* nodemgmt.c */ | 354 | /* nodemgmt.c */ |
353 | int jffs2_thread_should_wake(struct jffs2_sb_info *c); | 355 | int jffs2_thread_should_wake(struct jffs2_sb_info *c); |
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c index 0e1f58aa606c..d6eab1b7ad53 100644 --- a/fs/jffs2/nodemgmt.c +++ b/fs/jffs2/nodemgmt.c | |||
@@ -403,21 +403,7 @@ int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_r | |||
403 | #endif | 403 | #endif |
404 | spin_lock(&c->erase_completion_lock); | 404 | spin_lock(&c->erase_completion_lock); |
405 | 405 | ||
406 | if (!jeb->first_node) | 406 | jffs2_link_node_ref(c, jeb, new, len); |
407 | jeb->first_node = new; | ||
408 | if (jeb->last_node) | ||
409 | jeb->last_node->next_phys = new; | ||
410 | jeb->last_node = new; | ||
411 | |||
412 | jeb->free_size -= len; | ||
413 | c->free_size -= len; | ||
414 | if (ref_obsolete(new)) { | ||
415 | jeb->dirty_size += len; | ||
416 | c->dirty_size += len; | ||
417 | } else { | ||
418 | jeb->used_size += len; | ||
419 | c->used_size += len; | ||
420 | } | ||
421 | 407 | ||
422 | if (!jeb->free_size && !jeb->dirty_size && !ISDIRTY(jeb->wasted_size)) { | 408 | if (!jeb->free_size && !jeb->dirty_size && !ISDIRTY(jeb->wasted_size)) { |
423 | /* If it lives on the dirty_list, jffs2_reserve_space will put it there */ | 409 | /* If it lives on the dirty_list, jffs2_reserve_space will put it there */ |
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 40d62d057aa4..3cbe9f029e01 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c | |||
@@ -351,17 +351,11 @@ static int jffs2_scan_xattr_node(struct jffs2_sb_info *c, struct jffs2_erasebloc | |||
351 | xd->data_crc = je32_to_cpu(rx->data_crc); | 351 | xd->data_crc = je32_to_cpu(rx->data_crc); |
352 | xd->node = raw; | 352 | xd->node = raw; |
353 | 353 | ||
354 | raw->__totlen = totlen; | ||
355 | raw->flash_offset = ofs | REF_PRISTINE; | 354 | raw->flash_offset = ofs | REF_PRISTINE; |
356 | raw->next_phys = NULL; | ||
357 | raw->next_in_ino = (void *)xd; | 355 | raw->next_in_ino = (void *)xd; |
358 | if (!jeb->first_node) | ||
359 | jeb->first_node = raw; | ||
360 | if (jeb->last_node) | ||
361 | jeb->last_node->next_phys = raw; | ||
362 | jeb->last_node = raw; | ||
363 | 356 | ||
364 | USED_SPACE(PAD(je32_to_cpu(rx->totlen))); | 357 | jffs2_link_node_ref(c, jeb, raw, totlen); |
358 | |||
365 | if (jffs2_sum_active()) | 359 | if (jffs2_sum_active()) |
366 | jffs2_sum_add_xattr_mem(s, rx, ofs - jeb->offset); | 360 | jffs2_sum_add_xattr_mem(s, rx, ofs - jeb->offset); |
367 | dbg_xattr("scaning xdatum at %#08x (xid=%u, version=%u)\n", | 361 | dbg_xattr("scaning xdatum at %#08x (xid=%u, version=%u)\n", |
@@ -418,17 +412,11 @@ static int jffs2_scan_xref_node(struct jffs2_sb_info *c, struct jffs2_eraseblock | |||
418 | ref->next = c->xref_temp; | 412 | ref->next = c->xref_temp; |
419 | c->xref_temp = ref; | 413 | c->xref_temp = ref; |
420 | 414 | ||
421 | raw->__totlen = PAD(je32_to_cpu(rr->totlen)); | ||
422 | raw->flash_offset = ofs | REF_PRISTINE; | 415 | raw->flash_offset = ofs | REF_PRISTINE; |
423 | raw->next_phys = NULL; | ||
424 | raw->next_in_ino = (void *)ref; | 416 | raw->next_in_ino = (void *)ref; |
425 | if (!jeb->first_node) | ||
426 | jeb->first_node = raw; | ||
427 | if (jeb->last_node) | ||
428 | jeb->last_node->next_phys = raw; | ||
429 | jeb->last_node = raw; | ||
430 | 417 | ||
431 | USED_SPACE(PAD(je32_to_cpu(rr->totlen))); | 418 | jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(rr->totlen))); |
419 | |||
432 | if (jffs2_sum_active()) | 420 | if (jffs2_sum_active()) |
433 | jffs2_sum_add_xref_mem(s, rr, ofs - jeb->offset); | 421 | jffs2_sum_add_xref_mem(s, rr, ofs - jeb->offset); |
434 | dbg_xattr("scan xref at %#08x (xid=%u, ino=%u)\n", | 422 | dbg_xattr("scan xref at %#08x (xid=%u, ino=%u)\n", |
@@ -827,12 +815,10 @@ scan_more: | |||
827 | return -ENOMEM; | 815 | return -ENOMEM; |
828 | } | 816 | } |
829 | marker_ref->next_in_ino = NULL; | 817 | marker_ref->next_in_ino = NULL; |
830 | marker_ref->next_phys = NULL; | ||
831 | marker_ref->flash_offset = ofs | REF_NORMAL; | 818 | marker_ref->flash_offset = ofs | REF_NORMAL; |
832 | marker_ref->__totlen = c->cleanmarker_size; | ||
833 | jeb->first_node = jeb->last_node = marker_ref; | ||
834 | 819 | ||
835 | USED_SPACE(PAD(c->cleanmarker_size)); | 820 | jffs2_link_node_ref(c, jeb, marker_ref, c->cleanmarker_size); |
821 | |||
836 | ofs += PAD(c->cleanmarker_size); | 822 | ofs += PAD(c->cleanmarker_size); |
837 | } | 823 | } |
838 | break; | 824 | break; |
@@ -971,16 +957,11 @@ static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_erasebloc | |||
971 | /* Wheee. It worked */ | 957 | /* Wheee. It worked */ |
972 | 958 | ||
973 | raw->flash_offset = ofs | REF_UNCHECKED; | 959 | raw->flash_offset = ofs | REF_UNCHECKED; |
974 | raw->__totlen = PAD(je32_to_cpu(ri->totlen)); | ||
975 | raw->next_phys = NULL; | ||
976 | raw->next_in_ino = ic->nodes; | ||
977 | 960 | ||
961 | raw->next_in_ino = ic->nodes; | ||
978 | ic->nodes = raw; | 962 | ic->nodes = raw; |
979 | if (!jeb->first_node) | 963 | |
980 | jeb->first_node = raw; | 964 | jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(ri->totlen))); |
981 | if (jeb->last_node) | ||
982 | jeb->last_node->next_phys = raw; | ||
983 | jeb->last_node = raw; | ||
984 | 965 | ||
985 | D1(printk(KERN_DEBUG "Node is ino #%u, version %d. Range 0x%x-0x%x\n", | 966 | D1(printk(KERN_DEBUG "Node is ino #%u, version %d. Range 0x%x-0x%x\n", |
986 | je32_to_cpu(ri->ino), je32_to_cpu(ri->version), | 967 | je32_to_cpu(ri->ino), je32_to_cpu(ri->version), |
@@ -989,8 +970,6 @@ static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_erasebloc | |||
989 | 970 | ||
990 | pseudo_random += je32_to_cpu(ri->version); | 971 | pseudo_random += je32_to_cpu(ri->version); |
991 | 972 | ||
992 | UNCHECKED_SPACE(PAD(je32_to_cpu(ri->totlen))); | ||
993 | |||
994 | if (jffs2_sum_active()) { | 973 | if (jffs2_sum_active()) { |
995 | jffs2_sum_add_inode_mem(s, ri, ofs - jeb->offset); | 974 | jffs2_sum_add_inode_mem(s, ri, ofs - jeb->offset); |
996 | } | 975 | } |
@@ -1053,16 +1032,11 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo | |||
1053 | return -ENOMEM; | 1032 | return -ENOMEM; |
1054 | } | 1033 | } |
1055 | 1034 | ||
1056 | raw->__totlen = PAD(je32_to_cpu(rd->totlen)); | ||
1057 | raw->flash_offset = ofs | REF_PRISTINE; | 1035 | raw->flash_offset = ofs | REF_PRISTINE; |
1058 | raw->next_phys = NULL; | ||
1059 | raw->next_in_ino = ic->nodes; | 1036 | raw->next_in_ino = ic->nodes; |
1060 | ic->nodes = raw; | 1037 | ic->nodes = raw; |
1061 | if (!jeb->first_node) | 1038 | |
1062 | jeb->first_node = raw; | 1039 | jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(rd->totlen))); |
1063 | if (jeb->last_node) | ||
1064 | jeb->last_node->next_phys = raw; | ||
1065 | jeb->last_node = raw; | ||
1066 | 1040 | ||
1067 | fd->raw = raw; | 1041 | fd->raw = raw; |
1068 | fd->next = NULL; | 1042 | fd->next = NULL; |
@@ -1070,7 +1044,6 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo | |||
1070 | fd->ino = je32_to_cpu(rd->ino); | 1044 | fd->ino = je32_to_cpu(rd->ino); |
1071 | fd->nhash = full_name_hash(fd->name, rd->nsize); | 1045 | fd->nhash = full_name_hash(fd->name, rd->nsize); |
1072 | fd->type = rd->type; | 1046 | fd->type = rd->type; |
1073 | USED_SPACE(PAD(je32_to_cpu(rd->totlen))); | ||
1074 | jffs2_add_fd_to_list(c, fd, &ic->scan_dents); | 1047 | jffs2_add_fd_to_list(c, fd, &ic->scan_dents); |
1075 | 1048 | ||
1076 | if (jffs2_sum_active()) { | 1049 | if (jffs2_sum_active()) { |
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c index 5dbe87b67ab6..912189762323 100644 --- a/fs/jffs2/summary.c +++ b/fs/jffs2/summary.c | |||
@@ -410,19 +410,13 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras | |||
410 | } | 410 | } |
411 | 411 | ||
412 | raw->flash_offset = (jeb->offset + je32_to_cpu(spi->offset)) | REF_UNCHECKED; | 412 | raw->flash_offset = (jeb->offset + je32_to_cpu(spi->offset)) | REF_UNCHECKED; |
413 | raw->__totlen = PAD(je32_to_cpu(spi->totlen)); | ||
414 | raw->next_phys = NULL; | ||
415 | raw->next_in_ino = ic->nodes; | ||
416 | 413 | ||
414 | raw->next_in_ino = ic->nodes; | ||
417 | ic->nodes = raw; | 415 | ic->nodes = raw; |
418 | if (!jeb->first_node) | ||
419 | jeb->first_node = raw; | ||
420 | if (jeb->last_node) | ||
421 | jeb->last_node->next_phys = raw; | ||
422 | jeb->last_node = raw; | ||
423 | *pseudo_random += je32_to_cpu(spi->version); | ||
424 | 416 | ||
425 | UNCHECKED_SPACE(PAD(je32_to_cpu(spi->totlen))); | 417 | jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spi->totlen))); |
418 | |||
419 | *pseudo_random += je32_to_cpu(spi->version); | ||
426 | 420 | ||
427 | sp += JFFS2_SUMMARY_INODE_SIZE; | 421 | sp += JFFS2_SUMMARY_INODE_SIZE; |
428 | 422 | ||
@@ -457,16 +451,11 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras | |||
457 | return -ENOMEM; | 451 | return -ENOMEM; |
458 | } | 452 | } |
459 | 453 | ||
460 | raw->__totlen = PAD(je32_to_cpu(spd->totlen)); | ||
461 | raw->flash_offset = (jeb->offset + je32_to_cpu(spd->offset)) | REF_PRISTINE; | 454 | raw->flash_offset = (jeb->offset + je32_to_cpu(spd->offset)) | REF_PRISTINE; |
462 | raw->next_phys = NULL; | ||
463 | raw->next_in_ino = ic->nodes; | 455 | raw->next_in_ino = ic->nodes; |
464 | ic->nodes = raw; | 456 | ic->nodes = raw; |
465 | if (!jeb->first_node) | 457 | |
466 | jeb->first_node = raw; | 458 | jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spd->totlen))); |
467 | if (jeb->last_node) | ||
468 | jeb->last_node->next_phys = raw; | ||
469 | jeb->last_node = raw; | ||
470 | 459 | ||
471 | fd->raw = raw; | 460 | fd->raw = raw; |
472 | fd->next = NULL; | 461 | fd->next = NULL; |
@@ -474,7 +463,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras | |||
474 | fd->ino = je32_to_cpu(spd->ino); | 463 | fd->ino = je32_to_cpu(spd->ino); |
475 | fd->nhash = full_name_hash(fd->name, spd->nsize); | 464 | fd->nhash = full_name_hash(fd->name, spd->nsize); |
476 | fd->type = spd->type; | 465 | fd->type = spd->type; |
477 | USED_SPACE(PAD(je32_to_cpu(spd->totlen))); | 466 | |
478 | jffs2_add_fd_to_list(c, fd, &ic->scan_dents); | 467 | jffs2_add_fd_to_list(c, fd, &ic->scan_dents); |
479 | 468 | ||
480 | *pseudo_random += je32_to_cpu(spd->version); | 469 | *pseudo_random += je32_to_cpu(spd->version); |
@@ -516,17 +505,11 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras | |||
516 | xd->node = raw; | 505 | xd->node = raw; |
517 | 506 | ||
518 | raw->flash_offset = ofs | REF_UNCHECKED; | 507 | raw->flash_offset = ofs | REF_UNCHECKED; |
519 | raw->__totlen = PAD(je32_to_cpu(spx->totlen)); | ||
520 | raw->next_phys = NULL; | ||
521 | raw->next_in_ino = (void *)xd; | 508 | raw->next_in_ino = (void *)xd; |
522 | if (!jeb->first_node) | 509 | |
523 | jeb->first_node = raw; | 510 | jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spx->totlen))); |
524 | if (jeb->last_node) | ||
525 | jeb->last_node->next_phys = raw; | ||
526 | jeb->last_node = raw; | ||
527 | 511 | ||
528 | *pseudo_random += je32_to_cpu(spx->xid); | 512 | *pseudo_random += je32_to_cpu(spx->xid); |
529 | UNCHECKED_SPACE(je32_to_cpu(spx->totlen)); | ||
530 | sp += JFFS2_SUMMARY_XATTR_SIZE; | 513 | sp += JFFS2_SUMMARY_XATTR_SIZE; |
531 | 514 | ||
532 | break; | 515 | break; |
@@ -559,17 +542,11 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras | |||
559 | ref->next = c->xref_temp; | 542 | ref->next = c->xref_temp; |
560 | c->xref_temp = ref; | 543 | c->xref_temp = ref; |
561 | 544 | ||
562 | raw->__totlen = PAD(sizeof(struct jffs2_raw_xref)); | ||
563 | raw->flash_offset = ofs | REF_UNCHECKED; | 545 | raw->flash_offset = ofs | REF_UNCHECKED; |
564 | raw->next_phys = NULL; | ||
565 | raw->next_in_ino = (void *)ref; | 546 | raw->next_in_ino = (void *)ref; |
566 | if (!jeb->first_node) | ||
567 | jeb->first_node = raw; | ||
568 | if (jeb->last_node) | ||
569 | jeb->last_node->next_phys = raw; | ||
570 | jeb->last_node = raw; | ||
571 | 547 | ||
572 | UNCHECKED_SPACE(PAD(sizeof(struct jffs2_raw_xref))); | 548 | jffs2_link_node_ref(c, jeb, raw, PAD(sizeof(struct jffs2_raw_xref))); |
549 | |||
573 | *pseudo_random += ofs; | 550 | *pseudo_random += ofs; |
574 | sp += JFFS2_SUMMARY_XREF_SIZE; | 551 | sp += JFFS2_SUMMARY_XREF_SIZE; |
575 | 552 | ||
@@ -653,13 +630,10 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb | |||
653 | return -ENOMEM; | 630 | return -ENOMEM; |
654 | } | 631 | } |
655 | 632 | ||
656 | marker_ref->next_in_ino = NULL; | ||
657 | marker_ref->next_phys = NULL; | ||
658 | marker_ref->flash_offset = jeb->offset | REF_NORMAL; | 633 | marker_ref->flash_offset = jeb->offset | REF_NORMAL; |
659 | marker_ref->__totlen = je32_to_cpu(summary->cln_mkr); | 634 | marker_ref->next_in_ino = NULL; |
660 | jeb->first_node = jeb->last_node = marker_ref; | ||
661 | 635 | ||
662 | USED_SPACE( PAD(je32_to_cpu(summary->cln_mkr)) ); | 636 | jffs2_link_node_ref(c, jeb, marker_ref, je32_to_cpu(summary->cln_mkr)); |
663 | } | 637 | } |
664 | } | 638 | } |
665 | 639 | ||
@@ -682,15 +656,8 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb | |||
682 | cache_ref->next_in_ino = NULL; | 656 | cache_ref->next_in_ino = NULL; |
683 | cache_ref->next_phys = NULL; | 657 | cache_ref->next_phys = NULL; |
684 | cache_ref->flash_offset = ofs | REF_NORMAL; | 658 | cache_ref->flash_offset = ofs | REF_NORMAL; |
685 | cache_ref->__totlen = sumsize; | ||
686 | |||
687 | if (!jeb->first_node) | ||
688 | jeb->first_node = cache_ref; | ||
689 | if (jeb->last_node) | ||
690 | jeb->last_node->next_phys = cache_ref; | ||
691 | jeb->last_node = cache_ref; | ||
692 | 659 | ||
693 | USED_SPACE(sumsize); | 660 | jffs2_link_node_ref(c, jeb, cache_ref, sumsize); |
694 | 661 | ||
695 | jeb->wasted_size += jeb->free_size; | 662 | jeb->wasted_size += jeb->free_size; |
696 | c->wasted_size += jeb->free_size; | 663 | c->wasted_size += jeb->free_size; |
@@ -888,17 +855,9 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c) | |||
888 | } | 855 | } |
889 | 856 | ||
890 | summary_ref->next_in_ino = NULL; | 857 | summary_ref->next_in_ino = NULL; |
891 | summary_ref->next_phys = NULL; | ||
892 | summary_ref->flash_offset = (jeb->offset + c->sector_size - jeb->free_size) | REF_NORMAL; | 858 | summary_ref->flash_offset = (jeb->offset + c->sector_size - jeb->free_size) | REF_NORMAL; |
893 | summary_ref->__totlen = infosize; | ||
894 | |||
895 | if (!jeb->first_node) | ||
896 | jeb->first_node = summary_ref; | ||
897 | if (jeb->last_node) | ||
898 | jeb->last_node->next_phys = summary_ref; | ||
899 | jeb->last_node = summary_ref; | ||
900 | 859 | ||
901 | USED_SPACE(infosize); | 860 | jffs2_link_node_ref(c, jeb, summary_ref, infosize); |
902 | 861 | ||
903 | return 0; | 862 | return 0; |
904 | } | 863 | } |