diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-05-20 22:46:05 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-20 22:46:05 -0400 |
commit | 68270995f29f1a82b3eaab01df63ea7e721e2fa6 (patch) | |
tree | 44388152f209c9f8f0df8eec33efaaca7817ec6d /fs/jffs2/summary.c | |
parent | 7807ef7ba2a41c05f6197381f572dd38baa6c1ce (diff) |
[JFFS2] Introduce jffs2_scan_dirty_space() function.
To eliminate the __totlen field from struct jffs2_raw_node_ref, we need
to allocate nodes for dirty space instead of just tweaking the accounting
data. Introduce jffs2_scan_dirty_space() in preparation for that.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/summary.c')
-rw-r--r-- | fs/jffs2/summary.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c index 9ced3aa95818..11ea54c90f44 100644 --- a/fs/jffs2/summary.c +++ b/fs/jffs2/summary.c | |||
@@ -380,6 +380,7 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras | |||
380 | struct jffs2_full_dirent *fd; | 380 | struct jffs2_full_dirent *fd; |
381 | void *sp; | 381 | void *sp; |
382 | int i, ino; | 382 | int i, ino; |
383 | int err; | ||
383 | 384 | ||
384 | sp = summary->sum; | 385 | sp = summary->sum; |
385 | 386 | ||
@@ -494,7 +495,8 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras | |||
494 | jffs2_free_raw_node_ref(raw); | 495 | jffs2_free_raw_node_ref(raw); |
495 | if (PTR_ERR(xd) == -EEXIST) { | 496 | if (PTR_ERR(xd) == -EEXIST) { |
496 | /* a newer version of xd exists */ | 497 | /* a newer version of xd exists */ |
497 | DIRTY_SPACE(je32_to_cpu(spx->totlen)); | 498 | if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(spx->totlen)))) |
499 | return err; | ||
498 | sp += JFFS2_SUMMARY_XATTR_SIZE; | 500 | sp += JFFS2_SUMMARY_XATTR_SIZE; |
499 | break; | 501 | break; |
500 | } | 502 | } |
@@ -585,6 +587,7 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb | |||
585 | struct jffs2_raw_node_ref *cache_ref; | 587 | struct jffs2_raw_node_ref *cache_ref; |
586 | int ret, ofs; | 588 | int ret, ofs; |
587 | uint32_t crc; | 589 | uint32_t crc; |
590 | int err; | ||
588 | 591 | ||
589 | ofs = jeb->offset + c->sector_size - sumsize; | 592 | ofs = jeb->offset + c->sector_size - sumsize; |
590 | 593 | ||
@@ -629,11 +632,13 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb | |||
629 | if (je32_to_cpu(summary->cln_mkr) != c->cleanmarker_size) { | 632 | if (je32_to_cpu(summary->cln_mkr) != c->cleanmarker_size) { |
630 | dbg_summary("CLEANMARKER node has totlen 0x%x != normal 0x%x\n", | 633 | dbg_summary("CLEANMARKER node has totlen 0x%x != normal 0x%x\n", |
631 | je32_to_cpu(summary->cln_mkr), c->cleanmarker_size); | 634 | je32_to_cpu(summary->cln_mkr), c->cleanmarker_size); |
632 | DIRTY_SPACE(PAD(je32_to_cpu(summary->cln_mkr))); | 635 | if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(summary->cln_mkr))))) |
636 | return err; | ||
633 | } else if (jeb->first_node) { | 637 | } else if (jeb->first_node) { |
634 | dbg_summary("CLEANMARKER node not first node in block " | 638 | dbg_summary("CLEANMARKER node not first node in block " |
635 | "(0x%08x)\n", jeb->offset); | 639 | "(0x%08x)\n", jeb->offset); |
636 | DIRTY_SPACE(PAD(je32_to_cpu(summary->cln_mkr))); | 640 | if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(summary->cln_mkr))))) |
641 | return err; | ||
637 | } else { | 642 | } else { |
638 | struct jffs2_raw_node_ref *marker_ref = jffs2_alloc_raw_node_ref(); | 643 | struct jffs2_raw_node_ref *marker_ref = jffs2_alloc_raw_node_ref(); |
639 | 644 | ||
@@ -650,7 +655,8 @@ int jffs2_sum_scan_sumnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb | |||
650 | } | 655 | } |
651 | 656 | ||
652 | if (je32_to_cpu(summary->padded)) { | 657 | if (je32_to_cpu(summary->padded)) { |
653 | DIRTY_SPACE(je32_to_cpu(summary->padded)); | 658 | if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(summary->padded)))) |
659 | return err; | ||
654 | } | 660 | } |
655 | 661 | ||
656 | ret = jffs2_sum_process_sum_data(c, jeb, summary, pseudo_random); | 662 | ret = jffs2_sum_process_sum_data(c, jeb, summary, pseudo_random); |
@@ -823,7 +829,7 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock | |||
823 | infosize, jeb->offset + c->sector_size - jeb->free_size, ret, retlen); | 829 | infosize, jeb->offset + c->sector_size - jeb->free_size, ret, retlen); |
824 | 830 | ||
825 | c->summary->sum_size = JFFS2_SUMMARY_NOSUM_SIZE; | 831 | c->summary->sum_size = JFFS2_SUMMARY_NOSUM_SIZE; |
826 | DIRTY_SPACE(infosize); | 832 | jffs2_scan_dirty_space(c, jeb, infosize); |
827 | 833 | ||
828 | return 1; | 834 | return 1; |
829 | } | 835 | } |