xfs_trans_ail.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. /*
  2. * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #include "xfs.h"
  19. #include "xfs_fs.h"
  20. #include "xfs_types.h"
  21. #include "xfs_log.h"
  22. #include "xfs_inum.h"
  23. #include "xfs_trans.h"
  24. #include "xfs_sb.h"
  25. #include "xfs_ag.h"
  26. #include "xfs_dmapi.h"
  27. #include "xfs_mount.h"
  28. #include "xfs_trans_priv.h"
  29. #include "xfs_error.h"
  30. STATIC void xfs_ail_insert(struct xfs_ail *, xfs_log_item_t *);
  31. STATIC xfs_log_item_t * xfs_ail_delete(struct xfs_ail *, xfs_log_item_t *);
  32. STATIC xfs_log_item_t * xfs_ail_min(struct xfs_ail *);
  33. STATIC xfs_log_item_t * xfs_ail_next(struct xfs_ail *, xfs_log_item_t *);
  34. #ifdef DEBUG
  35. STATIC void xfs_ail_check(struct xfs_ail *, xfs_log_item_t *);
  36. #else
  37. #define xfs_ail_check(a,l)
  38. #endif /* DEBUG */
  39. /*
  40. * This is called by the log manager code to determine the LSN
  41. * of the tail of the log. This is exactly the LSN of the first
  42. * item in the AIL. If the AIL is empty, then this function
  43. * returns 0.
  44. *
  45. * We need the AIL lock in order to get a coherent read of the
  46. * lsn of the last item in the AIL.
  47. */
  48. xfs_lsn_t
  49. xfs_trans_tail_ail(
  50. xfs_mount_t *mp)
  51. {
  52. xfs_lsn_t lsn;
  53. xfs_log_item_t *lip;
  54. spin_lock(&mp->m_ail_lock);
  55. lip = xfs_ail_min(mp->m_ail);
  56. if (lip == NULL) {
  57. lsn = (xfs_lsn_t)0;
  58. } else {
  59. lsn = lip->li_lsn;
  60. }
  61. spin_unlock(&mp->m_ail_lock);
  62. return lsn;
  63. }
  64. /*
  65. * xfs_trans_push_ail
  66. *
  67. * This routine is called to move the tail of the AIL forward. It does this by
  68. * trying to flush items in the AIL whose lsns are below the given
  69. * threshold_lsn.
  70. *
  71. * the push is run asynchronously in a separate thread, so we return the tail
  72. * of the log right now instead of the tail after the push. This means we will
  73. * either continue right away, or we will sleep waiting on the async thread to
  74. * do it's work.
  75. *
  76. * We do this unlocked - we only need to know whether there is anything in the
  77. * AIL at the time we are called. We don't need to access the contents of
  78. * any of the objects, so the lock is not needed.
  79. */
  80. void
  81. xfs_trans_push_ail(
  82. xfs_mount_t *mp,
  83. xfs_lsn_t threshold_lsn)
  84. {
  85. xfs_log_item_t *lip;
  86. lip = xfs_ail_min(mp->m_ail);
  87. if (lip && !XFS_FORCED_SHUTDOWN(mp)) {
  88. if (XFS_LSN_CMP(threshold_lsn, mp->m_ail->xa_target) > 0)
  89. xfsaild_wakeup(mp->m_ail, threshold_lsn);
  90. }
  91. }
  92. /*
  93. * Return the item in the AIL with the current lsn.
  94. * Return the current tree generation number for use
  95. * in calls to xfs_trans_next_ail().
  96. */
  97. STATIC xfs_log_item_t *
  98. xfs_trans_first_push_ail(
  99. xfs_mount_t *mp,
  100. int *gen,
  101. xfs_lsn_t lsn)
  102. {
  103. xfs_log_item_t *lip;
  104. lip = xfs_ail_min(mp->m_ail);
  105. *gen = (int)mp->m_ail->xa_gen;
  106. if (lsn == 0)
  107. return lip;
  108. list_for_each_entry(lip, &mp->m_ail->xa_ail, li_ail) {
  109. if (XFS_LSN_CMP(lip->li_lsn, lsn) >= 0)
  110. return lip;
  111. }
  112. return NULL;
  113. }
  114. /*
  115. * Function that does the work of pushing on the AIL
  116. */
  117. long
  118. xfsaild_push(
  119. struct xfs_ail *ailp,
  120. xfs_lsn_t *last_lsn)
  121. {
  122. long tout = 1000; /* milliseconds */
  123. xfs_lsn_t last_pushed_lsn = *last_lsn;
  124. xfs_lsn_t target = ailp->xa_target;
  125. xfs_lsn_t lsn;
  126. xfs_log_item_t *lip;
  127. int gen;
  128. int restarts;
  129. int flush_log, count, stuck;
  130. xfs_mount_t *mp = ailp->xa_mount;
  131. #define XFS_TRANS_PUSH_AIL_RESTARTS 10
  132. spin_lock(&mp->m_ail_lock);
  133. lip = xfs_trans_first_push_ail(mp, &gen, *last_lsn);
  134. if (!lip || XFS_FORCED_SHUTDOWN(mp)) {
  135. /*
  136. * AIL is empty or our push has reached the end.
  137. */
  138. spin_unlock(&mp->m_ail_lock);
  139. last_pushed_lsn = 0;
  140. goto out;
  141. }
  142. XFS_STATS_INC(xs_push_ail);
  143. /*
  144. * While the item we are looking at is below the given threshold
  145. * try to flush it out. We'd like not to stop until we've at least
  146. * tried to push on everything in the AIL with an LSN less than
  147. * the given threshold.
  148. *
  149. * However, we will stop after a certain number of pushes and wait
  150. * for a reduced timeout to fire before pushing further. This
  151. * prevents use from spinning when we can't do anything or there is
  152. * lots of contention on the AIL lists.
  153. */
  154. tout = 10;
  155. lsn = lip->li_lsn;
  156. flush_log = stuck = count = restarts = 0;
  157. while ((XFS_LSN_CMP(lip->li_lsn, target) < 0)) {
  158. int lock_result;
  159. /*
  160. * If we can lock the item without sleeping, unlock the AIL
  161. * lock and flush the item. Then re-grab the AIL lock so we
  162. * can look for the next item on the AIL. List changes are
  163. * handled by the AIL lookup functions internally
  164. *
  165. * If we can't lock the item, either its holder will flush it
  166. * or it is already being flushed or it is being relogged. In
  167. * any of these case it is being taken care of and we can just
  168. * skip to the next item in the list.
  169. */
  170. lock_result = IOP_TRYLOCK(lip);
  171. spin_unlock(&mp->m_ail_lock);
  172. switch (lock_result) {
  173. case XFS_ITEM_SUCCESS:
  174. XFS_STATS_INC(xs_push_ail_success);
  175. IOP_PUSH(lip);
  176. last_pushed_lsn = lsn;
  177. break;
  178. case XFS_ITEM_PUSHBUF:
  179. XFS_STATS_INC(xs_push_ail_pushbuf);
  180. IOP_PUSHBUF(lip);
  181. last_pushed_lsn = lsn;
  182. break;
  183. case XFS_ITEM_PINNED:
  184. XFS_STATS_INC(xs_push_ail_pinned);
  185. stuck++;
  186. flush_log = 1;
  187. break;
  188. case XFS_ITEM_LOCKED:
  189. XFS_STATS_INC(xs_push_ail_locked);
  190. last_pushed_lsn = lsn;
  191. stuck++;
  192. break;
  193. case XFS_ITEM_FLUSHING:
  194. XFS_STATS_INC(xs_push_ail_flushing);
  195. last_pushed_lsn = lsn;
  196. stuck++;
  197. break;
  198. default:
  199. ASSERT(0);
  200. break;
  201. }
  202. spin_lock(&mp->m_ail_lock);
  203. /* should we bother continuing? */
  204. if (XFS_FORCED_SHUTDOWN(mp))
  205. break;
  206. ASSERT(mp->m_log);
  207. count++;
  208. /*
  209. * Are there too many items we can't do anything with?
  210. * If we we are skipping too many items because we can't flush
  211. * them or they are already being flushed, we back off and
  212. * given them time to complete whatever operation is being
  213. * done. i.e. remove pressure from the AIL while we can't make
  214. * progress so traversals don't slow down further inserts and
  215. * removals to/from the AIL.
  216. *
  217. * The value of 100 is an arbitrary magic number based on
  218. * observation.
  219. */
  220. if (stuck > 100)
  221. break;
  222. lip = xfs_trans_next_ail(mp, lip, &gen, &restarts);
  223. if (lip == NULL)
  224. break;
  225. if (restarts > XFS_TRANS_PUSH_AIL_RESTARTS)
  226. break;
  227. lsn = lip->li_lsn;
  228. }
  229. spin_unlock(&mp->m_ail_lock);
  230. if (flush_log) {
  231. /*
  232. * If something we need to push out was pinned, then
  233. * push out the log so it will become unpinned and
  234. * move forward in the AIL.
  235. */
  236. XFS_STATS_INC(xs_push_ail_flush);
  237. xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE);
  238. }
  239. if (!count) {
  240. /* We're past our target or empty, so idle */
  241. tout = 1000;
  242. } else if (XFS_LSN_CMP(lsn, target) >= 0) {
  243. /*
  244. * We reached the target so wait a bit longer for I/O to
  245. * complete and remove pushed items from the AIL before we
  246. * start the next scan from the start of the AIL.
  247. */
  248. tout += 20;
  249. last_pushed_lsn = 0;
  250. } else if ((restarts > XFS_TRANS_PUSH_AIL_RESTARTS) ||
  251. ((stuck * 100) / count > 90)) {
  252. /*
  253. * Either there is a lot of contention on the AIL or we
  254. * are stuck due to operations in progress. "Stuck" in this
  255. * case is defined as >90% of the items we tried to push
  256. * were stuck.
  257. *
  258. * Backoff a bit more to allow some I/O to complete before
  259. * continuing from where we were.
  260. */
  261. tout += 10;
  262. }
  263. out:
  264. *last_lsn = last_pushed_lsn;
  265. return tout;
  266. } /* xfsaild_push */
  267. /*
  268. * This is to be called when an item is unlocked that may have
  269. * been in the AIL. It will wake up the first member of the AIL
  270. * wait list if this item's unlocking might allow it to progress.
  271. * If the item is in the AIL, then we need to get the AIL lock
  272. * while doing our checking so we don't race with someone going
  273. * to sleep waiting for this event in xfs_trans_push_ail().
  274. */
  275. void
  276. xfs_trans_unlocked_item(
  277. xfs_mount_t *mp,
  278. xfs_log_item_t *lip)
  279. {
  280. xfs_log_item_t *min_lip;
  281. /*
  282. * If we're forcibly shutting down, we may have
  283. * unlocked log items arbitrarily. The last thing
  284. * we want to do is to move the tail of the log
  285. * over some potentially valid data.
  286. */
  287. if (!(lip->li_flags & XFS_LI_IN_AIL) ||
  288. XFS_FORCED_SHUTDOWN(mp)) {
  289. return;
  290. }
  291. /*
  292. * This is the one case where we can call into xfs_ail_min()
  293. * without holding the AIL lock because we only care about the
  294. * case where we are at the tail of the AIL. If the object isn't
  295. * at the tail, it doesn't matter what result we get back. This
  296. * is slightly racy because since we were just unlocked, we could
  297. * go to sleep between the call to xfs_ail_min and the call to
  298. * xfs_log_move_tail, have someone else lock us, commit to us disk,
  299. * move us out of the tail of the AIL, and then we wake up. However,
  300. * the call to xfs_log_move_tail() doesn't do anything if there's
  301. * not enough free space to wake people up so we're safe calling it.
  302. */
  303. min_lip = xfs_ail_min(mp->m_ail);
  304. if (min_lip == lip)
  305. xfs_log_move_tail(mp, 1);
  306. } /* xfs_trans_unlocked_item */
  307. /*
  308. * Update the position of the item in the AIL with the new
  309. * lsn. If it is not yet in the AIL, add it. Otherwise, move
  310. * it to its new position by removing it and re-adding it.
  311. *
  312. * Wakeup anyone with an lsn less than the item's lsn. If the item
  313. * we move in the AIL is the minimum one, update the tail lsn in the
  314. * log manager.
  315. *
  316. * Increment the AIL's generation count to indicate that the tree
  317. * has changed.
  318. *
  319. * This function must be called with the AIL lock held. The lock
  320. * is dropped before returning.
  321. */
  322. void
  323. xfs_trans_update_ail(
  324. xfs_mount_t *mp,
  325. xfs_log_item_t *lip,
  326. xfs_lsn_t lsn) __releases(mp->m_ail_lock)
  327. {
  328. xfs_log_item_t *dlip=NULL;
  329. xfs_log_item_t *mlip; /* ptr to minimum lip */
  330. mlip = xfs_ail_min(mp->m_ail);
  331. if (lip->li_flags & XFS_LI_IN_AIL) {
  332. dlip = xfs_ail_delete(mp->m_ail, lip);
  333. ASSERT(dlip == lip);
  334. } else {
  335. lip->li_flags |= XFS_LI_IN_AIL;
  336. }
  337. lip->li_lsn = lsn;
  338. xfs_ail_insert(mp->m_ail, lip);
  339. mp->m_ail->xa_gen++;
  340. if (mlip == dlip) {
  341. mlip = xfs_ail_min(mp->m_ail);
  342. spin_unlock(&mp->m_ail_lock);
  343. xfs_log_move_tail(mp, mlip->li_lsn);
  344. } else {
  345. spin_unlock(&mp->m_ail_lock);
  346. }
  347. } /* xfs_trans_update_ail */
  348. /*
  349. * Delete the given item from the AIL. It must already be in
  350. * the AIL.
  351. *
  352. * Wakeup anyone with an lsn less than item's lsn. If the item
  353. * we delete in the AIL is the minimum one, update the tail lsn in the
  354. * log manager.
  355. *
  356. * Clear the IN_AIL flag from the item, reset its lsn to 0, and
  357. * bump the AIL's generation count to indicate that the tree
  358. * has changed.
  359. *
  360. * This function must be called with the AIL lock held. The lock
  361. * is dropped before returning.
  362. */
  363. void
  364. xfs_trans_delete_ail(
  365. xfs_mount_t *mp,
  366. xfs_log_item_t *lip) __releases(mp->m_ail_lock)
  367. {
  368. xfs_log_item_t *dlip;
  369. xfs_log_item_t *mlip;
  370. if (lip->li_flags & XFS_LI_IN_AIL) {
  371. mlip = xfs_ail_min(mp->m_ail);
  372. dlip = xfs_ail_delete(mp->m_ail, lip);
  373. ASSERT(dlip == lip);
  374. lip->li_flags &= ~XFS_LI_IN_AIL;
  375. lip->li_lsn = 0;
  376. mp->m_ail->xa_gen++;
  377. if (mlip == dlip) {
  378. mlip = xfs_ail_min(mp->m_ail);
  379. spin_unlock(&mp->m_ail_lock);
  380. xfs_log_move_tail(mp, (mlip ? mlip->li_lsn : 0));
  381. } else {
  382. spin_unlock(&mp->m_ail_lock);
  383. }
  384. }
  385. else {
  386. /*
  387. * If the file system is not being shutdown, we are in
  388. * serious trouble if we get to this stage.
  389. */
  390. if (XFS_FORCED_SHUTDOWN(mp))
  391. spin_unlock(&mp->m_ail_lock);
  392. else {
  393. xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp,
  394. "%s: attempting to delete a log item that is not in the AIL",
  395. __func__);
  396. spin_unlock(&mp->m_ail_lock);
  397. xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
  398. }
  399. }
  400. }
  401. /*
  402. * Return the item in the AIL with the smallest lsn.
  403. * Return the current tree generation number for use
  404. * in calls to xfs_trans_next_ail().
  405. */
  406. xfs_log_item_t *
  407. xfs_trans_first_ail(
  408. xfs_mount_t *mp,
  409. int *gen)
  410. {
  411. xfs_log_item_t *lip;
  412. lip = xfs_ail_min(mp->m_ail);
  413. *gen = (int)mp->m_ail->xa_gen;
  414. return lip;
  415. }
  416. /*
  417. * If the generation count of the tree has not changed since the
  418. * caller last took something from the AIL, then return the elmt
  419. * in the tree which follows the one given. If the count has changed,
  420. * then return the minimum elmt of the AIL and bump the restarts counter
  421. * if one is given.
  422. */
  423. xfs_log_item_t *
  424. xfs_trans_next_ail(
  425. xfs_mount_t *mp,
  426. xfs_log_item_t *lip,
  427. int *gen,
  428. int *restarts)
  429. {
  430. xfs_log_item_t *nlip;
  431. ASSERT(mp && lip && gen);
  432. if (mp->m_ail->xa_gen == *gen) {
  433. nlip = xfs_ail_next(mp->m_ail, lip);
  434. } else {
  435. nlip = xfs_ail_min(mp->m_ail);
  436. *gen = (int)mp->m_ail->xa_gen;
  437. if (restarts != NULL) {
  438. XFS_STATS_INC(xs_push_ail_restarts);
  439. (*restarts)++;
  440. }
  441. }
  442. return (nlip);
  443. }
  444. /*
  445. * The active item list (AIL) is a doubly linked list of log
  446. * items sorted by ascending lsn. The base of the list is
  447. * a forw/back pointer pair embedded in the xfs mount structure.
  448. * The base is initialized with both pointers pointing to the
  449. * base. This case always needs to be distinguished, because
  450. * the base has no lsn to look at. We almost always insert
  451. * at the end of the list, so on inserts we search from the
  452. * end of the list to find where the new item belongs.
  453. */
  454. /*
  455. * Initialize the doubly linked list to point only to itself.
  456. */
  457. int
  458. xfs_trans_ail_init(
  459. xfs_mount_t *mp)
  460. {
  461. struct xfs_ail *ailp;
  462. ailp = kmem_zalloc(sizeof(struct xfs_ail), KM_MAYFAIL);
  463. if (!ailp)
  464. return ENOMEM;
  465. ailp->xa_mount = mp;
  466. INIT_LIST_HEAD(&ailp->xa_ail);
  467. return xfsaild_start(ailp);
  468. }
  469. void
  470. xfs_trans_ail_destroy(
  471. xfs_mount_t *mp)
  472. {
  473. struct xfs_ail *ailp = mp->m_ail;
  474. xfsaild_stop(ailp);
  475. kmem_free(ailp);
  476. }
  477. /*
  478. * Insert the given log item into the AIL.
  479. * We almost always insert at the end of the list, so on inserts
  480. * we search from the end of the list to find where the
  481. * new item belongs.
  482. */
  483. STATIC void
  484. xfs_ail_insert(
  485. struct xfs_ail *ailp,
  486. xfs_log_item_t *lip)
  487. /* ARGSUSED */
  488. {
  489. xfs_log_item_t *next_lip;
  490. /*
  491. * If the list is empty, just insert the item.
  492. */
  493. if (list_empty(&ailp->xa_ail)) {
  494. list_add(&lip->li_ail, &ailp->xa_ail);
  495. return;
  496. }
  497. list_for_each_entry_reverse(next_lip, &ailp->xa_ail, li_ail) {
  498. if (XFS_LSN_CMP(next_lip->li_lsn, lip->li_lsn) <= 0)
  499. break;
  500. }
  501. ASSERT((&next_lip->li_ail == &ailp->xa_ail) ||
  502. (XFS_LSN_CMP(next_lip->li_lsn, lip->li_lsn) <= 0));
  503. list_add(&lip->li_ail, &next_lip->li_ail);
  504. xfs_ail_check(ailp, lip);
  505. return;
  506. }
  507. /*
  508. * Delete the given item from the AIL. Return a pointer to the item.
  509. */
  510. /*ARGSUSED*/
  511. STATIC xfs_log_item_t *
  512. xfs_ail_delete(
  513. struct xfs_ail *ailp,
  514. xfs_log_item_t *lip)
  515. /* ARGSUSED */
  516. {
  517. xfs_ail_check(ailp, lip);
  518. list_del(&lip->li_ail);
  519. return lip;
  520. }
  521. /*
  522. * Return a pointer to the first item in the AIL.
  523. * If the AIL is empty, then return NULL.
  524. */
  525. STATIC xfs_log_item_t *
  526. xfs_ail_min(
  527. struct xfs_ail *ailp)
  528. /* ARGSUSED */
  529. {
  530. if (list_empty(&ailp->xa_ail))
  531. return NULL;
  532. return list_first_entry(&ailp->xa_ail, xfs_log_item_t, li_ail);
  533. }
  534. /*
  535. * Return a pointer to the item which follows
  536. * the given item in the AIL. If the given item
  537. * is the last item in the list, then return NULL.
  538. */
  539. STATIC xfs_log_item_t *
  540. xfs_ail_next(
  541. struct xfs_ail *ailp,
  542. xfs_log_item_t *lip)
  543. /* ARGSUSED */
  544. {
  545. if (lip->li_ail.next == &ailp->xa_ail)
  546. return NULL;
  547. return list_first_entry(&lip->li_ail, xfs_log_item_t, li_ail);
  548. }
  549. #ifdef DEBUG
  550. /*
  551. * Check that the list is sorted as it should be.
  552. */
  553. STATIC void
  554. xfs_ail_check(
  555. struct xfs_ail *ailp,
  556. xfs_log_item_t *lip)
  557. {
  558. xfs_log_item_t *prev_lip;
  559. if (list_empty(&ailp->xa_ail))
  560. return;
  561. /*
  562. * Check the next and previous entries are valid.
  563. */
  564. ASSERT((lip->li_flags & XFS_LI_IN_AIL) != 0);
  565. prev_lip = list_entry(lip->li_ail.prev, xfs_log_item_t, li_ail);
  566. if (&prev_lip->li_ail != &ailp->xa_ail)
  567. ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) <= 0);
  568. prev_lip = list_entry(lip->li_ail.next, xfs_log_item_t, li_ail);
  569. if (&prev_lip->li_ail != &ailp->xa_ail)
  570. ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) >= 0);
  571. #ifdef XFS_TRANS_DEBUG
  572. /*
  573. * Walk the list checking lsn ordering, and that every entry has the
  574. * XFS_LI_IN_AIL flag set. This is really expensive, so only do it
  575. * when specifically debugging the transaction subsystem.
  576. */
  577. prev_lip = list_entry(&ailp->xa_ail, xfs_log_item_t, li_ail);
  578. list_for_each_entry(lip, &ailp->xa_ail, li_ail) {
  579. if (&prev_lip->li_ail != &ailp->xa_ail)
  580. ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) <= 0);
  581. ASSERT((lip->li_flags & XFS_LI_IN_AIL) != 0);
  582. prev_lip = lip;
  583. }
  584. #endif /* XFS_TRANS_DEBUG */
  585. }
  586. #endif /* DEBUG */