xfs: separate shutdown from ticket reservation print helper
authorBrian Foster <bfoster@redhat.com>
Thu, 15 Jun 2017 04:29:48 +0000 (21:29 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 19 Jun 2017 15:59:10 +0000 (08:59 -0700)
xlog_print_tic_res() pre-dates delayed logging and the committed
items list (CIL) and thus retains some factoring warts, such as hard
coded function names in the output and the fact that it induces a
shutdown.

In preparation for more detailed logging of regular transaction
overrun situations, refactor xlog_print_tic_res() to be slightly
more generic. Reword some of the warning messages and pull the
shutdown into the callers.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_log.c
fs/xfs/xfs_log_cil.c

index 3731f13f63e982e50c0342ec7550c3e6e0a1294b..8b283f7cefeafc87d4e3531c4d3eff968f874e5b 100644 (file)
@@ -2024,7 +2024,7 @@ xlog_print_tic_res(
        };
 #undef REG_TYPE_STR
 
-       xfs_warn(mp, "xlog_write: reservation summary:");
+       xfs_warn(mp, "ticket reservation summary:");
        xfs_warn(mp, "  unit res    = %d bytes",
                 ticket->t_unit_res);
        xfs_warn(mp, "  current res = %d bytes",
@@ -2045,10 +2045,6 @@ xlog_print_tic_res(
                            "bad-rtype" : res_type_str[r_type]),
                            ticket->t_res_arr[i].r_len);
        }
-
-       xfs_alert_tag(mp, XFS_PTAG_LOGRES,
-               "xlog_write: reservation ran out. Need to up reservation");
-       xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR);
 }
 
 /*
@@ -2321,8 +2317,12 @@ xlog_write(
        if (flags & (XLOG_COMMIT_TRANS | XLOG_UNMOUNT_TRANS))
                ticket->t_curr_res -= sizeof(xlog_op_header_t);
 
-       if (ticket->t_curr_res < 0)
+       if (ticket->t_curr_res < 0) {
+               xfs_alert_tag(log->l_mp, XFS_PTAG_LOGRES,
+                    "ctx ticket reservation ran out. Need to up reservation");
                xlog_print_tic_res(log->l_mp, ticket);
+               xfs_force_shutdown(log->l_mp, SHUTDOWN_LOG_IO_ERROR);
+       }
 
        index = 0;
        lv = log_vector;
index 82f1cbcc4de15ce254322aaa50afb7cdfcb82ae0..52fe04229aa666b647139150b536289fb4b1a5b6 100644 (file)
@@ -987,8 +987,10 @@ xfs_log_commit_cil(
        xlog_cil_insert_items(log, tp);
 
        /* check we didn't blow the reservation */
-       if (tp->t_ticket->t_curr_res < 0)
+       if (tp->t_ticket->t_curr_res < 0) {
                xlog_print_tic_res(mp, tp->t_ticket);
+               xfs_force_shutdown(log->l_mp, SHUTDOWN_LOG_IO_ERROR);
+       }
 
        tp->t_commit_lsn = cil->xc_ctx->sequence;
        if (commit_lsn)