aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/segment.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2/segment.c')
-rw-r--r--fs/nilfs2/segment.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 7ab0270b2629..f649f0189589 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -932,35 +932,6 @@ static void nilfs_segctor_fill_in_file_bmap(struct nilfs_sc_info *sci,
932 } 932 }
933} 933}
934 934
935/*
936 * CRC calculation routines
937 */
938static void nilfs_fill_in_super_root_crc(struct buffer_head *bh_sr, u32 seed)
939{
940 struct nilfs_super_root *raw_sr =
941 (struct nilfs_super_root *)bh_sr->b_data;
942 u32 crc;
943
944 crc = crc32_le(seed,
945 (unsigned char *)raw_sr + sizeof(raw_sr->sr_sum),
946 NILFS_SR_BYTES - sizeof(raw_sr->sr_sum));
947 raw_sr->sr_sum = cpu_to_le32(crc);
948}
949
950static void nilfs_segctor_fill_in_checksums(struct nilfs_sc_info *sci,
951 u32 seed)
952{
953 struct nilfs_segment_buffer *segbuf;
954
955 list_for_each_entry(segbuf, &sci->sc_segbufs, sb_list) {
956 if (segbuf->sb_super_root)
957 nilfs_fill_in_super_root_crc(segbuf->sb_super_root,
958 seed);
959 nilfs_segbuf_fill_in_segsum_crc(segbuf, seed);
960 nilfs_segbuf_fill_in_data_crc(segbuf, seed);
961 }
962}
963
964static void nilfs_segctor_fill_in_super_root(struct nilfs_sc_info *sci, 935static void nilfs_segctor_fill_in_super_root(struct nilfs_sc_info *sci,
965 struct the_nilfs *nilfs) 936 struct the_nilfs *nilfs)
966{ 937{
@@ -2174,7 +2145,9 @@ static int nilfs_segctor_do_construct(struct nilfs_sc_info *sci, int mode)
2174 nilfs_abort_logs(&sci->sc_segbufs, failed_page, err); 2145 nilfs_abort_logs(&sci->sc_segbufs, failed_page, err);
2175 goto failed_to_write; 2146 goto failed_to_write;
2176 } 2147 }
2177 nilfs_segctor_fill_in_checksums(sci, nilfs->ns_crc_seed); 2148
2149 nilfs_add_checksums_on_logs(&sci->sc_segbufs,
2150 nilfs->ns_crc_seed);
2178 2151
2179 err = nilfs_segctor_write(sci, nilfs); 2152 err = nilfs_segctor_write(sci, nilfs);
2180 if (unlikely(err)) 2153 if (unlikely(err))