aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/summary.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/summary.c')
-rw-r--r--fs/jffs2/summary.c71
1 files changed, 15 insertions, 56 deletions
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}