Lines Matching refs:log
52 #define xlog_recover_check_summary(log) argument
80 struct xlog *log, in xlog_verify_bno() argument
84 if (blk_no < 0 || blk_no >= log->l_logBBsize) in xlog_verify_bno()
86 if (bbcount <= 0 || (blk_no + bbcount) > log->l_logBBsize) in xlog_verify_bno()
97 struct xlog *log, in xlog_alloc_buffer() argument
100 int align_mask = xfs_buftarg_dma_alignment(log->l_targ); in xlog_alloc_buffer()
106 if (!xlog_verify_bno(log, 0, nbblks)) { in xlog_alloc_buffer()
107 xfs_warn(log->l_mp, "Invalid block length (0x%x) for buffer", in xlog_alloc_buffer()
109 XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_HIGH, log->l_mp); in xlog_alloc_buffer()
127 if (nbblks > 1 && log->l_sectBBsize > 1) in xlog_alloc_buffer()
128 nbblks += log->l_sectBBsize; in xlog_alloc_buffer()
129 nbblks = round_up(nbblks, log->l_sectBBsize); in xlog_alloc_buffer()
139 struct xlog *log, in xlog_align() argument
142 return BBTOB(blk_no & ((xfs_daddr_t)log->l_sectBBsize - 1)); in xlog_align()
147 struct xlog *log, in xlog_do_io() argument
155 if (!xlog_verify_bno(log, blk_no, nbblks)) { in xlog_do_io()
156 xfs_warn(log->l_mp, in xlog_do_io()
159 XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_HIGH, log->l_mp); in xlog_do_io()
163 blk_no = round_down(blk_no, log->l_sectBBsize); in xlog_do_io()
164 nbblks = round_up(nbblks, log->l_sectBBsize); in xlog_do_io()
167 error = xfs_rw_bdev(log->l_targ->bt_bdev, log->l_logBBstart + blk_no, in xlog_do_io()
169 if (error && !XFS_FORCED_SHUTDOWN(log->l_mp)) { in xlog_do_io()
170 xfs_alert(log->l_mp, in xlog_do_io()
180 struct xlog *log, in xlog_bread_noalign() argument
185 return xlog_do_io(log, blk_no, nbblks, data, REQ_OP_READ); in xlog_bread_noalign()
190 struct xlog *log, in xlog_bread() argument
198 error = xlog_do_io(log, blk_no, nbblks, data, REQ_OP_READ); in xlog_bread()
200 *offset = data + xlog_align(log, blk_no); in xlog_bread()
206 struct xlog *log, in xlog_bwrite() argument
211 return xlog_do_io(log, blk_no, nbblks, data, REQ_OP_WRITE); in xlog_bwrite()
327 struct xlog *log, in xlog_find_cycle_start() argument
342 error = xlog_bread(log, mid_blk, 1, buffer, &offset); in xlog_find_cycle_start()
370 struct xlog *log, in xlog_find_verify_cycle() argument
390 while (bufblks > log->l_logBBsize) in xlog_find_verify_cycle()
392 while (!(buffer = xlog_alloc_buffer(log, bufblks))) { in xlog_find_verify_cycle()
394 if (bufblks < log->l_sectBBsize) in xlog_find_verify_cycle()
403 error = xlog_bread(log, i, bcount, buffer, &buf); in xlog_find_verify_cycle()
439 struct xlog *log, in xlog_find_verify_log_record() argument
455 buffer = xlog_alloc_buffer(log, num_blks); in xlog_find_verify_log_record()
457 buffer = xlog_alloc_buffer(log, 1); in xlog_find_verify_log_record()
462 error = xlog_bread(log, start_blk, num_blks, buffer, &offset); in xlog_find_verify_log_record()
471 xfs_warn(log->l_mp, in xlog_find_verify_log_record()
479 error = xlog_bread(log, i, 1, buffer, &offset); in xlog_find_verify_log_record()
507 if ((error = xlog_header_check_mount(log->l_mp, head))) in xlog_find_verify_log_record()
517 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) { in xlog_find_verify_log_record()
551 struct xlog *log, in xlog_find_head() argument
560 int error, log_bbnum = log->l_logBBsize; in xlog_find_head()
563 error = xlog_find_zeroed(log, &first_blk); in xlog_find_head()
565 xfs_warn(log->l_mp, "empty log check failed"); in xlog_find_head()
577 xfs_warn(log->l_mp, "totally zeroed log"); in xlog_find_head()
584 buffer = xlog_alloc_buffer(log, 1); in xlog_find_head()
588 error = xlog_bread(log, 0, 1, buffer, &offset); in xlog_find_head()
595 error = xlog_bread(log, last_blk, 1, buffer, &offset); in xlog_find_head()
665 error = xlog_find_cycle_start(log, buffer, first_blk, &head_blk, in xlog_find_head()
678 num_scan_bblks = min_t(int, log_bbnum, XLOG_TOTAL_REC_SHIFT(log)); in xlog_find_head()
685 if ((error = xlog_find_verify_cycle(log, in xlog_find_head()
722 if ((error = xlog_find_verify_cycle(log, start_blk, in xlog_find_head()
738 if ((error = xlog_find_verify_cycle(log, in xlog_find_head()
751 num_scan_bblks = XLOG_REC_SHIFT(log); in xlog_find_head()
756 error = xlog_find_verify_log_record(log, start_blk, &head_blk, 0); in xlog_find_head()
764 error = xlog_find_verify_log_record(log, start_blk, &head_blk, 0); in xlog_find_head()
774 error = xlog_find_verify_log_record(log, start_blk, in xlog_find_head()
802 xfs_warn(log->l_mp, "failed to find log head"); in xlog_find_head()
816 struct xlog *log, in xlog_rseek_logrec_hdr() argument
839 error = xlog_bread(log, i, 1, buffer, &offset); in xlog_rseek_logrec_hdr()
857 for (i = log->l_logBBsize - 1; i >= (int) tail_blk; i--) { in xlog_rseek_logrec_hdr()
858 error = xlog_bread(log, i, 1, buffer, &offset); in xlog_rseek_logrec_hdr()
890 struct xlog *log, in xlog_seek_logrec_hdr() argument
911 end_blk = head_blk > tail_blk ? head_blk : log->l_logBBsize - 1; in xlog_seek_logrec_hdr()
913 error = xlog_bread(log, i, 1, buffer, &offset); in xlog_seek_logrec_hdr()
931 error = xlog_bread(log, i, 1, buffer, &offset); in xlog_seek_logrec_hdr()
957 struct xlog *log, in xlog_tail_distance() argument
964 return tail_blk + (log->l_logBBsize - head_blk); in xlog_tail_distance()
988 struct xlog *log, in xlog_verify_tail() argument
1001 buffer = xlog_alloc_buffer(log, 1); in xlog_verify_tail()
1009 error = xlog_seek_logrec_hdr(log, head_blk, *tail_blk, 1, buffer, in xlog_verify_tail()
1024 error = xlog_do_recovery_pass(log, head_blk, *tail_blk, in xlog_verify_tail()
1033 tail_distance = xlog_tail_distance(log, head_blk, first_bad); in xlog_verify_tail()
1038 error = xlog_seek_logrec_hdr(log, head_blk, first_bad, 2, in xlog_verify_tail()
1045 error = xlog_do_recovery_pass(log, head_blk, *tail_blk, in xlog_verify_tail()
1050 xfs_warn(log->l_mp, in xlog_verify_tail()
1073 struct xlog *log, in xlog_verify_head() argument
1095 tmp_buffer = xlog_alloc_buffer(log, 1); in xlog_verify_head()
1098 error = xlog_rseek_logrec_hdr(log, *head_blk, *tail_blk, in xlog_verify_head()
1110 error = xlog_do_recovery_pass(log, *head_blk, tmp_rhead_blk, in xlog_verify_head()
1118 xfs_warn(log->l_mp, in xlog_verify_head()
1130 found = xlog_rseek_logrec_hdr(log, first_bad, *tail_blk, 1, in xlog_verify_head()
1156 return xlog_verify_tail(log, *head_blk, tail_blk, in xlog_verify_head()
1170 struct xlog *log, in xlog_wrap_logbno() argument
1175 div_s64_rem(bno, log->l_logBBsize, &mod); in xlog_wrap_logbno()
1186 struct xlog *log, in xlog_check_unmount_rec() argument
1212 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) { in xlog_check_unmount_rec()
1228 after_umount_blk = xlog_wrap_logbno(log, in xlog_check_unmount_rec()
1233 umount_data_blk = xlog_wrap_logbno(log, rhead_blk + hblks); in xlog_check_unmount_rec()
1234 error = xlog_bread(log, umount_data_blk, 1, buffer, &offset); in xlog_check_unmount_rec()
1245 xlog_assign_atomic_lsn(&log->l_tail_lsn, in xlog_check_unmount_rec()
1246 log->l_curr_cycle, after_umount_blk); in xlog_check_unmount_rec()
1247 xlog_assign_atomic_lsn(&log->l_last_sync_lsn, in xlog_check_unmount_rec()
1248 log->l_curr_cycle, after_umount_blk); in xlog_check_unmount_rec()
1260 struct xlog *log, in xlog_set_state() argument
1276 log->l_prev_block = rhead_blk; in xlog_set_state()
1277 log->l_curr_block = (int)head_blk; in xlog_set_state()
1278 log->l_curr_cycle = be32_to_cpu(rhead->h_cycle); in xlog_set_state()
1280 log->l_curr_cycle++; in xlog_set_state()
1281 atomic64_set(&log->l_tail_lsn, be64_to_cpu(rhead->h_tail_lsn)); in xlog_set_state()
1282 atomic64_set(&log->l_last_sync_lsn, be64_to_cpu(rhead->h_lsn)); in xlog_set_state()
1283 xlog_assign_grant_head(&log->l_reserve_head.grant, log->l_curr_cycle, in xlog_set_state()
1284 BBTOB(log->l_curr_block)); in xlog_set_state()
1285 xlog_assign_grant_head(&log->l_write_head.grant, log->l_curr_cycle, in xlog_set_state()
1286 BBTOB(log->l_curr_block)); in xlog_set_state()
1307 struct xlog *log, in xlog_find_tail() argument
1323 if ((error = xlog_find_head(log, head_blk))) in xlog_find_tail()
1327 buffer = xlog_alloc_buffer(log, 1); in xlog_find_tail()
1331 error = xlog_bread(log, 0, 1, buffer, &offset); in xlog_find_tail()
1347 error = xlog_rseek_logrec_hdr(log, *head_blk, *head_blk, 1, buffer, in xlog_find_tail()
1352 xfs_warn(log->l_mp, "%s: couldn't find sync record", __func__); in xlog_find_tail()
1360 xlog_set_state(log, *head_blk, rhead, rhead_blk, wrapped); in xlog_find_tail()
1361 tail_lsn = atomic64_read(&log->l_tail_lsn); in xlog_find_tail()
1367 error = xlog_check_unmount_rec(log, head_blk, tail_blk, rhead, in xlog_find_tail()
1385 error = xlog_verify_head(log, head_blk, tail_blk, buffer, in xlog_find_tail()
1392 xlog_set_state(log, *head_blk, rhead, rhead_blk, in xlog_find_tail()
1394 tail_lsn = atomic64_read(&log->l_tail_lsn); in xlog_find_tail()
1395 error = xlog_check_unmount_rec(log, head_blk, tail_blk, in xlog_find_tail()
1409 log->l_mp->m_flags |= XFS_MOUNT_WAS_CLEAN; in xlog_find_tail()
1430 if (!xfs_readonly_buftarg(log->l_targ)) in xlog_find_tail()
1431 error = xlog_clear_stale_blocks(log, tail_lsn); in xlog_find_tail()
1437 xfs_warn(log->l_mp, "failed to locate log tail"); in xlog_find_tail()
1459 struct xlog *log, in xlog_find_zeroed() argument
1467 int error, log_bbnum = log->l_logBBsize; in xlog_find_zeroed()
1472 buffer = xlog_alloc_buffer(log, 1); in xlog_find_zeroed()
1475 error = xlog_bread(log, 0, 1, buffer, &offset); in xlog_find_zeroed()
1487 error = xlog_bread(log, log_bbnum-1, 1, buffer, &offset); in xlog_find_zeroed()
1499 error = xlog_find_cycle_start(log, buffer, 0, &last_blk, 0); in xlog_find_zeroed()
1509 num_scan_bblks = XLOG_TOTAL_REC_SHIFT(log); in xlog_find_zeroed()
1522 if ((error = xlog_find_verify_cycle(log, start_blk, in xlog_find_zeroed()
1532 error = xlog_find_verify_log_record(log, start_blk, &last_blk, 0); in xlog_find_zeroed()
1553 struct xlog *log, in xlog_add_record() argument
1566 xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? 2 : 1); in xlog_add_record()
1570 memcpy(&recp->h_fs_uuid, &log->l_mp->m_sb.sb_uuid, sizeof(uuid_t)); in xlog_add_record()
1575 struct xlog *log, in xlog_write_log_records() argument
1585 int sectbb = log->l_sectBBsize; in xlog_write_log_records()
1598 while (bufblks > log->l_logBBsize) in xlog_write_log_records()
1600 while (!(buffer = xlog_alloc_buffer(log, bufblks))) { in xlog_write_log_records()
1612 error = xlog_bread_noalign(log, start_block, 1, buffer); in xlog_write_log_records()
1631 error = xlog_bread_noalign(log, ealign, sectbb, in xlog_write_log_records()
1638 offset = buffer + xlog_align(log, start_block); in xlog_write_log_records()
1640 xlog_add_record(log, offset, cycle, i+j, in xlog_write_log_records()
1644 error = xlog_bwrite(log, start_block, endcount, buffer); in xlog_write_log_records()
1674 struct xlog *log, in xlog_clear_stale_blocks() argument
1685 head_cycle = log->l_curr_cycle; in xlog_clear_stale_blocks()
1686 head_block = log->l_curr_block; in xlog_clear_stale_blocks()
1702 if (unlikely(head_block < tail_block || head_block >= log->l_logBBsize)) { in xlog_clear_stale_blocks()
1704 XFS_ERRLEVEL_LOW, log->l_mp); in xlog_clear_stale_blocks()
1707 tail_distance = tail_block + (log->l_logBBsize - head_block); in xlog_clear_stale_blocks()
1716 XFS_ERRLEVEL_LOW, log->l_mp); in xlog_clear_stale_blocks()
1731 max_distance = XLOG_TOTAL_REC_SHIFT(log); in xlog_clear_stale_blocks()
1741 if ((head_block + max_distance) <= log->l_logBBsize) { in xlog_clear_stale_blocks()
1749 error = xlog_write_log_records(log, (head_cycle - 1), in xlog_clear_stale_blocks()
1762 distance = log->l_logBBsize - head_block; in xlog_clear_stale_blocks()
1763 error = xlog_write_log_records(log, (head_cycle - 1), in xlog_clear_stale_blocks()
1778 distance = max_distance - (log->l_logBBsize - head_block); in xlog_clear_stale_blocks()
1779 error = xlog_write_log_records(log, head_cycle, 0, distance, in xlog_clear_stale_blocks()
1846 struct xlog *log, in xlog_recover_reorder_trans() argument
1868 trace_xfs_log_recover_item_reorder_head(log, in xlog_recover_reorder_trans()
1890 trace_xfs_log_recover_item_reorder_tail(log, in xlog_recover_reorder_trans()
1895 xfs_warn(log->l_mp, in xlog_recover_reorder_trans()
1936 struct xlog *log, in xlog_recover_buffer_pass1() argument
1947 trace_xfs_log_recover_buf_not_cancel(log, buf_f); in xlog_recover_buffer_pass1()
1955 bucket = XLOG_BUF_CANCEL_BUCKET(log, buf_f->blf_blkno); in xlog_recover_buffer_pass1()
1960 trace_xfs_log_recover_buf_cancel_ref_inc(log, buf_f); in xlog_recover_buffer_pass1()
1971 trace_xfs_log_recover_buf_cancel_add(log, buf_f); in xlog_recover_buffer_pass1()
1982 struct xlog *log, in xlog_peek_buffer_cancelled() argument
1990 if (!log->l_buf_cancel_table) { in xlog_peek_buffer_cancelled()
1996 bucket = XLOG_BUF_CANCEL_BUCKET(log, blkno); in xlog_peek_buffer_cancelled()
2022 struct xlog *log, in xlog_check_buffer_cancelled() argument
2029 bcp = xlog_peek_buffer_cancelled(log, blkno, len, flags); in xlog_check_buffer_cancelled()
2664 struct xlog *log, in xlog_recover_do_dquot_buffer() argument
2671 trace_xfs_log_recover_buf_dquot_buf(log, buf_f); in xlog_recover_do_dquot_buffer()
2689 if (log->l_quotaoffs_flag & type) in xlog_recover_do_dquot_buffer()
2721 struct xlog *log, in xlog_recover_buffer_pass2() argument
2727 xfs_mount_t *mp = log->l_mp; in xlog_recover_buffer_pass2()
2737 if (xlog_check_buffer_cancelled(log, buf_f->blf_blkno, in xlog_recover_buffer_pass2()
2739 trace_xfs_log_recover_buf_cancel(log, buf_f); in xlog_recover_buffer_pass2()
2743 trace_xfs_log_recover_buf_recover(log, buf_f); in xlog_recover_buffer_pass2()
2780 trace_xfs_log_recover_buf_skip(log, buf_f); in xlog_recover_buffer_pass2()
2793 dirty = xlog_recover_do_dquot_buffer(mp, log, item, bp, buf_f); in xlog_recover_buffer_pass2()
2817 (BBTOB(bp->b_length) != M_IGEO(log->l_mp)->inode_cluster_size)) { in xlog_recover_buffer_pass2()
2913 struct xlog *log, in xlog_recover_inode_pass2() argument
2919 xfs_mount_t *mp = log->l_mp; in xlog_recover_inode_pass2()
2946 if (xlog_check_buffer_cancelled(log, in_f->ilf_blkno, in xlog_recover_inode_pass2()
2949 trace_xfs_log_recover_inode_cancel(log, in_f); in xlog_recover_inode_pass2()
2952 trace_xfs_log_recover_inode_recover(log, in_f); in xlog_recover_inode_pass2()
3003 trace_xfs_log_recover_inode_skip(log, in_f); in xlog_recover_inode_pass2()
3027 trace_xfs_log_recover_inode_skip(log, in_f); in xlog_recover_inode_pass2()
3167 xfs_warn(log->l_mp, "%s: Invalid flag", __func__); in xlog_recover_inode_pass2()
3181 xfs_dinode_calc_crc(log->l_mp, dip); in xlog_recover_inode_pass2()
3202 struct xlog *log, in xlog_recover_quotaoff_pass1() argument
3213 log->l_quotaoffs_flag |= XFS_DQ_USER; in xlog_recover_quotaoff_pass1()
3215 log->l_quotaoffs_flag |= XFS_DQ_PROJ; in xlog_recover_quotaoff_pass1()
3217 log->l_quotaoffs_flag |= XFS_DQ_GROUP; in xlog_recover_quotaoff_pass1()
3227 struct xlog *log, in xlog_recover_dquot_pass2() argument
3232 xfs_mount_t *mp = log->l_mp; in xlog_recover_dquot_pass2()
3249 xfs_alert(log->l_mp, "NULL dquot in %s.", __func__); in xlog_recover_dquot_pass2()
3253 xfs_alert(log->l_mp, "dquot too small (%d) in %s.", in xlog_recover_dquot_pass2()
3263 if (log->l_quotaoffs_flag & type) in xlog_recover_dquot_pass2()
3340 struct xlog *log, in xlog_recover_efi_pass2() argument
3345 struct xfs_mount *mp = log->l_mp; in xlog_recover_efi_pass2()
3359 spin_lock(&log->l_ailp->ail_lock); in xlog_recover_efi_pass2()
3366 xfs_trans_ail_update(log->l_ailp, &efip->efi_item, lsn); in xlog_recover_efi_pass2()
3381 struct xlog *log, in xlog_recover_efd_pass2() argument
3389 struct xfs_ail *ailp = log->l_ailp; in xlog_recover_efd_pass2()
3436 struct xlog *log, in xlog_recover_rui_pass2() argument
3441 struct xfs_mount *mp = log->l_mp; in xlog_recover_rui_pass2()
3455 spin_lock(&log->l_ailp->ail_lock); in xlog_recover_rui_pass2()
3462 xfs_trans_ail_update(log->l_ailp, &ruip->rui_item, lsn); in xlog_recover_rui_pass2()
3477 struct xlog *log, in xlog_recover_rud_pass2() argument
3485 struct xfs_ail *ailp = log->l_ailp; in xlog_recover_rud_pass2()
3552 struct xlog *log, in xlog_recover_cui_pass2() argument
3557 struct xfs_mount *mp = log->l_mp; in xlog_recover_cui_pass2()
3571 spin_lock(&log->l_ailp->ail_lock); in xlog_recover_cui_pass2()
3578 xfs_trans_ail_update(log->l_ailp, &cuip->cui_item, lsn); in xlog_recover_cui_pass2()
3593 struct xlog *log, in xlog_recover_cud_pass2() argument
3601 struct xfs_ail *ailp = log->l_ailp; in xlog_recover_cud_pass2()
3669 struct xlog *log, in xlog_recover_bui_pass2() argument
3674 struct xfs_mount *mp = log->l_mp; in xlog_recover_bui_pass2()
3690 spin_lock(&log->l_ailp->ail_lock); in xlog_recover_bui_pass2()
3697 xfs_trans_ail_update(log->l_ailp, &buip->bui_item, lsn); in xlog_recover_bui_pass2()
3712 struct xlog *log, in xlog_recover_bud_pass2() argument
3720 struct xfs_ail *ailp = log->l_ailp; in xlog_recover_bud_pass2()
3766 struct xlog *log, in xlog_recover_do_icreate_pass2() argument
3770 struct xfs_mount *mp = log->l_mp; in xlog_recover_do_icreate_pass2()
3785 xfs_warn(log->l_mp, "xlog_recover_do_icreate_trans: bad type"); in xlog_recover_do_icreate_pass2()
3790 xfs_warn(log->l_mp, "xlog_recover_do_icreate_trans: bad icl size"); in xlog_recover_do_icreate_pass2()
3796 xfs_warn(log->l_mp, "xlog_recover_do_icreate_trans: bad agno"); in xlog_recover_do_icreate_pass2()
3801 xfs_warn(log->l_mp, "xlog_recover_do_icreate_trans: bad agbno"); in xlog_recover_do_icreate_pass2()
3806 xfs_warn(log->l_mp, "xlog_recover_do_icreate_trans: bad isize"); in xlog_recover_do_icreate_pass2()
3811 xfs_warn(log->l_mp, "xlog_recover_do_icreate_trans: bad count"); in xlog_recover_do_icreate_pass2()
3816 xfs_warn(log->l_mp, "xlog_recover_do_icreate_trans: bad length"); in xlog_recover_do_icreate_pass2()
3826 xfs_warn(log->l_mp, in xlog_recover_do_icreate_pass2()
3833 xfs_warn(log->l_mp, in xlog_recover_do_icreate_pass2()
3852 if (xlog_check_buffer_cancelled(log, daddr, bb_per_cluster, 0)) in xlog_recover_do_icreate_pass2()
3871 trace_xfs_log_recover_icreate_cancel(log, icl); in xlog_recover_do_icreate_pass2()
3875 trace_xfs_log_recover_icreate_recover(log, icl); in xlog_recover_do_icreate_pass2()
3882 struct xlog *log, in xlog_recover_buffer_ra_pass2() argument
3886 struct xfs_mount *mp = log->l_mp; in xlog_recover_buffer_ra_pass2()
3888 if (xlog_peek_buffer_cancelled(log, buf_f->blf_blkno, in xlog_recover_buffer_ra_pass2()
3899 struct xlog *log, in xlog_recover_inode_ra_pass2() argument
3904 struct xfs_mount *mp = log->l_mp; in xlog_recover_inode_ra_pass2()
3917 if (xlog_peek_buffer_cancelled(log, ilfp->ilf_blkno, ilfp->ilf_len, 0)) in xlog_recover_inode_ra_pass2()
3926 struct xlog *log, in xlog_recover_dquot_ra_pass2() argument
3929 struct xfs_mount *mp = log->l_mp; in xlog_recover_dquot_ra_pass2()
3947 if (log->l_quotaoffs_flag & type) in xlog_recover_dquot_ra_pass2()
3955 if (xlog_peek_buffer_cancelled(log, dq_f->qlf_blkno, len, 0)) in xlog_recover_dquot_ra_pass2()
3964 struct xlog *log, in xlog_recover_ra_pass2() argument
3969 xlog_recover_buffer_ra_pass2(log, item); in xlog_recover_ra_pass2()
3972 xlog_recover_inode_ra_pass2(log, item); in xlog_recover_ra_pass2()
3975 xlog_recover_dquot_ra_pass2(log, item); in xlog_recover_ra_pass2()
3993 struct xlog *log, in xlog_recover_commit_pass1() argument
3997 trace_xfs_log_recover_item_recover(log, trans, item, XLOG_RECOVER_PASS1); in xlog_recover_commit_pass1()
4001 return xlog_recover_buffer_pass1(log, item); in xlog_recover_commit_pass1()
4003 return xlog_recover_quotaoff_pass1(log, item); in xlog_recover_commit_pass1()
4018 xfs_warn(log->l_mp, "%s: invalid item type (%d)", in xlog_recover_commit_pass1()
4027 struct xlog *log, in xlog_recover_commit_pass2() argument
4032 trace_xfs_log_recover_item_recover(log, trans, item, XLOG_RECOVER_PASS2); in xlog_recover_commit_pass2()
4036 return xlog_recover_buffer_pass2(log, buffer_list, item, in xlog_recover_commit_pass2()
4039 return xlog_recover_inode_pass2(log, buffer_list, item, in xlog_recover_commit_pass2()
4042 return xlog_recover_efi_pass2(log, item, trans->r_lsn); in xlog_recover_commit_pass2()
4044 return xlog_recover_efd_pass2(log, item); in xlog_recover_commit_pass2()
4046 return xlog_recover_rui_pass2(log, item, trans->r_lsn); in xlog_recover_commit_pass2()
4048 return xlog_recover_rud_pass2(log, item); in xlog_recover_commit_pass2()
4050 return xlog_recover_cui_pass2(log, item, trans->r_lsn); in xlog_recover_commit_pass2()
4052 return xlog_recover_cud_pass2(log, item); in xlog_recover_commit_pass2()
4054 return xlog_recover_bui_pass2(log, item, trans->r_lsn); in xlog_recover_commit_pass2()
4056 return xlog_recover_bud_pass2(log, item); in xlog_recover_commit_pass2()
4058 return xlog_recover_dquot_pass2(log, buffer_list, item, in xlog_recover_commit_pass2()
4061 return xlog_recover_do_icreate_pass2(log, buffer_list, item); in xlog_recover_commit_pass2()
4066 xfs_warn(log->l_mp, "%s: invalid item type (%d)", in xlog_recover_commit_pass2()
4075 struct xlog *log, in xlog_recover_items_pass2() argument
4084 error = xlog_recover_commit_pass2(log, trans, in xlog_recover_items_pass2()
4101 struct xlog *log, in xlog_recover_commit_trans() argument
4117 error = xlog_recover_reorder_trans(log, trans, pass); in xlog_recover_commit_trans()
4124 error = xlog_recover_commit_pass1(log, trans, item); in xlog_recover_commit_trans()
4127 xlog_recover_ra_pass2(log, item); in xlog_recover_commit_trans()
4131 error = xlog_recover_items_pass2(log, trans, in xlog_recover_commit_trans()
4149 error = xlog_recover_items_pass2(log, trans, in xlog_recover_commit_trans()
4173 struct xlog *log, in xlog_recover_add_to_cont_trans() argument
4189 xfs_warn(log->l_mp, "%s: bad header length", __func__); in xlog_recover_add_to_cont_trans()
4210 trace_xfs_log_recover_item_add_cont(log, trans, item, 0); in xlog_recover_add_to_cont_trans()
4229 struct xlog *log, in xlog_recover_add_to_trans() argument
4243 xfs_warn(log->l_mp, "%s: bad header magic number", in xlog_recover_add_to_trans()
4250 xfs_warn(log->l_mp, "%s: bad header length", __func__); in xlog_recover_add_to_trans()
4283 xfs_warn(log->l_mp, in xlog_recover_add_to_trans()
4301 trace_xfs_log_recover_item_add(log, trans, item, 0); in xlog_recover_add_to_trans()
4337 struct xlog *log, in xlog_recovery_process_trans() argument
4361 error = xlog_recover_add_to_trans(log, trans, dp, len); in xlog_recovery_process_trans()
4364 error = xlog_recover_add_to_cont_trans(log, trans, dp, len); in xlog_recovery_process_trans()
4367 error = xlog_recover_commit_trans(log, trans, pass, in xlog_recovery_process_trans()
4376 xfs_warn(log->l_mp, "%s: Unmount LR", __func__); in xlog_recovery_process_trans()
4381 xfs_warn(log->l_mp, "%s: bad flag 0x%x", __func__, flags); in xlog_recovery_process_trans()
4444 struct xlog *log, in xlog_recover_process_ophdr() argument
4460 xfs_warn(log->l_mp, "%s: bad clientid 0x%x", in xlog_recover_process_ophdr()
4471 xfs_warn(log->l_mp, "%s: bad length 0x%x", __func__, len); in xlog_recover_process_ophdr()
4505 if (log->l_recovery_lsn != trans->r_lsn && in xlog_recover_process_ophdr()
4510 log->l_recovery_lsn = trans->r_lsn; in xlog_recover_process_ophdr()
4513 return xlog_recovery_process_trans(log, trans, dp, len, in xlog_recover_process_ophdr()
4528 struct xlog *log, in xlog_recover_process_data() argument
4544 if (xlog_header_check_recover(log->l_mp, rhead)) in xlog_recover_process_data()
4547 trace_xfs_log_recover_record(log, rhead, pass); in xlog_recover_process_data()
4555 error = xlog_recover_process_ophdr(log, rhash, rhead, ohead, in xlog_recover_process_data()
4792 struct xlog *log) in xlog_recover_process_intents() argument
4812 error = xfs_trans_alloc_empty(log->l_mp, &parent_tp); in xlog_recover_process_intents()
4816 ailp = log->l_ailp; in xlog_recover_process_intents()
4820 last_lsn = xlog_assign_lsn(log->l_curr_cycle, log->l_curr_block); in xlog_recover_process_intents()
4850 error = xlog_recover_process_efi(log->l_mp, ailp, lip); in xlog_recover_process_intents()
4853 error = xlog_recover_process_rui(log->l_mp, ailp, lip); in xlog_recover_process_intents()
4882 struct xlog *log) in xlog_recover_cancel_intents() argument
4888 ailp = log->l_ailp; in xlog_recover_cancel_intents()
4906 xlog_recover_cancel_efi(log->l_mp, ailp, lip); in xlog_recover_cancel_intents()
4909 xlog_recover_cancel_rui(log->l_mp, ailp, lip); in xlog_recover_cancel_intents()
4912 xlog_recover_cancel_cui(log->l_mp, ailp, lip); in xlog_recover_cancel_intents()
4915 xlog_recover_cancel_bui(log->l_mp, ailp, lip); in xlog_recover_cancel_intents()
5051 struct xlog *log) in xlog_recover_process_iunlinks() argument
5061 mp = log->l_mp; in xlog_recover_process_iunlinks()
5105 struct xlog *log) in xlog_unpack_data() argument
5115 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) { in xlog_unpack_data()
5131 struct xlog *log, in xlog_recover_process() argument
5141 crc = xlog_cksum(log, rhead, dp, be32_to_cpu(rhead->h_len)); in xlog_recover_process()
5163 if (old_crc || xfs_sb_version_hascrc(&log->l_mp->m_sb)) { in xlog_recover_process()
5164 xfs_alert(log->l_mp, in xlog_recover_process()
5175 if (xfs_sb_version_hascrc(&log->l_mp->m_sb)) in xlog_recover_process()
5179 xlog_unpack_data(rhead, dp, log); in xlog_recover_process()
5181 return xlog_recover_process_data(log, rhash, rhead, dp, pass, in xlog_recover_process()
5187 struct xlog *log, in xlog_valid_rec_header() argument
5195 XFS_ERRLEVEL_LOW, log->l_mp); in xlog_valid_rec_header()
5201 xfs_warn(log->l_mp, "%s: unrecognised log version (%d).", in xlog_valid_rec_header()
5210 XFS_ERRLEVEL_LOW, log->l_mp); in xlog_valid_rec_header()
5213 if (unlikely( blkno > log->l_logBBsize || blkno > INT_MAX )) { in xlog_valid_rec_header()
5215 XFS_ERRLEVEL_LOW, log->l_mp); in xlog_valid_rec_header()
5231 struct xlog *log, in xlog_do_recovery_pass() argument
5260 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) { in xlog_do_recovery_pass()
5266 hbp = xlog_alloc_buffer(log, 1); in xlog_do_recovery_pass()
5270 error = xlog_bread(log, tail_blk, 1, hbp, &offset); in xlog_do_recovery_pass()
5275 error = xlog_valid_rec_header(log, rhead, tail_blk); in xlog_do_recovery_pass()
5293 if (h_len <= log->l_mp->m_logbsize && in xlog_do_recovery_pass()
5295 xfs_warn(log->l_mp, in xlog_do_recovery_pass()
5297 h_size, log->l_mp->m_logbsize); in xlog_do_recovery_pass()
5298 h_size = log->l_mp->m_logbsize; in xlog_do_recovery_pass()
5309 hbp = xlog_alloc_buffer(log, hblks); in xlog_do_recovery_pass()
5314 ASSERT(log->l_sectBBsize == 1); in xlog_do_recovery_pass()
5316 hbp = xlog_alloc_buffer(log, 1); in xlog_do_recovery_pass()
5322 dbp = xlog_alloc_buffer(log, BTOBB(h_size)); in xlog_do_recovery_pass()
5335 while (blk_no < log->l_logBBsize) { in xlog_do_recovery_pass()
5342 if (blk_no + hblks <= log->l_logBBsize) { in xlog_do_recovery_pass()
5344 error = xlog_bread(log, blk_no, hblks, hbp, in xlog_do_recovery_pass()
5350 if (blk_no != log->l_logBBsize) { in xlog_do_recovery_pass()
5353 split_hblks = log->l_logBBsize - (int)blk_no; in xlog_do_recovery_pass()
5355 error = xlog_bread(log, blk_no, in xlog_do_recovery_pass()
5375 error = xlog_bread_noalign(log, 0, in xlog_do_recovery_pass()
5382 error = xlog_valid_rec_header(log, rhead, in xlog_do_recovery_pass()
5397 if (blk_no + bblks <= log->l_logBBsize || in xlog_do_recovery_pass()
5398 blk_no >= log->l_logBBsize) { in xlog_do_recovery_pass()
5399 rblk_no = xlog_wrap_logbno(log, blk_no); in xlog_do_recovery_pass()
5400 error = xlog_bread(log, rblk_no, bblks, dbp, in xlog_do_recovery_pass()
5409 if (blk_no != log->l_logBBsize) { in xlog_do_recovery_pass()
5415 log->l_logBBsize - (int)blk_no; in xlog_do_recovery_pass()
5417 error = xlog_bread(log, blk_no, in xlog_do_recovery_pass()
5436 error = xlog_bread_noalign(log, 0, in xlog_do_recovery_pass()
5443 error = xlog_recover_process(log, rhash, rhead, offset, in xlog_do_recovery_pass()
5452 ASSERT(blk_no >= log->l_logBBsize); in xlog_do_recovery_pass()
5453 blk_no -= log->l_logBBsize; in xlog_do_recovery_pass()
5459 error = xlog_bread(log, blk_no, hblks, hbp, &offset); in xlog_do_recovery_pass()
5464 error = xlog_valid_rec_header(log, rhead, blk_no); in xlog_do_recovery_pass()
5470 error = xlog_bread(log, blk_no+hblks, bblks, dbp, in xlog_do_recovery_pass()
5475 error = xlog_recover_process(log, rhash, rhead, offset, pass, in xlog_do_recovery_pass()
5530 struct xlog *log, in xlog_do_log_recovery() argument
5542 log->l_buf_cancel_table = kmem_zalloc(XLOG_BC_TABLE_SIZE * in xlog_do_log_recovery()
5546 INIT_LIST_HEAD(&log->l_buf_cancel_table[i]); in xlog_do_log_recovery()
5548 error = xlog_do_recovery_pass(log, head_blk, tail_blk, in xlog_do_log_recovery()
5551 kmem_free(log->l_buf_cancel_table); in xlog_do_log_recovery()
5552 log->l_buf_cancel_table = NULL; in xlog_do_log_recovery()
5559 error = xlog_do_recovery_pass(log, head_blk, tail_blk, in xlog_do_log_recovery()
5566 ASSERT(list_empty(&log->l_buf_cancel_table[i])); in xlog_do_log_recovery()
5570 kmem_free(log->l_buf_cancel_table); in xlog_do_log_recovery()
5571 log->l_buf_cancel_table = NULL; in xlog_do_log_recovery()
5581 struct xlog *log, in xlog_do_recover() argument
5585 struct xfs_mount *mp = log->l_mp; in xlog_do_recover()
5590 trace_xfs_log_recover(log, head_blk, tail_blk); in xlog_do_recover()
5595 error = xlog_do_log_recovery(log, head_blk, tail_blk); in xlog_do_recover()
5651 xlog_recover_check_summary(log); in xlog_do_recover()
5654 log->l_flags &= ~XLOG_ACTIVE_RECOVERY; in xlog_do_recover()
5665 struct xlog *log) in xlog_recover() argument
5671 error = xlog_find_tail(log, &head_blk, &tail_blk); in xlog_recover()
5680 if (xfs_sb_version_hascrc(&log->l_mp->m_sb) && in xlog_recover()
5681 !xfs_log_check_lsn(log->l_mp, log->l_mp->m_sb.sb_lsn)) in xlog_recover()
5696 if ((error = xfs_dev_is_read_only(log->l_mp, "recovery"))) { in xlog_recover()
5707 if (XFS_SB_VERSION_NUM(&log->l_mp->m_sb) == XFS_SB_VERSION_5 && in xlog_recover()
5708 xfs_sb_has_incompat_log_feature(&log->l_mp->m_sb, in xlog_recover()
5710 xfs_warn(log->l_mp, in xlog_recover()
5712 (log->l_mp->m_sb.sb_features_log_incompat & in xlog_recover()
5714 xfs_warn(log->l_mp, in xlog_recover()
5716 xfs_warn(log->l_mp, in xlog_recover()
5727 xfs_notice(log->l_mp, in xlog_recover()
5733 xfs_notice(log->l_mp, "Starting recovery (logdev: %s)", in xlog_recover()
5734 log->l_mp->m_logname ? log->l_mp->m_logname in xlog_recover()
5737 error = xlog_do_recover(log, head_blk, tail_blk); in xlog_recover()
5738 log->l_flags |= XLOG_RECOVERY_NEEDED; in xlog_recover()
5754 struct xlog *log) in xlog_recover_finish() argument
5764 if (log->l_flags & XLOG_RECOVERY_NEEDED) { in xlog_recover_finish()
5766 error = xlog_recover_process_intents(log); in xlog_recover_finish()
5768 xfs_alert(log->l_mp, "Failed to recover intents"); in xlog_recover_finish()
5778 xfs_log_force(log->l_mp, XFS_LOG_SYNC); in xlog_recover_finish()
5780 xlog_recover_process_iunlinks(log); in xlog_recover_finish()
5782 xlog_recover_check_summary(log); in xlog_recover_finish()
5784 xfs_notice(log->l_mp, "Ending recovery (logdev: %s)", in xlog_recover_finish()
5785 log->l_mp->m_logname ? log->l_mp->m_logname in xlog_recover_finish()
5787 log->l_flags &= ~XLOG_RECOVERY_NEEDED; in xlog_recover_finish()
5789 xfs_info(log->l_mp, "Ending clean mount"); in xlog_recover_finish()
5796 struct xlog *log) in xlog_recover_cancel() argument
5798 if (log->l_flags & XLOG_RECOVERY_NEEDED) in xlog_recover_cancel()
5799 xlog_recover_cancel_intents(log); in xlog_recover_cancel()
5809 struct xlog *log) in xlog_recover_check_summary() argument
5821 mp = log->l_mp; in xlog_recover_check_summary()