aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r--fs/xfs/xfs_log.c79
1 files changed, 21 insertions, 58 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 34817adf4b9e..e2cc3568c299 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -760,38 +760,6 @@ xfs_log_item_init(
760 INIT_LIST_HEAD(&item->li_cil); 760 INIT_LIST_HEAD(&item->li_cil);
761} 761}
762 762
763/*
764 * Write region vectors to log. The write happens using the space reservation
765 * of the ticket (tic). It is not a requirement that all writes for a given
766 * transaction occur with one call to xfs_log_write(). However, it is important
767 * to note that the transaction reservation code makes an assumption about the
768 * number of log headers a transaction requires that may be violated if you
769 * don't pass all the transaction vectors in one call....
770 */
771int
772xfs_log_write(
773 struct xfs_mount *mp,
774 struct xfs_log_iovec reg[],
775 int nentries,
776 struct xlog_ticket *tic,
777 xfs_lsn_t *start_lsn)
778{
779 struct log *log = mp->m_log;
780 int error;
781 struct xfs_log_vec vec = {
782 .lv_niovecs = nentries,
783 .lv_iovecp = reg,
784 };
785
786 if (XLOG_FORCED_SHUTDOWN(log))
787 return XFS_ERROR(EIO);
788
789 error = xlog_write(log, &vec, tic, start_lsn, NULL, 0);
790 if (error)
791 xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR);
792 return error;
793}
794
795void 763void
796xfs_log_move_tail(xfs_mount_t *mp, 764xfs_log_move_tail(xfs_mount_t *mp,
797 xfs_lsn_t tail_lsn) 765 xfs_lsn_t tail_lsn)
@@ -1685,7 +1653,7 @@ xlog_print_tic_res(
1685 }; 1653 };
1686 1654
1687 xfs_warn(mp, 1655 xfs_warn(mp,
1688 "xfs_log_write: reservation summary:\n" 1656 "xlog_write: reservation summary:\n"
1689 " trans type = %s (%u)\n" 1657 " trans type = %s (%u)\n"
1690 " unit res = %d bytes\n" 1658 " unit res = %d bytes\n"
1691 " current res = %d bytes\n" 1659 " current res = %d bytes\n"
@@ -1714,7 +1682,7 @@ xlog_print_tic_res(
1714 } 1682 }
1715 1683
1716 xfs_alert_tag(mp, XFS_PTAG_LOGRES, 1684 xfs_alert_tag(mp, XFS_PTAG_LOGRES,
1717 "xfs_log_write: reservation ran out. Need to up reservation"); 1685 "xlog_write: reservation ran out. Need to up reservation");
1718 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); 1686 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
1719} 1687}
1720 1688
@@ -1968,23 +1936,21 @@ xlog_write(
1968 *start_lsn = 0; 1936 *start_lsn = 0;
1969 1937
1970 len = xlog_write_calc_vec_length(ticket, log_vector); 1938 len = xlog_write_calc_vec_length(ticket, log_vector);
1971 if (log->l_cilp) {
1972 /*
1973 * Region headers and bytes are already accounted for.
1974 * We only need to take into account start records and
1975 * split regions in this function.
1976 */
1977 if (ticket->t_flags & XLOG_TIC_INITED)
1978 ticket->t_curr_res -= sizeof(xlog_op_header_t);
1979 1939
1980 /* 1940 /*
1981 * Commit record headers need to be accounted for. These 1941 * Region headers and bytes are already accounted for.
1982 * come in as separate writes so are easy to detect. 1942 * We only need to take into account start records and
1983 */ 1943 * split regions in this function.
1984 if (flags & (XLOG_COMMIT_TRANS | XLOG_UNMOUNT_TRANS)) 1944 */
1985 ticket->t_curr_res -= sizeof(xlog_op_header_t); 1945 if (ticket->t_flags & XLOG_TIC_INITED)
1986 } else 1946 ticket->t_curr_res -= sizeof(xlog_op_header_t);
1987 ticket->t_curr_res -= len; 1947
1948 /*
1949 * Commit record headers need to be accounted for. These
1950 * come in as separate writes so are easy to detect.
1951 */
1952 if (flags & (XLOG_COMMIT_TRANS | XLOG_UNMOUNT_TRANS))
1953 ticket->t_curr_res -= sizeof(xlog_op_header_t);
1988 1954
1989 if (ticket->t_curr_res < 0) 1955 if (ticket->t_curr_res < 0)
1990 xlog_print_tic_res(log->l_mp, ticket); 1956 xlog_print_tic_res(log->l_mp, ticket);
@@ -2931,8 +2897,7 @@ _xfs_log_force(
2931 2897
2932 XFS_STATS_INC(xs_log_force); 2898 XFS_STATS_INC(xs_log_force);
2933 2899
2934 if (log->l_cilp) 2900 xlog_cil_force(log);
2935 xlog_cil_force(log);
2936 2901
2937 spin_lock(&log->l_icloglock); 2902 spin_lock(&log->l_icloglock);
2938 2903
@@ -3081,11 +3046,9 @@ _xfs_log_force_lsn(
3081 3046
3082 XFS_STATS_INC(xs_log_force); 3047 XFS_STATS_INC(xs_log_force);
3083 3048
3084 if (log->l_cilp) { 3049 lsn = xlog_cil_force_lsn(log, lsn);
3085 lsn = xlog_cil_force_lsn(log, lsn); 3050 if (lsn == NULLCOMMITLSN)
3086 if (lsn == NULLCOMMITLSN) 3051 return 0;
3087 return 0;
3088 }
3089 3052
3090try_again: 3053try_again:
3091 spin_lock(&log->l_icloglock); 3054 spin_lock(&log->l_icloglock);
@@ -3653,7 +3616,7 @@ xfs_log_force_umount(
3653 * completed transactions are flushed to disk with the xfs_log_force() 3616 * completed transactions are flushed to disk with the xfs_log_force()
3654 * call below. 3617 * call below.
3655 */ 3618 */
3656 if (!logerror && (mp->m_flags & XFS_MOUNT_DELAYLOG)) 3619 if (!logerror)
3657 xlog_cil_force(log); 3620 xlog_cil_force(log);
3658 3621
3659 /* 3622 /*