aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/segbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2/segbuf.c')
-rw-r--r--fs/nilfs2/segbuf.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c
index a24ca9cc6afb..6bf3b1f3406e 100644
--- a/fs/nilfs2/segbuf.c
+++ b/fs/nilfs2/segbuf.c
@@ -202,8 +202,8 @@ void nilfs_segbuf_fill_in_segsum(struct nilfs_segment_buffer *segbuf)
202/* 202/*
203 * CRC calculation routines 203 * CRC calculation routines
204 */ 204 */
205void nilfs_segbuf_fill_in_segsum_crc(struct nilfs_segment_buffer *segbuf, 205static void
206 u32 seed) 206nilfs_segbuf_fill_in_segsum_crc(struct nilfs_segment_buffer *segbuf, u32 seed)
207{ 207{
208 struct buffer_head *bh; 208 struct buffer_head *bh;
209 struct nilfs_segment_summary *raw_sum; 209 struct nilfs_segment_summary *raw_sum;
@@ -230,8 +230,8 @@ void nilfs_segbuf_fill_in_segsum_crc(struct nilfs_segment_buffer *segbuf,
230 raw_sum->ss_sumsum = cpu_to_le32(crc); 230 raw_sum->ss_sumsum = cpu_to_le32(crc);
231} 231}
232 232
233void nilfs_segbuf_fill_in_data_crc(struct nilfs_segment_buffer *segbuf, 233static void nilfs_segbuf_fill_in_data_crc(struct nilfs_segment_buffer *segbuf,
234 u32 seed) 234 u32 seed)
235{ 235{
236 struct buffer_head *bh; 236 struct buffer_head *bh;
237 struct nilfs_segment_summary *raw_sum; 237 struct nilfs_segment_summary *raw_sum;
@@ -257,6 +257,20 @@ void nilfs_segbuf_fill_in_data_crc(struct nilfs_segment_buffer *segbuf,
257 raw_sum->ss_datasum = cpu_to_le32(crc); 257 raw_sum->ss_datasum = cpu_to_le32(crc);
258} 258}
259 259
260static void
261nilfs_segbuf_fill_in_super_root_crc(struct nilfs_segment_buffer *segbuf,
262 u32 seed)
263{
264 struct nilfs_super_root *raw_sr;
265 u32 crc;
266
267 raw_sr = (struct nilfs_super_root *)segbuf->sb_super_root->b_data;
268 crc = crc32_le(seed,
269 (unsigned char *)raw_sr + sizeof(raw_sr->sr_sum),
270 NILFS_SR_BYTES - sizeof(raw_sr->sr_sum));
271 raw_sr->sr_sum = cpu_to_le32(crc);
272}
273
260static void nilfs_release_buffers(struct list_head *list) 274static void nilfs_release_buffers(struct list_head *list)
261{ 275{
262 struct buffer_head *bh, *n; 276 struct buffer_head *bh, *n;
@@ -336,6 +350,23 @@ int nilfs_wait_on_logs(struct list_head *logs)
336 return ret; 350 return ret;
337} 351}
338 352
353/**
354 * nilfs_add_checksums_on_logs - add checksums on the logs
355 * @logs: list of segment buffers storing target logs
356 * @seed: checksum seed value
357 */
358void nilfs_add_checksums_on_logs(struct list_head *logs, u32 seed)
359{
360 struct nilfs_segment_buffer *segbuf;
361
362 list_for_each_entry(segbuf, logs, sb_list) {
363 if (segbuf->sb_super_root)
364 nilfs_segbuf_fill_in_super_root_crc(segbuf, seed);
365 nilfs_segbuf_fill_in_segsum_crc(segbuf, seed);
366 nilfs_segbuf_fill_in_data_crc(segbuf, seed);
367 }
368}
369
339/* 370/*
340 * BIO operations 371 * BIO operations
341 */ 372 */