aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/summary.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-05-22 10:23:10 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-05-22 10:23:10 -0400
commitfcb7578719529898aef9edce8e409e457a1c2d15 (patch)
tree58022b22d175b69e4b267f2f19ab26d93f7d4910 /fs/jffs2/summary.c
parenta1b563d652b54647ffacb2d6edf7859d3e97a723 (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/summary.c')
-rw-r--r--fs/jffs2/summary.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c
index 1451732e1fa7..351ba9f8185e 100644
--- a/fs/jffs2/summary.c
+++ b/fs/jffs2/summary.c
@@ -430,10 +430,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
430 430
431 raw->flash_offset |= REF_UNCHECKED; 431 raw->flash_offset |= REF_UNCHECKED;
432 432
433 raw->next_in_ino = ic->nodes; 433 jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spi->totlen)), ic);
434 ic->nodes = raw;
435
436 jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spi->totlen)));
437 434
438 *pseudo_random += je32_to_cpu(spi->version); 435 *pseudo_random += je32_to_cpu(spi->version);
439 436
@@ -473,10 +470,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
473 } 470 }
474 471
475 raw->flash_offset |= REF_PRISTINE; 472 raw->flash_offset |= REF_PRISTINE;
476 raw->next_in_ino = ic->nodes; 473 jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spd->totlen)), ic);
477 ic->nodes = raw;
478
479 jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spd->totlen)));
480 474
481 fd->raw = raw; 475 fd->raw = raw;
482 fd->next = NULL; 476 fd->next = NULL;
@@ -525,9 +519,9 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
525 xd->node = raw; 519 xd->node = raw;
526 520
527 raw->flash_offset |= REF_UNCHECKED; 521 raw->flash_offset |= REF_UNCHECKED;
528 raw->next_in_ino = (void *)xd;
529 522
530 jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spx->totlen))); 523 jffs2_link_node_ref(c, jeb, raw, PAD(je32_to_cpu(spx->totlen)), NULL);
524 /* FIXME */ raw->next_in_ino = (void *)xd;
531 525
532 *pseudo_random += je32_to_cpu(spx->xid); 526 *pseudo_random += je32_to_cpu(spx->xid);
533 sp += JFFS2_SUMMARY_XATTR_SIZE; 527 sp += JFFS2_SUMMARY_XATTR_SIZE;
@@ -561,9 +555,9 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
561 c->xref_temp = ref; 555 c->xref_temp = ref;
562 556
563 raw->flash_offset |= REF_UNCHECKED; 557 raw->flash_offset |= REF_UNCHECKED;
564 raw->next_in_ino = (void *)ref;
565 558
566 jffs2_link_node_ref(c, jeb, raw, PAD(sizeof(struct jffs2_raw_xref))); 559 jffs2_link_node_ref(c, jeb, raw, PAD(sizeof(struct jffs2_raw_xref)), NULL);
560 /* FIXME */ raw->next_in_ino = (void *)ref;
567 561
568 *pseudo_random += raw->flash_offset; 562 *pseudo_random += raw->flash_offset;
569 sp += JFFS2_SUMMARY_XREF_SIZE; 563 sp += JFFS2_SUMMARY_XREF_SIZE;
@@ -664,9 +658,8 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb
664 } 658 }
665 659
666 marker_ref->flash_offset = jeb->offset | REF_NORMAL; 660 marker_ref->flash_offset = jeb->offset | REF_NORMAL;
667 marker_ref->next_in_ino = NULL;
668 661
669 jffs2_link_node_ref(c, jeb, marker_ref, je32_to_cpu(summary->cln_mkr)); 662 jffs2_link_node_ref(c, jeb, marker_ref, je32_to_cpu(summary->cln_mkr), NULL);
670 } 663 }
671 } 664 }
672 665
@@ -686,10 +679,9 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb
686 return -ENOMEM; 679 return -ENOMEM;
687 } 680 }
688 681
689 cache_ref->next_in_ino = NULL;
690 cache_ref->flash_offset |= REF_NORMAL; 682 cache_ref->flash_offset |= REF_NORMAL;
691 683
692 jffs2_link_node_ref(c, jeb, cache_ref, sumsize); 684 jffs2_link_node_ref(c, jeb, cache_ref, sumsize, NULL);
693 685
694 if (unlikely(jeb->free_size)) { 686 if (unlikely(jeb->free_size)) {
695 JFFS2_WARNING("Free size 0x%x bytes in eraseblock @0x%08x with summary?\n", 687 JFFS2_WARNING("Free size 0x%x bytes in eraseblock @0x%08x with summary?\n",
@@ -849,9 +841,8 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock
849 841
850 ref->flash_offset = jeb->offset + c->sector_size - jeb->free_size; 842 ref->flash_offset = jeb->offset + c->sector_size - jeb->free_size;
851 ref->flash_offset |= REF_OBSOLETE; 843 ref->flash_offset |= REF_OBSOLETE;
852 ref->next_in_ino = 0;
853 844
854 jffs2_link_node_ref(c, jeb, ref, c->sector_size - jeb->free_size); 845 jffs2_link_node_ref(c, jeb, ref, c->sector_size - jeb->free_size, NULL);
855 } 846 }
856 847
857 c->summary->sum_size = JFFS2_SUMMARY_NOSUM_SIZE; 848 c->summary->sum_size = JFFS2_SUMMARY_NOSUM_SIZE;
@@ -909,11 +900,10 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c)
909 return -ENOMEM; 900 return -ENOMEM;
910 } 901 }
911 902
912 summary_ref->next_in_ino = NULL;
913 summary_ref->flash_offset = (jeb->offset + c->sector_size - jeb->free_size) | REF_NORMAL; 903 summary_ref->flash_offset = (jeb->offset + c->sector_size - jeb->free_size) | REF_NORMAL;
914 904
915 spin_lock(&c->erase_completion_lock); 905 spin_lock(&c->erase_completion_lock);
916 jffs2_link_node_ref(c, jeb, summary_ref, infosize); 906 jffs2_link_node_ref(c, jeb, summary_ref, infosize, NULL);
917 907
918 return 0; 908 return 0;
919} 909}