• Home
  • Raw
  • Download

Lines Matching refs:log

59 STATIC int	 xlog_space_left(xlog_t *log, int cycle, int bytes);
60 STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog);
61 STATIC void xlog_dealloc_log(xlog_t *log);
70 STATIC void xlog_state_do_callback(xlog_t *log,int aborted, xlog_in_core_t *iclog);
71 STATIC int xlog_state_get_iclog_space(xlog_t *log,
77 STATIC int xlog_state_release_iclog(xlog_t *log,
79 STATIC void xlog_state_switch_iclogs(xlog_t *log,
82 STATIC int xlog_state_sync(xlog_t *log,
86 STATIC int xlog_state_sync_all(xlog_t *log, uint flags, int *log_flushed);
87 STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog);
90 STATIC int xlog_grant_log_space(xlog_t *log,
94 STATIC void xlog_regrant_reserve_log_space(xlog_t *log,
96 STATIC int xlog_regrant_write_log_space(xlog_t *log,
98 STATIC void xlog_ungrant_log_space(xlog_t *log,
103 STATIC xlog_ticket_t *xlog_ticket_alloc(xlog_t *log,
110 STATIC void xlog_verify_dest_ptr(xlog_t *log, __psint_t ptr);
111 STATIC void xlog_verify_grant_head(xlog_t *log, int equals);
112 STATIC void xlog_verify_iclog(xlog_t *log, xlog_in_core_t *iclog,
114 STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog,
123 STATIC int xlog_iclogs_empty(xlog_t *log);
131 xlog_trace_loggrant_alloc(xlog_t *log) in xlog_trace_loggrant_alloc() argument
133 log->l_grant_trace = ktrace_alloc(XLOG_TRACE_LOGGRANT_SIZE, KM_NOFS); in xlog_trace_loggrant_alloc()
137 xlog_trace_loggrant_dealloc(xlog_t *log) in xlog_trace_loggrant_dealloc() argument
139 ktrace_free(log->l_grant_trace); in xlog_trace_loggrant_dealloc()
143 xlog_trace_loggrant(xlog_t *log, xlog_ticket_t *tic, xfs_caddr_t string) in xlog_trace_loggrant() argument
150 ktrace_enter(log->l_grant_trace, in xlog_trace_loggrant()
152 (void *)log->l_reserve_headq, in xlog_trace_loggrant()
153 (void *)log->l_write_headq, in xlog_trace_loggrant()
154 (void *)((unsigned long)log->l_grant_reserve_cycle), in xlog_trace_loggrant()
155 (void *)((unsigned long)log->l_grant_reserve_bytes), in xlog_trace_loggrant()
156 (void *)((unsigned long)log->l_grant_write_cycle), in xlog_trace_loggrant()
157 (void *)((unsigned long)log->l_grant_write_bytes), in xlog_trace_loggrant()
158 (void *)((unsigned long)log->l_curr_cycle), in xlog_trace_loggrant()
159 (void *)((unsigned long)log->l_curr_block), in xlog_trace_loggrant()
160 (void *)((unsigned long)CYCLE_LSN(log->l_tail_lsn)), in xlog_trace_loggrant()
161 (void *)((unsigned long)BLOCK_LSN(log->l_tail_lsn)), in xlog_trace_loggrant()
194 #define xlog_trace_loggrant_alloc(log) argument
195 #define xlog_trace_loggrant_dealloc(log) argument
196 #define xlog_trace_loggrant(log,tic,string) argument
237 xlog_grant_sub_space(struct log *log, int bytes) in xlog_grant_sub_space() argument
239 log->l_grant_write_bytes -= bytes; in xlog_grant_sub_space()
240 if (log->l_grant_write_bytes < 0) { in xlog_grant_sub_space()
241 log->l_grant_write_bytes += log->l_logsize; in xlog_grant_sub_space()
242 log->l_grant_write_cycle--; in xlog_grant_sub_space()
245 log->l_grant_reserve_bytes -= bytes; in xlog_grant_sub_space()
246 if ((log)->l_grant_reserve_bytes < 0) { in xlog_grant_sub_space()
247 log->l_grant_reserve_bytes += log->l_logsize; in xlog_grant_sub_space()
248 log->l_grant_reserve_cycle--; in xlog_grant_sub_space()
254 xlog_grant_add_space_write(struct log *log, int bytes) in xlog_grant_add_space_write() argument
256 int tmp = log->l_logsize - log->l_grant_write_bytes; in xlog_grant_add_space_write()
258 log->l_grant_write_bytes += bytes; in xlog_grant_add_space_write()
260 log->l_grant_write_cycle++; in xlog_grant_add_space_write()
261 log->l_grant_write_bytes = bytes - tmp; in xlog_grant_add_space_write()
266 xlog_grant_add_space_reserve(struct log *log, int bytes) in xlog_grant_add_space_reserve() argument
268 int tmp = log->l_logsize - log->l_grant_reserve_bytes; in xlog_grant_add_space_reserve()
270 log->l_grant_reserve_bytes += bytes; in xlog_grant_add_space_reserve()
272 log->l_grant_reserve_cycle++; in xlog_grant_add_space_reserve()
273 log->l_grant_reserve_bytes = bytes - tmp; in xlog_grant_add_space_reserve()
278 xlog_grant_add_space(struct log *log, int bytes) in xlog_grant_add_space() argument
280 xlog_grant_add_space_write(log, bytes); in xlog_grant_add_space()
281 xlog_grant_add_space_reserve(log, bytes); in xlog_grant_add_space()
335 xlog_t *log = mp->m_log; in xfs_log_done() local
339 if (XLOG_FORCED_SHUTDOWN(log) || in xfs_log_done()
360 xlog_trace_loggrant(log, ticket, "xfs_log_done: (non-permanent)"); in xfs_log_done()
361 xlog_ungrant_log_space(log, ticket); in xfs_log_done()
364 xlog_trace_loggrant(log, ticket, "xfs_log_done: (permanent)"); in xfs_log_done()
365 xlog_regrant_reserve_log_space(log, ticket); in xfs_log_done()
397 xlog_t *log = mp->m_log; in _xfs_log_force() local
407 if (log->l_flags & XLOG_IO_ERROR) in _xfs_log_force()
410 return xlog_state_sync_all(log, flags, log_flushed); in _xfs_log_force()
412 return xlog_state_sync(log, lsn, flags, log_flushed); in _xfs_log_force()
466 xlog_t *log = mp->m_log; in xfs_log_release_iclog() local
469 if (xlog_state_release_iclog(log, iclog)) { in xfs_log_release_iclog()
496 xlog_t *log = mp->m_log; in xfs_log_reserve() local
503 if (XLOG_FORCED_SHUTDOWN(log)) in xfs_log_reserve()
511 xlog_trace_loggrant(log, internal_ticket, "xfs_log_reserve: existing ticket (permanent trans)"); in xfs_log_reserve()
513 retval = xlog_regrant_write_log_space(log, internal_ticket); in xfs_log_reserve()
516 internal_ticket = xlog_ticket_alloc(log, unit_bytes, cnt, in xfs_log_reserve()
522 xlog_trace_loggrant(log, internal_ticket, in xfs_log_reserve()
529 retval = xlog_grant_log_space(log, internal_ticket); in xfs_log_reserve()
667 xlog_t *log = mp->m_log; in xfs_log_unmount_write() local
692 ASSERT(error || !(XLOG_FORCED_SHUTDOWN(log))); in xfs_log_unmount_write()
695 first_iclog = iclog = log->l_iclog; in xfs_log_unmount_write()
704 if (! (XLOG_FORCED_SHUTDOWN(log))) { in xfs_log_unmount_write()
729 spin_lock(&log->l_icloglock); in xfs_log_unmount_write()
730 iclog = log->l_iclog; in xfs_log_unmount_write()
732 xlog_state_want_sync(log, iclog); in xfs_log_unmount_write()
733 spin_unlock(&log->l_icloglock); in xfs_log_unmount_write()
734 error = xlog_state_release_iclog(log, iclog); in xfs_log_unmount_write()
736 spin_lock(&log->l_icloglock); in xfs_log_unmount_write()
739 if (!XLOG_FORCED_SHUTDOWN(log)) { in xfs_log_unmount_write()
741 &log->l_icloglock, s); in xfs_log_unmount_write()
743 spin_unlock(&log->l_icloglock); in xfs_log_unmount_write()
746 spin_unlock(&log->l_icloglock); in xfs_log_unmount_write()
749 xlog_trace_loggrant(log, tic, "unmount rec"); in xfs_log_unmount_write()
750 xlog_ungrant_log_space(log, tic); in xfs_log_unmount_write()
767 spin_lock(&log->l_icloglock); in xfs_log_unmount_write()
768 iclog = log->l_iclog; in xfs_log_unmount_write()
771 xlog_state_want_sync(log, iclog); in xfs_log_unmount_write()
772 spin_unlock(&log->l_icloglock); in xfs_log_unmount_write()
773 error = xlog_state_release_iclog(log, iclog); in xfs_log_unmount_write()
775 spin_lock(&log->l_icloglock); in xfs_log_unmount_write()
782 &log->l_icloglock, s); in xfs_log_unmount_write()
784 spin_unlock(&log->l_icloglock); in xfs_log_unmount_write()
817 xlog_t *log = mp->m_log; in xfs_log_write() local
819 if (XLOG_FORCED_SHUTDOWN(log)) in xfs_log_write()
834 xlog_t *log = mp->m_log; in xfs_log_move_tail() local
837 if (XLOG_FORCED_SHUTDOWN(log)) in xfs_log_move_tail()
842 spin_lock(&log->l_icloglock); in xfs_log_move_tail()
843 tail_lsn = log->l_last_sync_lsn; in xfs_log_move_tail()
844 spin_unlock(&log->l_icloglock); in xfs_log_move_tail()
847 spin_lock(&log->l_grant_lock); in xfs_log_move_tail()
853 log->l_tail_lsn = tail_lsn; in xfs_log_move_tail()
856 if ((tic = log->l_write_headq)) { in xfs_log_move_tail()
858 if (log->l_flags & XLOG_ACTIVE_RECOVERY) in xfs_log_move_tail()
861 cycle = log->l_grant_write_cycle; in xfs_log_move_tail()
862 bytes = log->l_grant_write_bytes; in xfs_log_move_tail()
863 free_bytes = xlog_space_left(log, cycle, bytes); in xfs_log_move_tail()
873 } while (tic != log->l_write_headq); in xfs_log_move_tail()
875 if ((tic = log->l_reserve_headq)) { in xfs_log_move_tail()
877 if (log->l_flags & XLOG_ACTIVE_RECOVERY) in xfs_log_move_tail()
880 cycle = log->l_grant_reserve_cycle; in xfs_log_move_tail()
881 bytes = log->l_grant_reserve_bytes; in xfs_log_move_tail()
882 free_bytes = xlog_space_left(log, cycle, bytes); in xfs_log_move_tail()
894 } while (tic != log->l_reserve_headq); in xfs_log_move_tail()
896 spin_unlock(&log->l_grant_lock); in xfs_log_move_tail()
909 xlog_t *log = mp->m_log; in xfs_log_need_covered() local
914 spin_lock(&log->l_icloglock); in xfs_log_need_covered()
915 if (((log->l_covered_state == XLOG_STATE_COVER_NEED) || in xfs_log_need_covered()
916 (log->l_covered_state == XLOG_STATE_COVER_NEED2)) in xfs_log_need_covered()
917 && !xfs_trans_ail_tail(log->l_ailp) in xfs_log_need_covered()
918 && xlog_iclogs_empty(log)) { in xfs_log_need_covered()
919 if (log->l_covered_state == XLOG_STATE_COVER_NEED) in xfs_log_need_covered()
920 log->l_covered_state = XLOG_STATE_COVER_DONE; in xfs_log_need_covered()
922 ASSERT(log->l_covered_state == XLOG_STATE_COVER_NEED2); in xfs_log_need_covered()
923 log->l_covered_state = XLOG_STATE_COVER_DONE2; in xfs_log_need_covered()
927 spin_unlock(&log->l_icloglock); in xfs_log_need_covered()
952 xlog_t *log = mp->m_log; in xlog_assign_tail_lsn() local
955 spin_lock(&log->l_grant_lock); in xlog_assign_tail_lsn()
957 log->l_tail_lsn = tail_lsn; in xlog_assign_tail_lsn()
959 tail_lsn = log->l_tail_lsn = log->l_last_sync_lsn; in xlog_assign_tail_lsn()
961 spin_unlock(&log->l_grant_lock); in xlog_assign_tail_lsn()
982 xlog_space_left(xlog_t *log, int cycle, int bytes) in xlog_space_left() argument
988 tail_bytes = BBTOB(BLOCK_LSN(log->l_tail_lsn)); in xlog_space_left()
989 tail_cycle = CYCLE_LSN(log->l_tail_lsn); in xlog_space_left()
991 free_bytes = log->l_logsize - (bytes - tail_bytes); in xlog_space_left()
1003 xfs_fs_cmn_err(CE_ALERT, log->l_mp, in xlog_space_left()
1009 free_bytes = log->l_logsize; in xlog_space_left()
1120 xlog_t *log) in xlog_get_iclog_buffer_size() argument
1126 log->l_iclog_bufs = XLOG_MAX_ICLOGS; in xlog_get_iclog_buffer_size()
1128 log->l_iclog_bufs = mp->m_logbufs; in xlog_get_iclog_buffer_size()
1134 size = log->l_iclog_size = mp->m_logbsize; in xlog_get_iclog_buffer_size()
1135 log->l_iclog_size_log = 0; in xlog_get_iclog_buffer_size()
1137 log->l_iclog_size_log++; in xlog_get_iclog_buffer_size()
1149 log->l_iclog_hsize = xhdrs << BBSHIFT; in xlog_get_iclog_buffer_size()
1150 log->l_iclog_heads = xhdrs; in xlog_get_iclog_buffer_size()
1153 log->l_iclog_hsize = BBSIZE; in xlog_get_iclog_buffer_size()
1154 log->l_iclog_heads = 1; in xlog_get_iclog_buffer_size()
1160 log->l_iclog_size = XLOG_BIG_RECORD_BSIZE; in xlog_get_iclog_buffer_size()
1161 log->l_iclog_size_log = XLOG_BIG_RECORD_BSHIFT; in xlog_get_iclog_buffer_size()
1164 log->l_iclog_hsize = BBSIZE; in xlog_get_iclog_buffer_size()
1165 log->l_iclog_heads = 1; in xlog_get_iclog_buffer_size()
1172 log->l_iclog_size = XLOG_BIG_RECORD_BSIZE; in xlog_get_iclog_buffer_size()
1173 log->l_iclog_size_log = XLOG_BIG_RECORD_BSHIFT; in xlog_get_iclog_buffer_size()
1177 log->l_iclog_bufs = 3; in xlog_get_iclog_buffer_size()
1180 log->l_iclog_bufs = 4; in xlog_get_iclog_buffer_size()
1183 log->l_iclog_bufs = 8; in xlog_get_iclog_buffer_size()
1194 mp->m_logbufs = log->l_iclog_bufs; in xlog_get_iclog_buffer_size()
1196 mp->m_logbsize = log->l_iclog_size; in xlog_get_iclog_buffer_size()
1211 xlog_t *log; in xlog_alloc_log() local
1219 log = kmem_zalloc(sizeof(xlog_t), KM_MAYFAIL); in xlog_alloc_log()
1220 if (!log) in xlog_alloc_log()
1223 log->l_mp = mp; in xlog_alloc_log()
1224 log->l_targ = log_target; in xlog_alloc_log()
1225 log->l_logsize = BBTOB(num_bblks); in xlog_alloc_log()
1226 log->l_logBBstart = blk_offset; in xlog_alloc_log()
1227 log->l_logBBsize = num_bblks; in xlog_alloc_log()
1228 log->l_covered_state = XLOG_STATE_COVER_IDLE; in xlog_alloc_log()
1229 log->l_flags |= XLOG_ACTIVE_RECOVERY; in xlog_alloc_log()
1231 log->l_prev_block = -1; in xlog_alloc_log()
1232 log->l_tail_lsn = xlog_assign_lsn(1, 0); in xlog_alloc_log()
1234 log->l_last_sync_lsn = log->l_tail_lsn; in xlog_alloc_log()
1235 log->l_curr_cycle = 1; /* 0 is bad since this is initial value */ in xlog_alloc_log()
1236 log->l_grant_reserve_cycle = 1; in xlog_alloc_log()
1237 log->l_grant_write_cycle = 1; in xlog_alloc_log()
1240 log->l_sectbb_log = mp->m_sb.sb_logsectlog - BBSHIFT; in xlog_alloc_log()
1241 ASSERT(log->l_sectbb_log <= mp->m_sectbb_log); in xlog_alloc_log()
1243 ASSERT(log->l_sectbb_log == 0 || in xlog_alloc_log()
1244 log->l_logBBstart == 0 || in xlog_alloc_log()
1248 log->l_sectbb_mask = (1 << log->l_sectbb_log) - 1; in xlog_alloc_log()
1250 xlog_get_iclog_buffer_size(mp, log); in xlog_alloc_log()
1252 bp = xfs_buf_get_empty(log->l_iclog_size, mp->m_logdev_targp); in xlog_alloc_log()
1260 log->l_xbuf = bp; in xlog_alloc_log()
1262 spin_lock_init(&log->l_icloglock); in xlog_alloc_log()
1263 spin_lock_init(&log->l_grant_lock); in xlog_alloc_log()
1264 sv_init(&log->l_flush_wait, 0, "flush_wait"); in xlog_alloc_log()
1266 xlog_trace_loggrant_alloc(log); in xlog_alloc_log()
1270 iclogp = &log->l_iclog; in xlog_alloc_log()
1278 iclogsize = log->l_iclog_size; in xlog_alloc_log()
1279 ASSERT(log->l_iclog_size >= 4096); in xlog_alloc_log()
1280 for (i=0; i < log->l_iclog_bufs; i++) { in xlog_alloc_log()
1289 bp = xfs_buf_get_noaddr(log->l_iclog_size, mp->m_logdev_targp); in xlog_alloc_log()
1300 log->l_iclog_bak[i] = (xfs_caddr_t)&(iclog->ic_header); in xlog_alloc_log()
1306 xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? 2 : 1); in xlog_alloc_log()
1307 head->h_size = cpu_to_be32(log->l_iclog_size); in xlog_alloc_log()
1312 iclog->ic_size = XFS_BUF_SIZE(bp) - log->l_iclog_hsize; in xlog_alloc_log()
1314 iclog->ic_log = log; in xlog_alloc_log()
1318 iclog->ic_datap = (char *)iclog->ic_data + log->l_iclog_hsize; in xlog_alloc_log()
1329 *iclogp = log->l_iclog; /* complete ring */ in xlog_alloc_log()
1330 log->l_iclog->ic_prev = prev_iclog; /* re-write 1st prev ptr */ in xlog_alloc_log()
1332 return log; in xlog_alloc_log()
1335 for (iclog = log->l_iclog; iclog; iclog = prev_iclog) { in xlog_alloc_log()
1345 spinlock_destroy(&log->l_icloglock); in xlog_alloc_log()
1346 spinlock_destroy(&log->l_grant_lock); in xlog_alloc_log()
1347 xlog_trace_loggrant_dealloc(log); in xlog_alloc_log()
1348 xfs_buf_free(log->l_xbuf); in xlog_alloc_log()
1350 kmem_free(log); in xlog_alloc_log()
1392 xlog_t *log = mp->m_log; /* pointer to the log */ in xlog_grant_push_ail() local
1401 ASSERT(BTOBB(need_bytes) < log->l_logBBsize); in xlog_grant_push_ail()
1403 spin_lock(&log->l_grant_lock); in xlog_grant_push_ail()
1404 free_bytes = xlog_space_left(log, in xlog_grant_push_ail()
1405 log->l_grant_reserve_cycle, in xlog_grant_push_ail()
1406 log->l_grant_reserve_bytes); in xlog_grant_push_ail()
1407 tail_lsn = log->l_tail_lsn; in xlog_grant_push_ail()
1416 free_threshold = MAX(free_threshold, (log->l_logBBsize >> 2)); in xlog_grant_push_ail()
1421 if (threshold_block >= log->l_logBBsize) { in xlog_grant_push_ail()
1422 threshold_block -= log->l_logBBsize; in xlog_grant_push_ail()
1430 if (XFS_LSN_CMP(threshold_lsn, log->l_last_sync_lsn) > 0) in xlog_grant_push_ail()
1431 threshold_lsn = log->l_last_sync_lsn; in xlog_grant_push_ail()
1433 spin_unlock(&log->l_grant_lock); in xlog_grant_push_ail()
1441 !XLOG_FORCED_SHUTDOWN(log)) in xlog_grant_push_ail()
1442 xfs_trans_ail_push(log->l_ailp, threshold_lsn); in xlog_grant_push_ail()
1472 xlog_sync(xlog_t *log, in xlog_sync() argument
1483 int v2 = xfs_sb_version_haslogv2(&log->l_mp->m_sb); in xlog_sync()
1489 count_init = log->l_iclog_hsize + iclog->ic_offset; in xlog_sync()
1492 if (v2 && log->l_mp->m_sb.sb_logsunit > 1) { in xlog_sync()
1494 count = XLOG_LSUNITTOB(log, XLOG_BTOLSUNIT(log, count_init)); in xlog_sync()
1500 ASSERT((v2 && log->l_mp->m_sb.sb_logsunit > 1 && in xlog_sync()
1501 roundoff < log->l_mp->m_sb.sb_logsunit) in xlog_sync()
1503 (log->l_mp->m_sb.sb_logsunit <= 1 && in xlog_sync()
1507 spin_lock(&log->l_grant_lock); in xlog_sync()
1508 xlog_grant_add_space(log, roundoff); in xlog_sync()
1509 spin_unlock(&log->l_grant_lock); in xlog_sync()
1512 xlog_pack_data(log, iclog, roundoff); in xlog_sync()
1531 if (XFS_BUF_ADDR(bp) + BTOBB(count) > log->l_logBBsize) { in xlog_sync()
1532 split = count - (BBTOB(log->l_logBBsize - XFS_BUF_ADDR(bp))); in xlog_sync()
1533 count = BBTOB(log->l_logBBsize - XFS_BUF_ADDR(bp)); in xlog_sync()
1547 if (!split && (log->l_mp->m_flags & XFS_MOUNT_BARRIER)) in xlog_sync()
1550 ASSERT(XFS_BUF_ADDR(bp) <= log->l_logBBsize-1); in xlog_sync()
1551 ASSERT(XFS_BUF_ADDR(bp) + BTOBB(count) <= log->l_logBBsize); in xlog_sync()
1553 xlog_verify_iclog(log, iclog, count, B_TRUE); in xlog_sync()
1556 XFS_BUF_SET_ADDR(bp, XFS_BUF_ADDR(bp) + log->l_logBBstart); in xlog_sync()
1564 xfs_ioerror_alert("xlog_sync", log->l_mp, bp, in xlog_sync()
1580 if (log->l_mp->m_flags & XFS_MOUNT_BARRIER) in xlog_sync()
1596 ASSERT(XFS_BUF_ADDR(bp) <= log->l_logBBsize-1); in xlog_sync()
1597 ASSERT(XFS_BUF_ADDR(bp) + BTOBB(count) <= log->l_logBBsize); in xlog_sync()
1600 XFS_BUF_SET_ADDR(bp, XFS_BUF_ADDR(bp) + log->l_logBBstart); in xlog_sync()
1603 xfs_ioerror_alert("xlog_sync (split)", log->l_mp, in xlog_sync()
1616 xlog_dealloc_log(xlog_t *log) in xlog_dealloc_log() argument
1621 iclog = log->l_iclog; in xlog_dealloc_log()
1622 for (i=0; i<log->l_iclog_bufs; i++) { in xlog_dealloc_log()
1631 spinlock_destroy(&log->l_icloglock); in xlog_dealloc_log()
1632 spinlock_destroy(&log->l_grant_lock); in xlog_dealloc_log()
1634 xfs_buf_free(log->l_xbuf); in xlog_dealloc_log()
1635 xlog_trace_loggrant_dealloc(log); in xlog_dealloc_log()
1636 log->l_mp->m_log = NULL; in xlog_dealloc_log()
1637 kmem_free(log); in xlog_dealloc_log()
1645 xlog_state_finish_copy(xlog_t *log, in xlog_state_finish_copy() argument
1650 spin_lock(&log->l_icloglock); in xlog_state_finish_copy()
1655 spin_unlock(&log->l_icloglock); in xlog_state_finish_copy()
1817 xlog_t *log = mp->m_log; in xlog_write() local
1870 if ((error = xlog_state_get_iclog_space(log, len, &iclog, ticket, in xlog_write()
1962 xlog_verify_dest_ptr(log, ptr); in xlog_write()
1975 xlog_state_finish_copy(log, iclog, record_cnt, data_cnt); in xlog_write()
1977 if ((error = xlog_state_release_iclog(log, iclog))) in xlog_write()
1985 xlog_state_finish_copy(log, iclog, record_cnt, data_cnt); in xlog_write()
1987 spin_lock(&log->l_icloglock); in xlog_write()
1988 xlog_state_want_sync(log, iclog); in xlog_write()
1989 spin_unlock(&log->l_icloglock); in xlog_write()
1993 } else if ((error = xlog_state_release_iclog(log, iclog))) in xlog_write()
2005 xlog_state_finish_copy(log, iclog, record_cnt, data_cnt); in xlog_write()
2011 return xlog_state_release_iclog(log, iclog); in xlog_write()
2031 xlog_state_clean_log(xlog_t *log) in xlog_state_clean_log() argument
2036 iclog = log->l_iclog; in xlog_state_clean_log()
2071 } while (iclog != log->l_iclog); in xlog_state_clean_log()
2082 switch (log->l_covered_state) { in xlog_state_clean_log()
2086 log->l_covered_state = XLOG_STATE_COVER_NEED; in xlog_state_clean_log()
2091 log->l_covered_state = XLOG_STATE_COVER_NEED2; in xlog_state_clean_log()
2093 log->l_covered_state = XLOG_STATE_COVER_NEED; in xlog_state_clean_log()
2098 log->l_covered_state = XLOG_STATE_COVER_IDLE; in xlog_state_clean_log()
2100 log->l_covered_state = XLOG_STATE_COVER_NEED; in xlog_state_clean_log()
2111 xlog_t *log) in xlog_get_lowest_lsn() argument
2116 lsn_log = log->l_iclog; in xlog_get_lowest_lsn()
2127 } while (lsn_log != log->l_iclog); in xlog_get_lowest_lsn()
2134 xlog_t *log, in xlog_state_do_callback() argument
2151 spin_lock(&log->l_icloglock); in xlog_state_do_callback()
2152 first_iclog = iclog = log->l_iclog; in xlog_state_do_callback()
2166 first_iclog = log->l_iclog; in xlog_state_do_callback()
2167 iclog = log->l_iclog; in xlog_state_do_callback()
2221 lowest_lsn = xlog_get_lowest_lsn(log); in xlog_state_do_callback()
2232 spin_unlock(&log->l_icloglock); in xlog_state_do_callback()
2238 spin_lock(&log->l_grant_lock); in xlog_state_do_callback()
2239 ASSERT(XFS_LSN_CMP(log->l_last_sync_lsn, in xlog_state_do_callback()
2241 log->l_last_sync_lsn = in xlog_state_do_callback()
2243 spin_unlock(&log->l_grant_lock); in xlog_state_do_callback()
2246 spin_unlock(&log->l_icloglock); in xlog_state_do_callback()
2276 spin_lock(&log->l_icloglock); in xlog_state_do_callback()
2286 xlog_state_clean_log(log); in xlog_state_do_callback()
2297 xfs_fs_cmn_err(CE_WARN, log->l_mp, in xlog_state_do_callback()
2309 first_iclog = iclog = log->l_iclog; in xlog_state_do_callback()
2331 if (log->l_iclog->ic_state & (XLOG_STATE_ACTIVE|XLOG_STATE_IOERROR)) in xlog_state_do_callback()
2333 spin_unlock(&log->l_icloglock); in xlog_state_do_callback()
2336 sv_broadcast(&log->l_flush_wait); in xlog_state_do_callback()
2358 xlog_t *log = iclog->ic_log; in xlog_state_done_syncing() local
2360 spin_lock(&log->l_icloglock); in xlog_state_done_syncing()
2376 spin_unlock(&log->l_icloglock); in xlog_state_done_syncing()
2388 spin_unlock(&log->l_icloglock); in xlog_state_done_syncing()
2389 xlog_state_do_callback(log, aborted, iclog); /* also cleans log */ in xlog_state_done_syncing()
2412 xlog_state_get_iclog_space(xlog_t *log, in xlog_state_get_iclog_space() argument
2425 spin_lock(&log->l_icloglock); in xlog_state_get_iclog_space()
2426 if (XLOG_FORCED_SHUTDOWN(log)) { in xlog_state_get_iclog_space()
2427 spin_unlock(&log->l_icloglock); in xlog_state_get_iclog_space()
2431 iclog = log->l_iclog; in xlog_state_get_iclog_space()
2437 sv_wait(&log->l_flush_wait, 0, &log->l_icloglock, 0); in xlog_state_get_iclog_space()
2452 ticket->t_curr_res -= log->l_iclog_hsize; in xlog_state_get_iclog_space()
2454 log->l_iclog_hsize, in xlog_state_get_iclog_space()
2456 head->h_cycle = cpu_to_be32(log->l_curr_cycle); in xlog_state_get_iclog_space()
2458 xlog_assign_lsn(log->l_curr_cycle, log->l_curr_block)); in xlog_state_get_iclog_space()
2459 ASSERT(log->l_curr_block >= 0); in xlog_state_get_iclog_space()
2472 xlog_state_switch_iclogs(log, iclog, iclog->ic_size); in xlog_state_get_iclog_space()
2483 spin_unlock(&log->l_icloglock); in xlog_state_get_iclog_space()
2484 error = xlog_state_release_iclog(log, iclog); in xlog_state_get_iclog_space()
2488 spin_unlock(&log->l_icloglock); in xlog_state_get_iclog_space()
2504 xlog_state_switch_iclogs(log, iclog, iclog->ic_size); in xlog_state_get_iclog_space()
2509 spin_unlock(&log->l_icloglock); in xlog_state_get_iclog_space()
2522 xlog_grant_log_space(xlog_t *log, in xlog_grant_log_space() argument
2533 if (log->l_flags & XLOG_ACTIVE_RECOVERY) in xlog_grant_log_space()
2538 spin_lock(&log->l_grant_lock); in xlog_grant_log_space()
2539 xlog_trace_loggrant(log, tic, "xlog_grant_log_space: enter"); in xlog_grant_log_space()
2542 if (log->l_reserve_headq) { in xlog_grant_log_space()
2543 xlog_ins_ticketq(&log->l_reserve_headq, tic); in xlog_grant_log_space()
2544 xlog_trace_loggrant(log, tic, in xlog_grant_log_space()
2550 if (XLOG_FORCED_SHUTDOWN(log)) in xlog_grant_log_space()
2554 sv_wait(&tic->t_wait, PINOD|PLTWAIT, &log->l_grant_lock, s); in xlog_grant_log_space()
2559 xlog_trace_loggrant(log, tic, in xlog_grant_log_space()
2561 spin_lock(&log->l_grant_lock); in xlog_grant_log_space()
2569 if (XLOG_FORCED_SHUTDOWN(log)) in xlog_grant_log_space()
2572 free_bytes = xlog_space_left(log, log->l_grant_reserve_cycle, in xlog_grant_log_space()
2573 log->l_grant_reserve_bytes); in xlog_grant_log_space()
2576 xlog_ins_ticketq(&log->l_reserve_headq, tic); in xlog_grant_log_space()
2577 xlog_trace_loggrant(log, tic, in xlog_grant_log_space()
2580 sv_wait(&tic->t_wait, PINOD|PLTWAIT, &log->l_grant_lock, s); in xlog_grant_log_space()
2582 if (XLOG_FORCED_SHUTDOWN(log)) { in xlog_grant_log_space()
2583 spin_lock(&log->l_grant_lock); in xlog_grant_log_space()
2587 xlog_trace_loggrant(log, tic, in xlog_grant_log_space()
2589 xlog_grant_push_ail(log->l_mp, need_bytes); in xlog_grant_log_space()
2590 spin_lock(&log->l_grant_lock); in xlog_grant_log_space()
2593 xlog_del_ticketq(&log->l_reserve_headq, tic); in xlog_grant_log_space()
2596 xlog_grant_add_space(log, need_bytes); in xlog_grant_log_space()
2598 tail_lsn = log->l_tail_lsn; in xlog_grant_log_space()
2605 if (CYCLE_LSN(tail_lsn) != log->l_grant_write_cycle) { in xlog_grant_log_space()
2606 ASSERT(log->l_grant_write_cycle-1 == CYCLE_LSN(tail_lsn)); in xlog_grant_log_space()
2607 ASSERT(log->l_grant_write_bytes <= BBTOB(BLOCK_LSN(tail_lsn))); in xlog_grant_log_space()
2610 xlog_trace_loggrant(log, tic, "xlog_grant_log_space: exit"); in xlog_grant_log_space()
2611 xlog_verify_grant_head(log, 1); in xlog_grant_log_space()
2612 spin_unlock(&log->l_grant_lock); in xlog_grant_log_space()
2617 xlog_del_ticketq(&log->l_reserve_headq, tic); in xlog_grant_log_space()
2618 xlog_trace_loggrant(log, tic, "xlog_grant_log_space: err_ret"); in xlog_grant_log_space()
2626 spin_unlock(&log->l_grant_lock); in xlog_grant_log_space()
2637 xlog_regrant_write_log_space(xlog_t *log, in xlog_regrant_write_log_space() argument
2653 if (log->l_flags & XLOG_ACTIVE_RECOVERY) in xlog_regrant_write_log_space()
2657 spin_lock(&log->l_grant_lock); in xlog_regrant_write_log_space()
2658 xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: enter"); in xlog_regrant_write_log_space()
2660 if (XLOG_FORCED_SHUTDOWN(log)) in xlog_regrant_write_log_space()
2670 if ((ntic = log->l_write_headq)) { in xlog_regrant_write_log_space()
2671 free_bytes = xlog_space_left(log, log->l_grant_write_cycle, in xlog_regrant_write_log_space()
2672 log->l_grant_write_bytes); in xlog_regrant_write_log_space()
2681 } while (ntic != log->l_write_headq); in xlog_regrant_write_log_space()
2683 if (ntic != log->l_write_headq) { in xlog_regrant_write_log_space()
2685 xlog_ins_ticketq(&log->l_write_headq, tic); in xlog_regrant_write_log_space()
2687 xlog_trace_loggrant(log, tic, in xlog_regrant_write_log_space()
2691 &log->l_grant_lock, s); in xlog_regrant_write_log_space()
2695 if (XLOG_FORCED_SHUTDOWN(log)) { in xlog_regrant_write_log_space()
2696 spin_lock(&log->l_grant_lock); in xlog_regrant_write_log_space()
2700 xlog_trace_loggrant(log, tic, in xlog_regrant_write_log_space()
2702 xlog_grant_push_ail(log->l_mp, tic->t_unit_res); in xlog_regrant_write_log_space()
2703 spin_lock(&log->l_grant_lock); in xlog_regrant_write_log_space()
2710 if (XLOG_FORCED_SHUTDOWN(log)) in xlog_regrant_write_log_space()
2713 free_bytes = xlog_space_left(log, log->l_grant_write_cycle, in xlog_regrant_write_log_space()
2714 log->l_grant_write_bytes); in xlog_regrant_write_log_space()
2717 xlog_ins_ticketq(&log->l_write_headq, tic); in xlog_regrant_write_log_space()
2719 sv_wait(&tic->t_wait, PINOD|PLTWAIT, &log->l_grant_lock, s); in xlog_regrant_write_log_space()
2722 if (XLOG_FORCED_SHUTDOWN(log)) { in xlog_regrant_write_log_space()
2723 spin_lock(&log->l_grant_lock); in xlog_regrant_write_log_space()
2727 xlog_trace_loggrant(log, tic, in xlog_regrant_write_log_space()
2729 xlog_grant_push_ail(log->l_mp, need_bytes); in xlog_regrant_write_log_space()
2730 spin_lock(&log->l_grant_lock); in xlog_regrant_write_log_space()
2733 xlog_del_ticketq(&log->l_write_headq, tic); in xlog_regrant_write_log_space()
2736 xlog_grant_add_space_write(log, need_bytes); in xlog_regrant_write_log_space()
2738 tail_lsn = log->l_tail_lsn; in xlog_regrant_write_log_space()
2739 if (CYCLE_LSN(tail_lsn) != log->l_grant_write_cycle) { in xlog_regrant_write_log_space()
2740 ASSERT(log->l_grant_write_cycle-1 == CYCLE_LSN(tail_lsn)); in xlog_regrant_write_log_space()
2741 ASSERT(log->l_grant_write_bytes <= BBTOB(BLOCK_LSN(tail_lsn))); in xlog_regrant_write_log_space()
2745 xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: exit"); in xlog_regrant_write_log_space()
2746 xlog_verify_grant_head(log, 1); in xlog_regrant_write_log_space()
2747 spin_unlock(&log->l_grant_lock); in xlog_regrant_write_log_space()
2753 xlog_del_ticketq(&log->l_reserve_headq, tic); in xlog_regrant_write_log_space()
2754 xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: err_ret"); in xlog_regrant_write_log_space()
2762 spin_unlock(&log->l_grant_lock); in xlog_regrant_write_log_space()
2775 xlog_regrant_reserve_log_space(xlog_t *log, in xlog_regrant_reserve_log_space() argument
2778 xlog_trace_loggrant(log, ticket, in xlog_regrant_reserve_log_space()
2783 spin_lock(&log->l_grant_lock); in xlog_regrant_reserve_log_space()
2784 xlog_grant_sub_space(log, ticket->t_curr_res); in xlog_regrant_reserve_log_space()
2787 xlog_trace_loggrant(log, ticket, in xlog_regrant_reserve_log_space()
2789 xlog_verify_grant_head(log, 1); in xlog_regrant_reserve_log_space()
2793 spin_unlock(&log->l_grant_lock); in xlog_regrant_reserve_log_space()
2797 xlog_grant_add_space_reserve(log, ticket->t_unit_res); in xlog_regrant_reserve_log_space()
2798 xlog_trace_loggrant(log, ticket, in xlog_regrant_reserve_log_space()
2800 xlog_verify_grant_head(log, 0); in xlog_regrant_reserve_log_space()
2801 spin_unlock(&log->l_grant_lock); in xlog_regrant_reserve_log_space()
2822 xlog_ungrant_log_space(xlog_t *log, in xlog_ungrant_log_space() argument
2828 spin_lock(&log->l_grant_lock); in xlog_ungrant_log_space()
2829 xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: enter"); in xlog_ungrant_log_space()
2831 xlog_grant_sub_space(log, ticket->t_curr_res); in xlog_ungrant_log_space()
2833 xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: sub current"); in xlog_ungrant_log_space()
2840 xlog_grant_sub_space(log, ticket->t_unit_res*ticket->t_cnt); in xlog_ungrant_log_space()
2843 xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: exit"); in xlog_ungrant_log_space()
2844 xlog_verify_grant_head(log, 1); in xlog_ungrant_log_space()
2845 spin_unlock(&log->l_grant_lock); in xlog_ungrant_log_space()
2846 xfs_log_move_tail(log->l_mp, 1); in xlog_ungrant_log_space()
2861 xlog_t *log, in xlog_state_release_iclog() argument
2870 if (!atomic_dec_and_lock(&iclog->ic_refcnt, &log->l_icloglock)) in xlog_state_release_iclog()
2874 spin_unlock(&log->l_icloglock); in xlog_state_release_iclog()
2882 xlog_assign_tail_lsn(log->l_mp); in xlog_state_release_iclog()
2885 iclog->ic_header.h_tail_lsn = cpu_to_be64(log->l_tail_lsn); in xlog_state_release_iclog()
2886 xlog_verify_tail_lsn(log, iclog, log->l_tail_lsn); in xlog_state_release_iclog()
2889 spin_unlock(&log->l_icloglock); in xlog_state_release_iclog()
2899 return xlog_sync(log, iclog); in xlog_state_release_iclog()
2912 xlog_state_switch_iclogs(xlog_t *log, in xlog_state_switch_iclogs() argument
2920 iclog->ic_header.h_prev_block = cpu_to_be32(log->l_prev_block); in xlog_state_switch_iclogs()
2921 log->l_prev_block = log->l_curr_block; in xlog_state_switch_iclogs()
2922 log->l_prev_cycle = log->l_curr_cycle; in xlog_state_switch_iclogs()
2925 log->l_curr_block += BTOBB(eventual_size)+BTOBB(log->l_iclog_hsize); in xlog_state_switch_iclogs()
2928 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb) && in xlog_state_switch_iclogs()
2929 log->l_mp->m_sb.sb_logsunit > 1) { in xlog_state_switch_iclogs()
2930 __uint32_t sunit_bb = BTOBB(log->l_mp->m_sb.sb_logsunit); in xlog_state_switch_iclogs()
2931 log->l_curr_block = roundup(log->l_curr_block, sunit_bb); in xlog_state_switch_iclogs()
2934 if (log->l_curr_block >= log->l_logBBsize) { in xlog_state_switch_iclogs()
2935 log->l_curr_cycle++; in xlog_state_switch_iclogs()
2936 if (log->l_curr_cycle == XLOG_HEADER_MAGIC_NUM) in xlog_state_switch_iclogs()
2937 log->l_curr_cycle++; in xlog_state_switch_iclogs()
2938 log->l_curr_block -= log->l_logBBsize; in xlog_state_switch_iclogs()
2939 ASSERT(log->l_curr_block >= 0); in xlog_state_switch_iclogs()
2941 ASSERT(iclog == log->l_iclog); in xlog_state_switch_iclogs()
2942 log->l_iclog = iclog->ic_next; in xlog_state_switch_iclogs()
2974 xlog_state_sync_all(xlog_t *log, uint flags, int *log_flushed) in xlog_state_sync_all() argument
2979 spin_lock(&log->l_icloglock); in xlog_state_sync_all()
2981 iclog = log->l_iclog; in xlog_state_sync_all()
2983 spin_unlock(&log->l_icloglock); in xlog_state_sync_all()
3018 xlog_state_switch_iclogs(log, iclog, 0); in xlog_state_sync_all()
3019 spin_unlock(&log->l_icloglock); in xlog_state_sync_all()
3021 if (xlog_state_release_iclog(log, iclog)) in xlog_state_sync_all()
3024 spin_lock(&log->l_icloglock); in xlog_state_sync_all()
3036 xlog_state_switch_iclogs(log, iclog, 0); in xlog_state_sync_all()
3055 spin_unlock(&log->l_icloglock); in xlog_state_sync_all()
3059 sv_wait(&iclog->ic_force_wait, PINOD, &log->l_icloglock, s); in xlog_state_sync_all()
3072 spin_unlock(&log->l_icloglock); in xlog_state_sync_all()
3091 xlog_state_sync(xlog_t *log, in xlog_state_sync() argument
3100 spin_lock(&log->l_icloglock); in xlog_state_sync()
3101 iclog = log->l_iclog; in xlog_state_sync()
3104 spin_unlock(&log->l_icloglock); in xlog_state_sync()
3115 spin_unlock(&log->l_icloglock); in xlog_state_sync()
3143 &log->l_icloglock, s); in xlog_state_sync()
3149 xlog_state_switch_iclogs(log, iclog, 0); in xlog_state_sync()
3150 spin_unlock(&log->l_icloglock); in xlog_state_sync()
3151 if (xlog_state_release_iclog(log, iclog)) in xlog_state_sync()
3154 spin_lock(&log->l_icloglock); in xlog_state_sync()
3166 spin_unlock(&log->l_icloglock); in xlog_state_sync()
3170 sv_wait(&iclog->ic_force_wait, PSWP, &log->l_icloglock, s); in xlog_state_sync()
3180 spin_unlock(&log->l_icloglock); in xlog_state_sync()
3184 } while (iclog != log->l_iclog); in xlog_state_sync()
3186 spin_unlock(&log->l_icloglock); in xlog_state_sync()
3196 xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog) in xlog_state_want_sync() argument
3198 ASSERT(spin_is_locked(&log->l_icloglock)); in xlog_state_want_sync()
3201 xlog_state_switch_iclogs(log, iclog, 0); in xlog_state_want_sync()
3243 xlog_ticket_alloc(xlog_t *log, in xlog_ticket_alloc() argument
3295 num_headers = ((unit_bytes + log->l_iclog_size-1) >> log->l_iclog_size_log); in xlog_ticket_alloc()
3296 unit_bytes += log->l_iclog_hsize * num_headers; in xlog_ticket_alloc()
3299 unit_bytes += log->l_iclog_hsize; in xlog_ticket_alloc()
3305 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb) && in xlog_ticket_alloc()
3306 log->l_mp->m_sb.sb_logsunit > 1) { in xlog_ticket_alloc()
3308 unit_bytes += 2*log->l_mp->m_sb.sb_logsunit; in xlog_ticket_alloc()
3346 xlog_verify_dest_ptr(xlog_t *log, in xlog_verify_dest_ptr() argument
3352 for (i=0; i < log->l_iclog_bufs; i++) { in xlog_verify_dest_ptr()
3353 if (ptr >= (__psint_t)log->l_iclog_bak[i] && in xlog_verify_dest_ptr()
3354 ptr <= (__psint_t)log->l_iclog_bak[i]+log->l_iclog_size) in xlog_verify_dest_ptr()
3362 xlog_verify_grant_head(xlog_t *log, int equals) in xlog_verify_grant_head() argument
3364 if (log->l_grant_reserve_cycle == log->l_grant_write_cycle) { in xlog_verify_grant_head()
3366 ASSERT(log->l_grant_reserve_bytes >= log->l_grant_write_bytes); in xlog_verify_grant_head()
3368 ASSERT(log->l_grant_reserve_bytes > log->l_grant_write_bytes); in xlog_verify_grant_head()
3370 ASSERT(log->l_grant_reserve_cycle-1 == log->l_grant_write_cycle); in xlog_verify_grant_head()
3371 ASSERT(log->l_grant_write_bytes >= log->l_grant_reserve_bytes); in xlog_verify_grant_head()
3377 xlog_verify_tail_lsn(xlog_t *log, in xlog_verify_tail_lsn() argument
3383 if (CYCLE_LSN(tail_lsn) == log->l_prev_cycle) { in xlog_verify_tail_lsn()
3385 log->l_logBBsize - (log->l_prev_block - BLOCK_LSN(tail_lsn)); in xlog_verify_tail_lsn()
3386 if (blocks < BTOBB(iclog->ic_offset)+BTOBB(log->l_iclog_hsize)) in xlog_verify_tail_lsn()
3389 ASSERT(CYCLE_LSN(tail_lsn)+1 == log->l_prev_cycle); in xlog_verify_tail_lsn()
3391 if (BLOCK_LSN(tail_lsn) == log->l_prev_block) in xlog_verify_tail_lsn()
3394 blocks = BLOCK_LSN(tail_lsn) - log->l_prev_block; in xlog_verify_tail_lsn()
3416 xlog_verify_iclog(xlog_t *log, in xlog_verify_iclog() argument
3432 spin_lock(&log->l_icloglock); in xlog_verify_iclog()
3433 icptr = log->l_iclog; in xlog_verify_iclog()
3434 for (i=0; i < log->l_iclog_bufs; i++) { in xlog_verify_iclog()
3439 if (icptr != log->l_iclog) in xlog_verify_iclog()
3441 spin_unlock(&log->l_icloglock); in xlog_verify_iclog()
3511 xlog_t *log) in xlog_state_ioerror() argument
3515 iclog = log->l_iclog; in xlog_state_ioerror()
3552 xlog_t *log; in xfs_log_force_umount() local
3556 log = mp->m_log; in xfs_log_force_umount()
3562 if (!log || in xfs_log_force_umount()
3563 log->l_flags & XLOG_ACTIVE_RECOVERY) { in xfs_log_force_umount()
3574 if (logerror && log->l_iclog->ic_state & XLOG_STATE_IOERROR) { in xfs_log_force_umount()
3575 ASSERT(XLOG_FORCED_SHUTDOWN(log)); in xfs_log_force_umount()
3584 spin_lock(&log->l_icloglock); in xfs_log_force_umount()
3585 spin_lock(&log->l_grant_lock); in xfs_log_force_umount()
3595 log->l_flags |= XLOG_IO_ERROR; in xfs_log_force_umount()
3602 retval = xlog_state_ioerror(log); in xfs_log_force_umount()
3603 spin_unlock(&log->l_icloglock); in xfs_log_force_umount()
3613 if ((tic = log->l_reserve_headq)) { in xfs_log_force_umount()
3617 } while (tic != log->l_reserve_headq); in xfs_log_force_umount()
3620 if ((tic = log->l_write_headq)) { in xfs_log_force_umount()
3624 } while (tic != log->l_write_headq); in xfs_log_force_umount()
3626 spin_unlock(&log->l_grant_lock); in xfs_log_force_umount()
3628 if (! (log->l_iclog->ic_state & XLOG_STATE_IOERROR)) { in xfs_log_force_umount()
3634 xlog_state_sync_all(log, XFS_LOG_FORCE|XFS_LOG_SYNC, &dummy); in xfs_log_force_umount()
3635 spin_lock(&log->l_icloglock); in xfs_log_force_umount()
3636 retval = xlog_state_ioerror(log); in xfs_log_force_umount()
3637 spin_unlock(&log->l_icloglock); in xfs_log_force_umount()
3644 xlog_state_do_callback(log, XFS_LI_ABORTED, NULL); in xfs_log_force_umount()
3650 spin_lock(&log->l_icloglock); in xfs_log_force_umount()
3651 iclog = log->l_iclog; in xfs_log_force_umount()
3655 } while (iclog != log->l_iclog); in xfs_log_force_umount()
3656 spin_unlock(&log->l_icloglock); in xfs_log_force_umount()
3664 xlog_iclogs_empty(xlog_t *log) in xlog_iclogs_empty() argument
3668 iclog = log->l_iclog; in xlog_iclogs_empty()
3676 } while (iclog != log->l_iclog); in xlog_iclogs_empty()