diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-03-22 12:50:38 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-05-09 22:32:30 -0400 |
commit | aaed1d5bfac459ead9aaad324e7fe3326250f50a (patch) | |
tree | 389f305354db9a45a482ff38e5f0ffab030c76bd /fs/nilfs2/segment.c | |
parent | 1e2b68bf285dce604388fcb6f85b7e612156db17 (diff) |
nilfs2: move out checksum routines to segment buffer code
This moves out checksum routines in log writer to segbuf.c for
cleanup.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/segment.c')
-rw-r--r-- | fs/nilfs2/segment.c | 33 |
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 | */ | ||
938 | static 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 | |||
950 | static 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 | |||
964 | static void nilfs_segctor_fill_in_super_root(struct nilfs_sc_info *sci, | 935 | static 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)) |