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.c175
1 files changed, 122 insertions, 53 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 29af51275ca9..9176995160ed 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -178,6 +178,83 @@ xlog_trace_iclog(xlog_in_core_t *iclog, uint state)
178#define xlog_trace_iclog(iclog,state) 178#define xlog_trace_iclog(iclog,state)
179#endif /* XFS_LOG_TRACE */ 179#endif /* XFS_LOG_TRACE */
180 180
181
182static void
183xlog_ins_ticketq(struct xlog_ticket **qp, struct xlog_ticket *tic)
184{
185 if (*qp) {
186 tic->t_next = (*qp);
187 tic->t_prev = (*qp)->t_prev;
188 (*qp)->t_prev->t_next = tic;
189 (*qp)->t_prev = tic;
190 } else {
191 tic->t_prev = tic->t_next = tic;
192 *qp = tic;
193 }
194
195 tic->t_flags |= XLOG_TIC_IN_Q;
196}
197
198static void
199xlog_del_ticketq(struct xlog_ticket **qp, struct xlog_ticket *tic)
200{
201 if (tic == tic->t_next) {
202 *qp = NULL;
203 } else {
204 *qp = tic->t_next;
205 tic->t_next->t_prev = tic->t_prev;
206 tic->t_prev->t_next = tic->t_next;
207 }
208
209 tic->t_next = tic->t_prev = NULL;
210 tic->t_flags &= ~XLOG_TIC_IN_Q;
211}
212
213static void
214xlog_grant_sub_space(struct log *log, int bytes)
215{
216 log->l_grant_write_bytes -= bytes;
217 if (log->l_grant_write_bytes < 0) {
218 log->l_grant_write_bytes += log->l_logsize;
219 log->l_grant_write_cycle--;
220 }
221
222 log->l_grant_reserve_bytes -= bytes;
223 if ((log)->l_grant_reserve_bytes < 0) {
224 log->l_grant_reserve_bytes += log->l_logsize;
225 log->l_grant_reserve_cycle--;
226 }
227
228}
229
230static void
231xlog_grant_add_space_write(struct log *log, int bytes)
232{
233 log->l_grant_write_bytes += bytes;
234 if (log->l_grant_write_bytes > log->l_logsize) {
235 log->l_grant_write_bytes -= log->l_logsize;
236 log->l_grant_write_cycle++;
237 }
238}
239
240static void
241xlog_grant_add_space_reserve(struct log *log, int bytes)
242{
243 log->l_grant_reserve_bytes += bytes;
244 if (log->l_grant_reserve_bytes > log->l_logsize) {
245 log->l_grant_reserve_bytes -= log->l_logsize;
246 log->l_grant_reserve_cycle++;
247 }
248}
249
250static inline void
251xlog_grant_add_space(struct log *log, int bytes)
252{
253 xlog_grant_add_space_write(log, bytes);
254 xlog_grant_add_space_reserve(log, bytes);
255}
256
257
181/* 258/*
182 * NOTES: 259 * NOTES:
183 * 260 *
@@ -326,7 +403,7 @@ xfs_log_release_iclog(xfs_mount_t *mp,
326 403
327 if (xlog_state_release_iclog(log, iclog)) { 404 if (xlog_state_release_iclog(log, iclog)) {
328 xfs_force_shutdown(mp, XFS_LOG_IO_ERROR); 405 xfs_force_shutdown(mp, XFS_LOG_IO_ERROR);
329 return(EIO); 406 return EIO;
330 } 407 }
331 408
332 return 0; 409 return 0;
@@ -428,7 +505,7 @@ xfs_log_mount(xfs_mount_t *mp,
428 if (readonly) 505 if (readonly)
429 vfsp->vfs_flag &= ~VFS_RDONLY; 506 vfsp->vfs_flag &= ~VFS_RDONLY;
430 507
431 error = xlog_recover(mp->m_log, readonly); 508 error = xlog_recover(mp->m_log);
432 509
433 if (readonly) 510 if (readonly)
434 vfsp->vfs_flag |= VFS_RDONLY; 511 vfsp->vfs_flag |= VFS_RDONLY;
@@ -479,7 +556,7 @@ xfs_log_unmount(xfs_mount_t *mp)
479 556
480 error = xfs_log_unmount_write(mp); 557 error = xfs_log_unmount_write(mp);
481 xfs_log_unmount_dealloc(mp); 558 xfs_log_unmount_dealloc(mp);
482 return (error); 559 return error;
483} 560}
484 561
485/* 562/*
@@ -651,7 +728,7 @@ xfs_log_write(xfs_mount_t * mp,
651 if ((error = xlog_write(mp, reg, nentries, tic, start_lsn, NULL, 0))) { 728 if ((error = xlog_write(mp, reg, nentries, tic, start_lsn, NULL, 0))) {
652 xfs_force_shutdown(mp, XFS_LOG_IO_ERROR); 729 xfs_force_shutdown(mp, XFS_LOG_IO_ERROR);
653 } 730 }
654 return (error); 731 return error;
655} /* xfs_log_write */ 732} /* xfs_log_write */
656 733
657 734
@@ -759,7 +836,7 @@ xfs_log_need_covered(xfs_mount_t *mp)
759 needed = 1; 836 needed = 1;
760 } 837 }
761 LOG_UNLOCK(log, s); 838 LOG_UNLOCK(log, s);
762 return(needed); 839 return needed;
763} 840}
764 841
765/****************************************************************************** 842/******************************************************************************
@@ -926,7 +1003,7 @@ xlog_bdstrat_cb(struct xfs_buf *bp)
926 XFS_BUF_ERROR(bp, EIO); 1003 XFS_BUF_ERROR(bp, EIO);
927 XFS_BUF_STALE(bp); 1004 XFS_BUF_STALE(bp);
928 xfs_biodone(bp); 1005 xfs_biodone(bp);
929 return (XFS_ERROR(EIO)); 1006 return XFS_ERROR(EIO);
930 1007
931 1008
932} 1009}
@@ -1186,7 +1263,7 @@ xlog_commit_record(xfs_mount_t *mp,
1186 iclog, XLOG_COMMIT_TRANS))) { 1263 iclog, XLOG_COMMIT_TRANS))) {
1187 xfs_force_shutdown(mp, XFS_LOG_IO_ERROR); 1264 xfs_force_shutdown(mp, XFS_LOG_IO_ERROR);
1188 } 1265 }
1189 return (error); 1266 return error;
1190} /* xlog_commit_record */ 1267} /* xlog_commit_record */
1191 1268
1192 1269
@@ -1320,8 +1397,7 @@ xlog_sync(xlog_t *log,
1320 1397
1321 /* move grant heads by roundoff in sync */ 1398 /* move grant heads by roundoff in sync */
1322 s = GRANT_LOCK(log); 1399 s = GRANT_LOCK(log);
1323 XLOG_GRANT_ADD_SPACE(log, roundoff, 'w'); 1400 xlog_grant_add_space(log, roundoff);
1324 XLOG_GRANT_ADD_SPACE(log, roundoff, 'r');
1325 GRANT_UNLOCK(log, s); 1401 GRANT_UNLOCK(log, s);
1326 1402
1327 /* put cycle number in every block */ 1403 /* put cycle number in every block */
@@ -1384,7 +1460,7 @@ xlog_sync(xlog_t *log,
1384 if ((error = XFS_bwrite(bp))) { 1460 if ((error = XFS_bwrite(bp))) {
1385 xfs_ioerror_alert("xlog_sync", log->l_mp, bp, 1461 xfs_ioerror_alert("xlog_sync", log->l_mp, bp,
1386 XFS_BUF_ADDR(bp)); 1462 XFS_BUF_ADDR(bp));
1387 return (error); 1463 return error;
1388 } 1464 }
1389 if (split) { 1465 if (split) {
1390 bp = iclog->ic_log->l_xbuf; 1466 bp = iclog->ic_log->l_xbuf;
@@ -1422,10 +1498,10 @@ xlog_sync(xlog_t *log,
1422 if ((error = XFS_bwrite(bp))) { 1498 if ((error = XFS_bwrite(bp))) {
1423 xfs_ioerror_alert("xlog_sync (split)", log->l_mp, 1499 xfs_ioerror_alert("xlog_sync (split)", log->l_mp,
1424 bp, XFS_BUF_ADDR(bp)); 1500 bp, XFS_BUF_ADDR(bp));
1425 return (error); 1501 return error;
1426 } 1502 }
1427 } 1503 }
1428 return (0); 1504 return 0;
1429} /* xlog_sync */ 1505} /* xlog_sync */
1430 1506
1431 1507
@@ -1515,7 +1591,6 @@ xlog_state_finish_copy(xlog_t *log,
1515 * print out info relating to regions written which consume 1591 * print out info relating to regions written which consume
1516 * the reservation 1592 * the reservation
1517 */ 1593 */
1518#if defined(XFS_LOG_RES_DEBUG)
1519STATIC void 1594STATIC void
1520xlog_print_tic_res(xfs_mount_t *mp, xlog_ticket_t *ticket) 1595xlog_print_tic_res(xfs_mount_t *mp, xlog_ticket_t *ticket)
1521{ 1596{
@@ -1605,11 +1680,11 @@ xlog_print_tic_res(xfs_mount_t *mp, xlog_ticket_t *ticket)
1605 ticket->t_res_arr_sum, ticket->t_res_o_flow, 1680 ticket->t_res_arr_sum, ticket->t_res_o_flow,
1606 ticket->t_res_num_ophdrs, ophdr_spc, 1681 ticket->t_res_num_ophdrs, ophdr_spc,
1607 ticket->t_res_arr_sum + 1682 ticket->t_res_arr_sum +
1608 ticket->t_res_o_flow + ophdr_spc, 1683 ticket->t_res_o_flow + ophdr_spc,
1609 ticket->t_res_num); 1684 ticket->t_res_num);
1610 1685
1611 for (i = 0; i < ticket->t_res_num; i++) { 1686 for (i = 0; i < ticket->t_res_num; i++) {
1612 uint r_type = ticket->t_res_arr[i].r_type; 1687 uint r_type = ticket->t_res_arr[i].r_type;
1613 cmn_err(CE_WARN, 1688 cmn_err(CE_WARN,
1614 "region[%u]: %s - %u bytes\n", 1689 "region[%u]: %s - %u bytes\n",
1615 i, 1690 i,
@@ -1618,9 +1693,6 @@ xlog_print_tic_res(xfs_mount_t *mp, xlog_ticket_t *ticket)
1618 ticket->t_res_arr[i].r_len); 1693 ticket->t_res_arr[i].r_len);
1619 } 1694 }
1620} 1695}
1621#else
1622#define xlog_print_tic_res(mp, ticket)
1623#endif
1624 1696
1625/* 1697/*
1626 * Write some region out to in-core log 1698 * Write some region out to in-core log
@@ -1726,7 +1798,7 @@ xlog_write(xfs_mount_t * mp,
1726 for (index = 0; index < nentries; ) { 1798 for (index = 0; index < nentries; ) {
1727 if ((error = xlog_state_get_iclog_space(log, len, &iclog, ticket, 1799 if ((error = xlog_state_get_iclog_space(log, len, &iclog, ticket,
1728 &contwr, &log_offset))) 1800 &contwr, &log_offset)))
1729 return (error); 1801 return error;
1730 1802
1731 ASSERT(log_offset <= iclog->ic_size - 1); 1803 ASSERT(log_offset <= iclog->ic_size - 1);
1732 ptr = (__psint_t) ((char *)iclog->ic_datap+log_offset); 1804 ptr = (__psint_t) ((char *)iclog->ic_datap+log_offset);
@@ -1831,7 +1903,7 @@ xlog_write(xfs_mount_t * mp,
1831 xlog_state_finish_copy(log, iclog, record_cnt, data_cnt); 1903 xlog_state_finish_copy(log, iclog, record_cnt, data_cnt);
1832 record_cnt = data_cnt = 0; 1904 record_cnt = data_cnt = 0;
1833 if ((error = xlog_state_release_iclog(log, iclog))) 1905 if ((error = xlog_state_release_iclog(log, iclog)))
1834 return (error); 1906 return error;
1835 break; /* don't increment index */ 1907 break; /* don't increment index */
1836 } else { /* copied entire region */ 1908 } else { /* copied entire region */
1837 index++; 1909 index++;
@@ -1845,7 +1917,7 @@ xlog_write(xfs_mount_t * mp,
1845 ASSERT(flags & XLOG_COMMIT_TRANS); 1917 ASSERT(flags & XLOG_COMMIT_TRANS);
1846 *commit_iclog = iclog; 1918 *commit_iclog = iclog;
1847 } else if ((error = xlog_state_release_iclog(log, iclog))) 1919 } else if ((error = xlog_state_release_iclog(log, iclog)))
1848 return (error); 1920 return error;
1849 if (index == nentries) 1921 if (index == nentries)
1850 return 0; /* we are done */ 1922 return 0; /* we are done */
1851 else 1923 else
@@ -1862,7 +1934,7 @@ xlog_write(xfs_mount_t * mp,
1862 *commit_iclog = iclog; 1934 *commit_iclog = iclog;
1863 return 0; 1935 return 0;
1864 } 1936 }
1865 return (xlog_state_release_iclog(log, iclog)); 1937 return xlog_state_release_iclog(log, iclog);
1866} /* xlog_write */ 1938} /* xlog_write */
1867 1939
1868 1940
@@ -1978,7 +2050,7 @@ xlog_get_lowest_lsn(
1978 } 2050 }
1979 lsn_log = lsn_log->ic_next; 2051 lsn_log = lsn_log->ic_next;
1980 } while (lsn_log != log->l_iclog); 2052 } while (lsn_log != log->l_iclog);
1981 return(lowest_lsn); 2053 return lowest_lsn;
1982} 2054}
1983 2055
1984 2056
@@ -2330,7 +2402,7 @@ restart:
2330 if (iclog->ic_refcnt == 1) { 2402 if (iclog->ic_refcnt == 1) {
2331 LOG_UNLOCK(log, s); 2403 LOG_UNLOCK(log, s);
2332 if ((error = xlog_state_release_iclog(log, iclog))) 2404 if ((error = xlog_state_release_iclog(log, iclog)))
2333 return (error); 2405 return error;
2334 } else { 2406 } else {
2335 iclog->ic_refcnt--; 2407 iclog->ic_refcnt--;
2336 LOG_UNLOCK(log, s); 2408 LOG_UNLOCK(log, s);
@@ -2389,7 +2461,7 @@ xlog_grant_log_space(xlog_t *log,
2389 2461
2390 /* something is already sleeping; insert new transaction at end */ 2462 /* something is already sleeping; insert new transaction at end */
2391 if (log->l_reserve_headq) { 2463 if (log->l_reserve_headq) {
2392 XLOG_INS_TICKETQ(log->l_reserve_headq, tic); 2464 xlog_ins_ticketq(&log->l_reserve_headq, tic);
2393 xlog_trace_loggrant(log, tic, 2465 xlog_trace_loggrant(log, tic,
2394 "xlog_grant_log_space: sleep 1"); 2466 "xlog_grant_log_space: sleep 1");
2395 /* 2467 /*
@@ -2422,7 +2494,7 @@ redo:
2422 log->l_grant_reserve_bytes); 2494 log->l_grant_reserve_bytes);
2423 if (free_bytes < need_bytes) { 2495 if (free_bytes < need_bytes) {
2424 if ((tic->t_flags & XLOG_TIC_IN_Q) == 0) 2496 if ((tic->t_flags & XLOG_TIC_IN_Q) == 0)
2425 XLOG_INS_TICKETQ(log->l_reserve_headq, tic); 2497 xlog_ins_ticketq(&log->l_reserve_headq, tic);
2426 xlog_trace_loggrant(log, tic, 2498 xlog_trace_loggrant(log, tic,
2427 "xlog_grant_log_space: sleep 2"); 2499 "xlog_grant_log_space: sleep 2");
2428 XFS_STATS_INC(xs_sleep_logspace); 2500 XFS_STATS_INC(xs_sleep_logspace);
@@ -2439,11 +2511,10 @@ redo:
2439 s = GRANT_LOCK(log); 2511 s = GRANT_LOCK(log);
2440 goto redo; 2512 goto redo;
2441 } else if (tic->t_flags & XLOG_TIC_IN_Q) 2513 } else if (tic->t_flags & XLOG_TIC_IN_Q)
2442 XLOG_DEL_TICKETQ(log->l_reserve_headq, tic); 2514 xlog_del_ticketq(&log->l_reserve_headq, tic);
2443 2515
2444 /* we've got enough space */ 2516 /* we've got enough space */
2445 XLOG_GRANT_ADD_SPACE(log, need_bytes, 'w'); 2517 xlog_grant_add_space(log, need_bytes);
2446 XLOG_GRANT_ADD_SPACE(log, need_bytes, 'r');
2447#ifdef DEBUG 2518#ifdef DEBUG
2448 tail_lsn = log->l_tail_lsn; 2519 tail_lsn = log->l_tail_lsn;
2449 /* 2520 /*
@@ -2464,7 +2535,7 @@ redo:
2464 2535
2465 error_return: 2536 error_return:
2466 if (tic->t_flags & XLOG_TIC_IN_Q) 2537 if (tic->t_flags & XLOG_TIC_IN_Q)
2467 XLOG_DEL_TICKETQ(log->l_reserve_headq, tic); 2538 xlog_del_ticketq(&log->l_reserve_headq, tic);
2468 xlog_trace_loggrant(log, tic, "xlog_grant_log_space: err_ret"); 2539 xlog_trace_loggrant(log, tic, "xlog_grant_log_space: err_ret");
2469 /* 2540 /*
2470 * If we are failing, make sure the ticket doesn't have any 2541 * If we are failing, make sure the ticket doesn't have any
@@ -2498,7 +2569,7 @@ xlog_regrant_write_log_space(xlog_t *log,
2498 XLOG_TIC_RESET_RES(tic); 2569 XLOG_TIC_RESET_RES(tic);
2499 2570
2500 if (tic->t_cnt > 0) 2571 if (tic->t_cnt > 0)
2501 return (0); 2572 return 0;
2502 2573
2503#ifdef DEBUG 2574#ifdef DEBUG
2504 if (log->l_flags & XLOG_ACTIVE_RECOVERY) 2575 if (log->l_flags & XLOG_ACTIVE_RECOVERY)
@@ -2533,7 +2604,7 @@ xlog_regrant_write_log_space(xlog_t *log,
2533 2604
2534 if (ntic != log->l_write_headq) { 2605 if (ntic != log->l_write_headq) {
2535 if ((tic->t_flags & XLOG_TIC_IN_Q) == 0) 2606 if ((tic->t_flags & XLOG_TIC_IN_Q) == 0)
2536 XLOG_INS_TICKETQ(log->l_write_headq, tic); 2607 xlog_ins_ticketq(&log->l_write_headq, tic);
2537 2608
2538 xlog_trace_loggrant(log, tic, 2609 xlog_trace_loggrant(log, tic,
2539 "xlog_regrant_write_log_space: sleep 1"); 2610 "xlog_regrant_write_log_space: sleep 1");
@@ -2565,7 +2636,7 @@ redo:
2565 log->l_grant_write_bytes); 2636 log->l_grant_write_bytes);
2566 if (free_bytes < need_bytes) { 2637 if (free_bytes < need_bytes) {
2567 if ((tic->t_flags & XLOG_TIC_IN_Q) == 0) 2638 if ((tic->t_flags & XLOG_TIC_IN_Q) == 0)
2568 XLOG_INS_TICKETQ(log->l_write_headq, tic); 2639 xlog_ins_ticketq(&log->l_write_headq, tic);
2569 XFS_STATS_INC(xs_sleep_logspace); 2640 XFS_STATS_INC(xs_sleep_logspace);
2570 sv_wait(&tic->t_sema, PINOD|PLTWAIT, &log->l_grant_lock, s); 2641 sv_wait(&tic->t_sema, PINOD|PLTWAIT, &log->l_grant_lock, s);
2571 2642
@@ -2581,9 +2652,10 @@ redo:
2581 s = GRANT_LOCK(log); 2652 s = GRANT_LOCK(log);
2582 goto redo; 2653 goto redo;
2583 } else if (tic->t_flags & XLOG_TIC_IN_Q) 2654 } else if (tic->t_flags & XLOG_TIC_IN_Q)
2584 XLOG_DEL_TICKETQ(log->l_write_headq, tic); 2655 xlog_del_ticketq(&log->l_write_headq, tic);
2585 2656
2586 XLOG_GRANT_ADD_SPACE(log, need_bytes, 'w'); /* we've got enough space */ 2657 /* we've got enough space */
2658 xlog_grant_add_space_write(log, need_bytes);
2587#ifdef DEBUG 2659#ifdef DEBUG
2588 tail_lsn = log->l_tail_lsn; 2660 tail_lsn = log->l_tail_lsn;
2589 if (CYCLE_LSN(tail_lsn) != log->l_grant_write_cycle) { 2661 if (CYCLE_LSN(tail_lsn) != log->l_grant_write_cycle) {
@@ -2595,12 +2667,12 @@ redo:
2595 xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: exit"); 2667 xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: exit");
2596 xlog_verify_grant_head(log, 1); 2668 xlog_verify_grant_head(log, 1);
2597 GRANT_UNLOCK(log, s); 2669 GRANT_UNLOCK(log, s);
2598 return (0); 2670 return 0;
2599 2671
2600 2672
2601 error_return: 2673 error_return:
2602 if (tic->t_flags & XLOG_TIC_IN_Q) 2674 if (tic->t_flags & XLOG_TIC_IN_Q)
2603 XLOG_DEL_TICKETQ(log->l_reserve_headq, tic); 2675 xlog_del_ticketq(&log->l_reserve_headq, tic);
2604 xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: err_ret"); 2676 xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: err_ret");
2605 /* 2677 /*
2606 * If we are failing, make sure the ticket doesn't have any 2678 * If we are failing, make sure the ticket doesn't have any
@@ -2633,8 +2705,7 @@ xlog_regrant_reserve_log_space(xlog_t *log,
2633 ticket->t_cnt--; 2705 ticket->t_cnt--;
2634 2706
2635 s = GRANT_LOCK(log); 2707 s = GRANT_LOCK(log);
2636 XLOG_GRANT_SUB_SPACE(log, ticket->t_curr_res, 'w'); 2708 xlog_grant_sub_space(log, ticket->t_curr_res);
2637 XLOG_GRANT_SUB_SPACE(log, ticket->t_curr_res, 'r');
2638 ticket->t_curr_res = ticket->t_unit_res; 2709 ticket->t_curr_res = ticket->t_unit_res;
2639 XLOG_TIC_RESET_RES(ticket); 2710 XLOG_TIC_RESET_RES(ticket);
2640 xlog_trace_loggrant(log, ticket, 2711 xlog_trace_loggrant(log, ticket,
@@ -2647,7 +2718,7 @@ xlog_regrant_reserve_log_space(xlog_t *log,
2647 return; 2718 return;
2648 } 2719 }
2649 2720
2650 XLOG_GRANT_ADD_SPACE(log, ticket->t_unit_res, 'r'); 2721 xlog_grant_add_space_reserve(log, ticket->t_unit_res);
2651 xlog_trace_loggrant(log, ticket, 2722 xlog_trace_loggrant(log, ticket,
2652 "xlog_regrant_reserve_log_space: exit"); 2723 "xlog_regrant_reserve_log_space: exit");
2653 xlog_verify_grant_head(log, 0); 2724 xlog_verify_grant_head(log, 0);
@@ -2683,8 +2754,7 @@ xlog_ungrant_log_space(xlog_t *log,
2683 s = GRANT_LOCK(log); 2754 s = GRANT_LOCK(log);
2684 xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: enter"); 2755 xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: enter");
2685 2756
2686 XLOG_GRANT_SUB_SPACE(log, ticket->t_curr_res, 'w'); 2757 xlog_grant_sub_space(log, ticket->t_curr_res);
2687 XLOG_GRANT_SUB_SPACE(log, ticket->t_curr_res, 'r');
2688 2758
2689 xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: sub current"); 2759 xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: sub current");
2690 2760
@@ -2693,8 +2763,7 @@ xlog_ungrant_log_space(xlog_t *log,
2693 */ 2763 */
2694 if (ticket->t_cnt > 0) { 2764 if (ticket->t_cnt > 0) {
2695 ASSERT(ticket->t_flags & XLOG_TIC_PERM_RESERV); 2765 ASSERT(ticket->t_flags & XLOG_TIC_PERM_RESERV);
2696 XLOG_GRANT_SUB_SPACE(log, ticket->t_unit_res*ticket->t_cnt,'w'); 2766 xlog_grant_sub_space(log, ticket->t_unit_res*ticket->t_cnt);
2697 XLOG_GRANT_SUB_SPACE(log, ticket->t_unit_res*ticket->t_cnt,'r');
2698 } 2767 }
2699 2768
2700 xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: exit"); 2769 xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: exit");
@@ -2768,7 +2837,7 @@ xlog_state_release_iclog(xlog_t *log,
2768 if (sync) { 2837 if (sync) {
2769 return xlog_sync(log, iclog); 2838 return xlog_sync(log, iclog);
2770 } 2839 }
2771 return (0); 2840 return 0;
2772 2841
2773} /* xlog_state_release_iclog */ 2842} /* xlog_state_release_iclog */
2774 2843
@@ -3058,7 +3127,7 @@ try_again:
3058 } while (iclog != log->l_iclog); 3127 } while (iclog != log->l_iclog);
3059 3128
3060 LOG_UNLOCK(log, s); 3129 LOG_UNLOCK(log, s);
3061 return (0); 3130 return 0;
3062} /* xlog_state_sync */ 3131} /* xlog_state_sync */
3063 3132
3064 3133
@@ -3476,12 +3545,12 @@ xlog_state_ioerror(
3476 ic->ic_state = XLOG_STATE_IOERROR; 3545 ic->ic_state = XLOG_STATE_IOERROR;
3477 ic = ic->ic_next; 3546 ic = ic->ic_next;
3478 } while (ic != iclog); 3547 } while (ic != iclog);
3479 return (0); 3548 return 0;
3480 } 3549 }
3481 /* 3550 /*
3482 * Return non-zero, if state transition has already happened. 3551 * Return non-zero, if state transition has already happened.
3483 */ 3552 */
3484 return (1); 3553 return 1;
3485} 3554}
3486 3555
3487/* 3556/*
@@ -3518,7 +3587,7 @@ xfs_log_force_umount(
3518 log->l_flags & XLOG_ACTIVE_RECOVERY) { 3587 log->l_flags & XLOG_ACTIVE_RECOVERY) {
3519 mp->m_flags |= XFS_MOUNT_FS_SHUTDOWN; 3588 mp->m_flags |= XFS_MOUNT_FS_SHUTDOWN;
3520 XFS_BUF_DONE(mp->m_sb_bp); 3589 XFS_BUF_DONE(mp->m_sb_bp);
3521 return (0); 3590 return 0;
3522 } 3591 }
3523 3592
3524 /* 3593 /*
@@ -3527,7 +3596,7 @@ xfs_log_force_umount(
3527 */ 3596 */
3528 if (logerror && log->l_iclog->ic_state & XLOG_STATE_IOERROR) { 3597 if (logerror && log->l_iclog->ic_state & XLOG_STATE_IOERROR) {
3529 ASSERT(XLOG_FORCED_SHUTDOWN(log)); 3598 ASSERT(XLOG_FORCED_SHUTDOWN(log));
3530 return (1); 3599 return 1;
3531 } 3600 }
3532 retval = 0; 3601 retval = 0;
3533 /* 3602 /*
@@ -3609,7 +3678,7 @@ xfs_log_force_umount(
3609 } 3678 }
3610#endif 3679#endif
3611 /* return non-zero if log IOERROR transition had already happened */ 3680 /* return non-zero if log IOERROR transition had already happened */
3612 return (retval); 3681 return retval;
3613} 3682}
3614 3683
3615STATIC int 3684STATIC int
@@ -3623,8 +3692,8 @@ xlog_iclogs_empty(xlog_t *log)
3623 * any language. 3692 * any language.
3624 */ 3693 */
3625 if (iclog->ic_header.h_num_logops) 3694 if (iclog->ic_header.h_num_logops)
3626 return(0); 3695 return 0;
3627 iclog = iclog->ic_next; 3696 iclog = iclog->ic_next;
3628 } while (iclog != log->l_iclog); 3697 } while (iclog != log->l_iclog);
3629 return(1); 3698 return 1;
3630} 3699}