Lines Matching refs:nilfs
92 static int nilfs_compute_checksum(struct the_nilfs *nilfs, in nilfs_compute_checksum() argument
97 unsigned int blocksize = nilfs->ns_blocksize; in nilfs_compute_checksum()
104 crc = crc32_le(nilfs->ns_crc_seed, in nilfs_compute_checksum()
110 bh = __bread(nilfs->ns_bdev, ++start, blocksize); in nilfs_compute_checksum()
130 int nilfs_read_super_root_block(struct the_nilfs *nilfs, sector_t sr_block, in nilfs_read_super_root_block() argument
139 bh_sr = __bread(nilfs->ns_bdev, sr_block, nilfs->ns_blocksize); in nilfs_read_super_root_block()
149 if (bytes == 0 || bytes > nilfs->ns_blocksize) { in nilfs_read_super_root_block()
154 nilfs, bh_sr, &crc, sizeof(sr->sr_sum), bytes, in nilfs_read_super_root_block()
171 return nilfs_warn_segment_error(nilfs->ns_sb, ret); in nilfs_read_super_root_block()
181 nilfs_read_log_header(struct the_nilfs *nilfs, sector_t start_blocknr, in nilfs_read_log_header() argument
186 bh_sum = __bread(nilfs->ns_bdev, start_blocknr, nilfs->ns_blocksize); in nilfs_read_log_header()
199 static int nilfs_validate_log(struct the_nilfs *nilfs, u64 seg_seq, in nilfs_validate_log() argument
217 if (unlikely(nblock == 0 || nblock > nilfs->ns_blocks_per_segment)) in nilfs_validate_log()
222 if (nilfs_compute_checksum(nilfs, bh_sum, &crc, sizeof(sum->ss_datasum), in nilfs_validate_log()
223 ((u64)nblock << nilfs->ns_blocksize_bits), in nilfs_validate_log()
242 static void *nilfs_read_summary_info(struct the_nilfs *nilfs, in nilfs_read_summary_info() argument
253 *pbh = __bread(nilfs->ns_bdev, blocknr + 1, in nilfs_read_summary_info()
254 nilfs->ns_blocksize); in nilfs_read_summary_info()
272 static void nilfs_skip_summary_info(struct the_nilfs *nilfs, in nilfs_skip_summary_info() argument
292 *pbh = __bread(nilfs->ns_bdev, blocknr + bcnt, in nilfs_skip_summary_info()
293 nilfs->ns_blocksize); in nilfs_skip_summary_info()
304 static int nilfs_scan_dsync_log(struct the_nilfs *nilfs, sector_t start_blocknr, in nilfs_scan_dsync_log() argument
320 blocknr = start_blocknr + DIV_ROUND_UP(sumbytes, nilfs->ns_blocksize); in nilfs_scan_dsync_log()
321 bh = __bread(nilfs->ns_bdev, start_blocknr, nilfs->ns_blocksize); in nilfs_scan_dsync_log()
330 finfo = nilfs_read_summary_info(nilfs, &bh, &offset, in nilfs_scan_dsync_log()
344 binfo = nilfs_read_summary_info(nilfs, &bh, &offset, in nilfs_scan_dsync_log()
364 nilfs_skip_summary_info(nilfs, &bh, &offset, sizeof(__le64), in nilfs_scan_dsync_log()
415 static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs, in nilfs_prepare_segment_for_recovery() argument
421 struct inode *sufile = nilfs->ns_sufile; in nilfs_prepare_segment_for_recovery()
426 segnum[0] = nilfs->ns_segnum; in nilfs_prepare_segment_for_recovery()
427 segnum[1] = nilfs->ns_nextnum; in nilfs_prepare_segment_for_recovery()
464 nilfs->ns_pseg_offset = 0; in nilfs_prepare_segment_for_recovery()
465 nilfs->ns_seg_seq = ri->ri_seq + 2; in nilfs_prepare_segment_for_recovery()
466 nilfs->ns_nextnum = nilfs->ns_segnum = segnum[0]; in nilfs_prepare_segment_for_recovery()
473 static int nilfs_recovery_copy_block(struct the_nilfs *nilfs, in nilfs_recovery_copy_block() argument
480 bh_org = __bread(nilfs->ns_bdev, rb->blocknr, nilfs->ns_blocksize); in nilfs_recovery_copy_block()
491 static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs, in nilfs_recover_dsync_blocks() argument
499 unsigned int blocksize = nilfs->ns_blocksize; in nilfs_recover_dsync_blocks()
524 err = nilfs_recovery_copy_block(nilfs, rb, page); in nilfs_recover_dsync_blocks()
567 static int nilfs_do_roll_forward(struct the_nilfs *nilfs, in nilfs_do_roll_forward() argument
591 segnum = nilfs_get_segnum_of_block(nilfs, pseg_start); in nilfs_do_roll_forward()
592 nilfs_get_segment_range(nilfs, segnum, &seg_start, &seg_end); in nilfs_do_roll_forward()
596 bh_sum = nilfs_read_log_header(nilfs, pseg_start, &sum); in nilfs_do_roll_forward()
602 ret = nilfs_validate_log(nilfs, seg_seq, bh_sum, sum); in nilfs_do_roll_forward()
616 nextnum = nilfs_get_segnum_of_block(nilfs, in nilfs_do_roll_forward()
619 nilfs->ns_ctime = le64_to_cpu(sum->ss_create); in nilfs_do_roll_forward()
621 nilfs->ns_nongc_ctime = nilfs->ns_ctime; in nilfs_do_roll_forward()
634 err = nilfs_scan_dsync_log(nilfs, pseg_start, sum, in nilfs_do_roll_forward()
640 nilfs, sb, root, &dsync_blocks, in nilfs_do_roll_forward()
667 nilfs_get_segment_range(nilfs, segnum, &seg_start, &seg_end); in nilfs_do_roll_forward()
690 static void nilfs_finish_roll_forward(struct the_nilfs *nilfs, in nilfs_finish_roll_forward() argument
696 if (nilfs_get_segnum_of_block(nilfs, ri->ri_lsegs_start) != in nilfs_finish_roll_forward()
697 nilfs_get_segnum_of_block(nilfs, ri->ri_super_root)) in nilfs_finish_roll_forward()
700 bh = __getblk(nilfs->ns_bdev, ri->ri_lsegs_start, nilfs->ns_blocksize); in nilfs_finish_roll_forward()
706 nilfs_msg(nilfs->ns_sb, KERN_WARNING, in nilfs_finish_roll_forward()
730 int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs, in nilfs_salvage_orphan_logs() argument
747 err = nilfs_do_roll_forward(nilfs, sb, root, ri); in nilfs_salvage_orphan_logs()
752 err = nilfs_prepare_segment_for_recovery(nilfs, sb, ri); in nilfs_salvage_orphan_logs()
764 set_nilfs_discontinued(nilfs); in nilfs_salvage_orphan_logs()
775 nilfs_finish_roll_forward(nilfs, ri); in nilfs_salvage_orphan_logs()
801 int nilfs_search_super_root(struct the_nilfs *nilfs, in nilfs_search_super_root() argument
818 pseg_start = nilfs->ns_last_pseg; in nilfs_search_super_root()
819 seg_seq = nilfs->ns_last_seq; in nilfs_search_super_root()
820 cno = nilfs->ns_last_cno; in nilfs_search_super_root()
821 segnum = nilfs_get_segnum_of_block(nilfs, pseg_start); in nilfs_search_super_root()
824 nilfs_get_segment_range(nilfs, segnum, &seg_start, &seg_end); in nilfs_search_super_root()
829 __breadahead(nilfs->ns_bdev, b++, nilfs->ns_blocksize); in nilfs_search_super_root()
834 bh_sum = nilfs_read_log_header(nilfs, pseg_start, &sum); in nilfs_search_super_root()
838 ret = nilfs_validate_log(nilfs, seg_seq, bh_sum, sum); in nilfs_search_super_root()
856 nextnum = nilfs_get_segnum_of_block(nilfs, in nilfs_search_super_root()
873 nilfs_get_segment_range(nilfs, nextnum, &b, &end); in nilfs_search_super_root()
875 __breadahead(nilfs->ns_bdev, b++, in nilfs_search_super_root()
876 nilfs->ns_blocksize); in nilfs_search_super_root()
895 nilfs->ns_pseg_offset = pseg_start + nblocks - seg_start; in nilfs_search_super_root()
896 nilfs->ns_seg_seq = seg_seq; in nilfs_search_super_root()
897 nilfs->ns_segnum = segnum; in nilfs_search_super_root()
898 nilfs->ns_cno = cno; /* nilfs->ns_cno = ri->ri_cno + 1 */ in nilfs_search_super_root()
899 nilfs->ns_ctime = le64_to_cpu(sum->ss_create); in nilfs_search_super_root()
900 nilfs->ns_nextnum = nextnum; in nilfs_search_super_root()
905 if (nilfs->ns_mount_state & NILFS_VALID_FS) in nilfs_search_super_root()
937 nilfs_get_segment_range(nilfs, segnum, &seg_start, &seg_end); in nilfs_search_super_root()
945 nilfs->ns_last_pseg = sr_pseg_start; in nilfs_search_super_root()
946 nilfs->ns_last_seq = nilfs->ns_seg_seq; in nilfs_search_super_root()
947 nilfs->ns_last_cno = ri->ri_cno; in nilfs_search_super_root()
953 return ret < 0 ? ret : nilfs_warn_segment_error(nilfs->ns_sb, ret); in nilfs_search_super_root()