xfs_buf_item.c 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161
  1. /*
  2. * Copyright (c) 2000-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_bit.h"
  22. #include "xfs_log.h"
  23. #include "xfs_inum.h"
  24. #include "xfs_trans.h"
  25. #include "xfs_sb.h"
  26. #include "xfs_ag.h"
  27. #include "xfs_dmapi.h"
  28. #include "xfs_mount.h"
  29. #include "xfs_buf_item.h"
  30. #include "xfs_trans_priv.h"
  31. #include "xfs_error.h"
  32. kmem_zone_t *xfs_buf_item_zone;
  33. #ifdef XFS_TRANS_DEBUG
  34. /*
  35. * This function uses an alternate strategy for tracking the bytes
  36. * that the user requests to be logged. This can then be used
  37. * in conjunction with the bli_orig array in the buf log item to
  38. * catch bugs in our callers' code.
  39. *
  40. * We also double check the bits set in xfs_buf_item_log using a
  41. * simple algorithm to check that every byte is accounted for.
  42. */
  43. STATIC void
  44. xfs_buf_item_log_debug(
  45. xfs_buf_log_item_t *bip,
  46. uint first,
  47. uint last)
  48. {
  49. uint x;
  50. uint byte;
  51. uint nbytes;
  52. uint chunk_num;
  53. uint word_num;
  54. uint bit_num;
  55. uint bit_set;
  56. uint *wordp;
  57. ASSERT(bip->bli_logged != NULL);
  58. byte = first;
  59. nbytes = last - first + 1;
  60. bfset(bip->bli_logged, first, nbytes);
  61. for (x = 0; x < nbytes; x++) {
  62. chunk_num = byte >> XFS_BLI_SHIFT;
  63. word_num = chunk_num >> BIT_TO_WORD_SHIFT;
  64. bit_num = chunk_num & (NBWORD - 1);
  65. wordp = &(bip->bli_format.blf_data_map[word_num]);
  66. bit_set = *wordp & (1 << bit_num);
  67. ASSERT(bit_set);
  68. byte++;
  69. }
  70. }
  71. /*
  72. * This function is called when we flush something into a buffer without
  73. * logging it. This happens for things like inodes which are logged
  74. * separately from the buffer.
  75. */
  76. void
  77. xfs_buf_item_flush_log_debug(
  78. xfs_buf_t *bp,
  79. uint first,
  80. uint last)
  81. {
  82. xfs_buf_log_item_t *bip;
  83. uint nbytes;
  84. bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t*);
  85. if ((bip == NULL) || (bip->bli_item.li_type != XFS_LI_BUF)) {
  86. return;
  87. }
  88. ASSERT(bip->bli_logged != NULL);
  89. nbytes = last - first + 1;
  90. bfset(bip->bli_logged, first, nbytes);
  91. }
  92. /*
  93. * This function is called to verify that our callers have logged
  94. * all the bytes that they changed.
  95. *
  96. * It does this by comparing the original copy of the buffer stored in
  97. * the buf log item's bli_orig array to the current copy of the buffer
  98. * and ensuring that all bytes which mismatch are set in the bli_logged
  99. * array of the buf log item.
  100. */
  101. STATIC void
  102. xfs_buf_item_log_check(
  103. xfs_buf_log_item_t *bip)
  104. {
  105. char *orig;
  106. char *buffer;
  107. int x;
  108. xfs_buf_t *bp;
  109. ASSERT(bip->bli_orig != NULL);
  110. ASSERT(bip->bli_logged != NULL);
  111. bp = bip->bli_buf;
  112. ASSERT(XFS_BUF_COUNT(bp) > 0);
  113. ASSERT(XFS_BUF_PTR(bp) != NULL);
  114. orig = bip->bli_orig;
  115. buffer = XFS_BUF_PTR(bp);
  116. for (x = 0; x < XFS_BUF_COUNT(bp); x++) {
  117. if (orig[x] != buffer[x] && !btst(bip->bli_logged, x))
  118. cmn_err(CE_PANIC,
  119. "xfs_buf_item_log_check bip %x buffer %x orig %x index %d",
  120. bip, bp, orig, x);
  121. }
  122. }
  123. #else
  124. #define xfs_buf_item_log_debug(x,y,z)
  125. #define xfs_buf_item_log_check(x)
  126. #endif
  127. STATIC void xfs_buf_error_relse(xfs_buf_t *bp);
  128. STATIC void xfs_buf_do_callbacks(xfs_buf_t *bp, xfs_log_item_t *lip);
  129. /*
  130. * This returns the number of log iovecs needed to log the
  131. * given buf log item.
  132. *
  133. * It calculates this as 1 iovec for the buf log format structure
  134. * and 1 for each stretch of non-contiguous chunks to be logged.
  135. * Contiguous chunks are logged in a single iovec.
  136. *
  137. * If the XFS_BLI_STALE flag has been set, then log nothing.
  138. */
  139. STATIC uint
  140. xfs_buf_item_size(
  141. xfs_buf_log_item_t *bip)
  142. {
  143. uint nvecs;
  144. int next_bit;
  145. int last_bit;
  146. xfs_buf_t *bp;
  147. ASSERT(atomic_read(&bip->bli_refcount) > 0);
  148. if (bip->bli_flags & XFS_BLI_STALE) {
  149. /*
  150. * The buffer is stale, so all we need to log
  151. * is the buf log format structure with the
  152. * cancel flag in it.
  153. */
  154. xfs_buf_item_trace("SIZE STALE", bip);
  155. ASSERT(bip->bli_format.blf_flags & XFS_BLI_CANCEL);
  156. return 1;
  157. }
  158. bp = bip->bli_buf;
  159. ASSERT(bip->bli_flags & XFS_BLI_LOGGED);
  160. nvecs = 1;
  161. last_bit = xfs_next_bit(bip->bli_format.blf_data_map,
  162. bip->bli_format.blf_map_size, 0);
  163. ASSERT(last_bit != -1);
  164. nvecs++;
  165. while (last_bit != -1) {
  166. /*
  167. * This takes the bit number to start looking from and
  168. * returns the next set bit from there. It returns -1
  169. * if there are no more bits set or the start bit is
  170. * beyond the end of the bitmap.
  171. */
  172. next_bit = xfs_next_bit(bip->bli_format.blf_data_map,
  173. bip->bli_format.blf_map_size,
  174. last_bit + 1);
  175. /*
  176. * If we run out of bits, leave the loop,
  177. * else if we find a new set of bits bump the number of vecs,
  178. * else keep scanning the current set of bits.
  179. */
  180. if (next_bit == -1) {
  181. last_bit = -1;
  182. } else if (next_bit != last_bit + 1) {
  183. last_bit = next_bit;
  184. nvecs++;
  185. } else if (xfs_buf_offset(bp, next_bit * XFS_BLI_CHUNK) !=
  186. (xfs_buf_offset(bp, last_bit * XFS_BLI_CHUNK) +
  187. XFS_BLI_CHUNK)) {
  188. last_bit = next_bit;
  189. nvecs++;
  190. } else {
  191. last_bit++;
  192. }
  193. }
  194. xfs_buf_item_trace("SIZE NORM", bip);
  195. return nvecs;
  196. }
  197. /*
  198. * This is called to fill in the vector of log iovecs for the
  199. * given log buf item. It fills the first entry with a buf log
  200. * format structure, and the rest point to contiguous chunks
  201. * within the buffer.
  202. */
  203. STATIC void
  204. xfs_buf_item_format(
  205. xfs_buf_log_item_t *bip,
  206. xfs_log_iovec_t *log_vector)
  207. {
  208. uint base_size;
  209. uint nvecs;
  210. xfs_log_iovec_t *vecp;
  211. xfs_buf_t *bp;
  212. int first_bit;
  213. int last_bit;
  214. int next_bit;
  215. uint nbits;
  216. uint buffer_offset;
  217. ASSERT(atomic_read(&bip->bli_refcount) > 0);
  218. ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||
  219. (bip->bli_flags & XFS_BLI_STALE));
  220. bp = bip->bli_buf;
  221. vecp = log_vector;
  222. /*
  223. * The size of the base structure is the size of the
  224. * declared structure plus the space for the extra words
  225. * of the bitmap. We subtract one from the map size, because
  226. * the first element of the bitmap is accounted for in the
  227. * size of the base structure.
  228. */
  229. base_size =
  230. (uint)(sizeof(xfs_buf_log_format_t) +
  231. ((bip->bli_format.blf_map_size - 1) * sizeof(uint)));
  232. vecp->i_addr = (xfs_caddr_t)&bip->bli_format;
  233. vecp->i_len = base_size;
  234. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_BFORMAT);
  235. vecp++;
  236. nvecs = 1;
  237. if (bip->bli_flags & XFS_BLI_STALE) {
  238. /*
  239. * The buffer is stale, so all we need to log
  240. * is the buf log format structure with the
  241. * cancel flag in it.
  242. */
  243. xfs_buf_item_trace("FORMAT STALE", bip);
  244. ASSERT(bip->bli_format.blf_flags & XFS_BLI_CANCEL);
  245. bip->bli_format.blf_size = nvecs;
  246. return;
  247. }
  248. /*
  249. * Fill in an iovec for each set of contiguous chunks.
  250. */
  251. first_bit = xfs_next_bit(bip->bli_format.blf_data_map,
  252. bip->bli_format.blf_map_size, 0);
  253. ASSERT(first_bit != -1);
  254. last_bit = first_bit;
  255. nbits = 1;
  256. for (;;) {
  257. /*
  258. * This takes the bit number to start looking from and
  259. * returns the next set bit from there. It returns -1
  260. * if there are no more bits set or the start bit is
  261. * beyond the end of the bitmap.
  262. */
  263. next_bit = xfs_next_bit(bip->bli_format.blf_data_map,
  264. bip->bli_format.blf_map_size,
  265. (uint)last_bit + 1);
  266. /*
  267. * If we run out of bits fill in the last iovec and get
  268. * out of the loop.
  269. * Else if we start a new set of bits then fill in the
  270. * iovec for the series we were looking at and start
  271. * counting the bits in the new one.
  272. * Else we're still in the same set of bits so just
  273. * keep counting and scanning.
  274. */
  275. if (next_bit == -1) {
  276. buffer_offset = first_bit * XFS_BLI_CHUNK;
  277. vecp->i_addr = xfs_buf_offset(bp, buffer_offset);
  278. vecp->i_len = nbits * XFS_BLI_CHUNK;
  279. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_BCHUNK);
  280. nvecs++;
  281. break;
  282. } else if (next_bit != last_bit + 1) {
  283. buffer_offset = first_bit * XFS_BLI_CHUNK;
  284. vecp->i_addr = xfs_buf_offset(bp, buffer_offset);
  285. vecp->i_len = nbits * XFS_BLI_CHUNK;
  286. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_BCHUNK);
  287. nvecs++;
  288. vecp++;
  289. first_bit = next_bit;
  290. last_bit = next_bit;
  291. nbits = 1;
  292. } else if (xfs_buf_offset(bp, next_bit << XFS_BLI_SHIFT) !=
  293. (xfs_buf_offset(bp, last_bit << XFS_BLI_SHIFT) +
  294. XFS_BLI_CHUNK)) {
  295. buffer_offset = first_bit * XFS_BLI_CHUNK;
  296. vecp->i_addr = xfs_buf_offset(bp, buffer_offset);
  297. vecp->i_len = nbits * XFS_BLI_CHUNK;
  298. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_BCHUNK);
  299. /* You would think we need to bump the nvecs here too, but we do not
  300. * this number is used by recovery, and it gets confused by the boundary
  301. * split here
  302. * nvecs++;
  303. */
  304. vecp++;
  305. first_bit = next_bit;
  306. last_bit = next_bit;
  307. nbits = 1;
  308. } else {
  309. last_bit++;
  310. nbits++;
  311. }
  312. }
  313. bip->bli_format.blf_size = nvecs;
  314. /*
  315. * Check to make sure everything is consistent.
  316. */
  317. xfs_buf_item_trace("FORMAT NORM", bip);
  318. xfs_buf_item_log_check(bip);
  319. }
  320. /*
  321. * This is called to pin the buffer associated with the buf log
  322. * item in memory so it cannot be written out. Simply call bpin()
  323. * on the buffer to do this.
  324. */
  325. STATIC void
  326. xfs_buf_item_pin(
  327. xfs_buf_log_item_t *bip)
  328. {
  329. xfs_buf_t *bp;
  330. bp = bip->bli_buf;
  331. ASSERT(XFS_BUF_ISBUSY(bp));
  332. ASSERT(atomic_read(&bip->bli_refcount) > 0);
  333. ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||
  334. (bip->bli_flags & XFS_BLI_STALE));
  335. xfs_buf_item_trace("PIN", bip);
  336. xfs_buftrace("XFS_PIN", bp);
  337. xfs_bpin(bp);
  338. }
  339. /*
  340. * This is called to unpin the buffer associated with the buf log
  341. * item which was previously pinned with a call to xfs_buf_item_pin().
  342. * Just call bunpin() on the buffer to do this.
  343. *
  344. * Also drop the reference to the buf item for the current transaction.
  345. * If the XFS_BLI_STALE flag is set and we are the last reference,
  346. * then free up the buf log item and unlock the buffer.
  347. */
  348. STATIC void
  349. xfs_buf_item_unpin(
  350. xfs_buf_log_item_t *bip,
  351. int stale)
  352. {
  353. struct xfs_ail *ailp;
  354. xfs_buf_t *bp;
  355. int freed;
  356. bp = bip->bli_buf;
  357. ASSERT(bp != NULL);
  358. ASSERT(XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *) == bip);
  359. ASSERT(atomic_read(&bip->bli_refcount) > 0);
  360. xfs_buf_item_trace("UNPIN", bip);
  361. xfs_buftrace("XFS_UNPIN", bp);
  362. freed = atomic_dec_and_test(&bip->bli_refcount);
  363. ailp = bip->bli_item.li_ailp;
  364. xfs_bunpin(bp);
  365. if (freed && stale) {
  366. ASSERT(bip->bli_flags & XFS_BLI_STALE);
  367. ASSERT(XFS_BUF_VALUSEMA(bp) <= 0);
  368. ASSERT(!(XFS_BUF_ISDELAYWRITE(bp)));
  369. ASSERT(XFS_BUF_ISSTALE(bp));
  370. ASSERT(bip->bli_format.blf_flags & XFS_BLI_CANCEL);
  371. xfs_buf_item_trace("UNPIN STALE", bip);
  372. xfs_buftrace("XFS_UNPIN STALE", bp);
  373. /*
  374. * If we get called here because of an IO error, we may
  375. * or may not have the item on the AIL. xfs_trans_ail_delete()
  376. * will take care of that situation.
  377. * xfs_trans_ail_delete() drops the AIL lock.
  378. */
  379. if (bip->bli_flags & XFS_BLI_STALE_INODE) {
  380. xfs_buf_do_callbacks(bp, (xfs_log_item_t *)bip);
  381. XFS_BUF_SET_FSPRIVATE(bp, NULL);
  382. XFS_BUF_CLR_IODONE_FUNC(bp);
  383. } else {
  384. spin_lock(&ailp->xa_lock);
  385. xfs_trans_ail_delete(ailp, (xfs_log_item_t *)bip);
  386. xfs_buf_item_relse(bp);
  387. ASSERT(XFS_BUF_FSPRIVATE(bp, void *) == NULL);
  388. }
  389. xfs_buf_relse(bp);
  390. }
  391. }
  392. /*
  393. * this is called from uncommit in the forced-shutdown path.
  394. * we need to check to see if the reference count on the log item
  395. * is going to drop to zero. If so, unpin will free the log item
  396. * so we need to free the item's descriptor (that points to the item)
  397. * in the transaction.
  398. */
  399. STATIC void
  400. xfs_buf_item_unpin_remove(
  401. xfs_buf_log_item_t *bip,
  402. xfs_trans_t *tp)
  403. {
  404. xfs_buf_t *bp;
  405. xfs_log_item_desc_t *lidp;
  406. int stale = 0;
  407. bp = bip->bli_buf;
  408. /*
  409. * will xfs_buf_item_unpin() call xfs_buf_item_relse()?
  410. */
  411. if ((atomic_read(&bip->bli_refcount) == 1) &&
  412. (bip->bli_flags & XFS_BLI_STALE)) {
  413. ASSERT(XFS_BUF_VALUSEMA(bip->bli_buf) <= 0);
  414. xfs_buf_item_trace("UNPIN REMOVE", bip);
  415. xfs_buftrace("XFS_UNPIN_REMOVE", bp);
  416. /*
  417. * yes -- clear the xaction descriptor in-use flag
  418. * and free the chunk if required. We can safely
  419. * do some work here and then call buf_item_unpin
  420. * to do the rest because if the if is true, then
  421. * we are holding the buffer locked so no one else
  422. * will be able to bump up the refcount.
  423. */
  424. lidp = xfs_trans_find_item(tp, (xfs_log_item_t *) bip);
  425. stale = lidp->lid_flags & XFS_LID_BUF_STALE;
  426. xfs_trans_free_item(tp, lidp);
  427. /*
  428. * Since the transaction no longer refers to the buffer,
  429. * the buffer should no longer refer to the transaction.
  430. */
  431. XFS_BUF_SET_FSPRIVATE2(bp, NULL);
  432. }
  433. xfs_buf_item_unpin(bip, stale);
  434. return;
  435. }
  436. /*
  437. * This is called to attempt to lock the buffer associated with this
  438. * buf log item. Don't sleep on the buffer lock. If we can't get
  439. * the lock right away, return 0. If we can get the lock, pull the
  440. * buffer from the free list, mark it busy, and return 1.
  441. */
  442. STATIC uint
  443. xfs_buf_item_trylock(
  444. xfs_buf_log_item_t *bip)
  445. {
  446. xfs_buf_t *bp;
  447. bp = bip->bli_buf;
  448. if (XFS_BUF_ISPINNED(bp)) {
  449. return XFS_ITEM_PINNED;
  450. }
  451. if (!XFS_BUF_CPSEMA(bp)) {
  452. return XFS_ITEM_LOCKED;
  453. }
  454. /*
  455. * Remove the buffer from the free list. Only do this
  456. * if it's on the free list. Private buffers like the
  457. * superblock buffer are not.
  458. */
  459. XFS_BUF_HOLD(bp);
  460. ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
  461. xfs_buf_item_trace("TRYLOCK SUCCESS", bip);
  462. return XFS_ITEM_SUCCESS;
  463. }
  464. /*
  465. * Release the buffer associated with the buf log item.
  466. * If there is no dirty logged data associated with the
  467. * buffer recorded in the buf log item, then free the
  468. * buf log item and remove the reference to it in the
  469. * buffer.
  470. *
  471. * This call ignores the recursion count. It is only called
  472. * when the buffer should REALLY be unlocked, regardless
  473. * of the recursion count.
  474. *
  475. * If the XFS_BLI_HOLD flag is set in the buf log item, then
  476. * free the log item if necessary but do not unlock the buffer.
  477. * This is for support of xfs_trans_bhold(). Make sure the
  478. * XFS_BLI_HOLD field is cleared if we don't free the item.
  479. */
  480. STATIC void
  481. xfs_buf_item_unlock(
  482. xfs_buf_log_item_t *bip)
  483. {
  484. int aborted;
  485. xfs_buf_t *bp;
  486. uint hold;
  487. bp = bip->bli_buf;
  488. xfs_buftrace("XFS_UNLOCK", bp);
  489. /*
  490. * Clear the buffer's association with this transaction.
  491. */
  492. XFS_BUF_SET_FSPRIVATE2(bp, NULL);
  493. /*
  494. * If this is a transaction abort, don't return early.
  495. * Instead, allow the brelse to happen.
  496. * Normally it would be done for stale (cancelled) buffers
  497. * at unpin time, but we'll never go through the pin/unpin
  498. * cycle if we abort inside commit.
  499. */
  500. aborted = (bip->bli_item.li_flags & XFS_LI_ABORTED) != 0;
  501. /*
  502. * If the buf item is marked stale, then don't do anything.
  503. * We'll unlock the buffer and free the buf item when the
  504. * buffer is unpinned for the last time.
  505. */
  506. if (bip->bli_flags & XFS_BLI_STALE) {
  507. bip->bli_flags &= ~XFS_BLI_LOGGED;
  508. xfs_buf_item_trace("UNLOCK STALE", bip);
  509. ASSERT(bip->bli_format.blf_flags & XFS_BLI_CANCEL);
  510. if (!aborted)
  511. return;
  512. }
  513. /*
  514. * Drop the transaction's reference to the log item if
  515. * it was not logged as part of the transaction. Otherwise
  516. * we'll drop the reference in xfs_buf_item_unpin() when
  517. * the transaction is really through with the buffer.
  518. */
  519. if (!(bip->bli_flags & XFS_BLI_LOGGED)) {
  520. atomic_dec(&bip->bli_refcount);
  521. } else {
  522. /*
  523. * Clear the logged flag since this is per
  524. * transaction state.
  525. */
  526. bip->bli_flags &= ~XFS_BLI_LOGGED;
  527. }
  528. /*
  529. * Before possibly freeing the buf item, determine if we should
  530. * release the buffer at the end of this routine.
  531. */
  532. hold = bip->bli_flags & XFS_BLI_HOLD;
  533. xfs_buf_item_trace("UNLOCK", bip);
  534. /*
  535. * If the buf item isn't tracking any data, free it.
  536. * Otherwise, if XFS_BLI_HOLD is set clear it.
  537. */
  538. if (xfs_bitmap_empty(bip->bli_format.blf_data_map,
  539. bip->bli_format.blf_map_size)) {
  540. xfs_buf_item_relse(bp);
  541. } else if (hold) {
  542. bip->bli_flags &= ~XFS_BLI_HOLD;
  543. }
  544. /*
  545. * Release the buffer if XFS_BLI_HOLD was not set.
  546. */
  547. if (!hold) {
  548. xfs_buf_relse(bp);
  549. }
  550. }
  551. /*
  552. * This is called to find out where the oldest active copy of the
  553. * buf log item in the on disk log resides now that the last log
  554. * write of it completed at the given lsn.
  555. * We always re-log all the dirty data in a buffer, so usually the
  556. * latest copy in the on disk log is the only one that matters. For
  557. * those cases we simply return the given lsn.
  558. *
  559. * The one exception to this is for buffers full of newly allocated
  560. * inodes. These buffers are only relogged with the XFS_BLI_INODE_BUF
  561. * flag set, indicating that only the di_next_unlinked fields from the
  562. * inodes in the buffers will be replayed during recovery. If the
  563. * original newly allocated inode images have not yet been flushed
  564. * when the buffer is so relogged, then we need to make sure that we
  565. * keep the old images in the 'active' portion of the log. We do this
  566. * by returning the original lsn of that transaction here rather than
  567. * the current one.
  568. */
  569. STATIC xfs_lsn_t
  570. xfs_buf_item_committed(
  571. xfs_buf_log_item_t *bip,
  572. xfs_lsn_t lsn)
  573. {
  574. xfs_buf_item_trace("COMMITTED", bip);
  575. if ((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) &&
  576. (bip->bli_item.li_lsn != 0)) {
  577. return bip->bli_item.li_lsn;
  578. }
  579. return (lsn);
  580. }
  581. /*
  582. * This is called to asynchronously write the buffer associated with this
  583. * buf log item out to disk. The buffer will already have been locked by
  584. * a successful call to xfs_buf_item_trylock(). If the buffer still has
  585. * B_DELWRI set, then get it going out to disk with a call to bawrite().
  586. * If not, then just release the buffer.
  587. */
  588. STATIC void
  589. xfs_buf_item_push(
  590. xfs_buf_log_item_t *bip)
  591. {
  592. xfs_buf_t *bp;
  593. ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
  594. xfs_buf_item_trace("PUSH", bip);
  595. bp = bip->bli_buf;
  596. if (XFS_BUF_ISDELAYWRITE(bp)) {
  597. int error;
  598. error = xfs_bawrite(bip->bli_item.li_mountp, bp);
  599. if (error)
  600. xfs_fs_cmn_err(CE_WARN, bip->bli_item.li_mountp,
  601. "xfs_buf_item_push: pushbuf error %d on bip %p, bp %p",
  602. error, bip, bp);
  603. } else {
  604. xfs_buf_relse(bp);
  605. }
  606. }
  607. /* ARGSUSED */
  608. STATIC void
  609. xfs_buf_item_committing(xfs_buf_log_item_t *bip, xfs_lsn_t commit_lsn)
  610. {
  611. }
  612. /*
  613. * This is the ops vector shared by all buf log items.
  614. */
  615. static struct xfs_item_ops xfs_buf_item_ops = {
  616. .iop_size = (uint(*)(xfs_log_item_t*))xfs_buf_item_size,
  617. .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))
  618. xfs_buf_item_format,
  619. .iop_pin = (void(*)(xfs_log_item_t*))xfs_buf_item_pin,
  620. .iop_unpin = (void(*)(xfs_log_item_t*, int))xfs_buf_item_unpin,
  621. .iop_unpin_remove = (void(*)(xfs_log_item_t*, xfs_trans_t *))
  622. xfs_buf_item_unpin_remove,
  623. .iop_trylock = (uint(*)(xfs_log_item_t*))xfs_buf_item_trylock,
  624. .iop_unlock = (void(*)(xfs_log_item_t*))xfs_buf_item_unlock,
  625. .iop_committed = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t))
  626. xfs_buf_item_committed,
  627. .iop_push = (void(*)(xfs_log_item_t*))xfs_buf_item_push,
  628. .iop_pushbuf = NULL,
  629. .iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t))
  630. xfs_buf_item_committing
  631. };
  632. /*
  633. * Allocate a new buf log item to go with the given buffer.
  634. * Set the buffer's b_fsprivate field to point to the new
  635. * buf log item. If there are other item's attached to the
  636. * buffer (see xfs_buf_attach_iodone() below), then put the
  637. * buf log item at the front.
  638. */
  639. void
  640. xfs_buf_item_init(
  641. xfs_buf_t *bp,
  642. xfs_mount_t *mp)
  643. {
  644. xfs_log_item_t *lip;
  645. xfs_buf_log_item_t *bip;
  646. int chunks;
  647. int map_size;
  648. /*
  649. * Check to see if there is already a buf log item for
  650. * this buffer. If there is, it is guaranteed to be
  651. * the first. If we do already have one, there is
  652. * nothing to do here so return.
  653. */
  654. if (bp->b_mount != mp)
  655. bp->b_mount = mp;
  656. XFS_BUF_SET_BDSTRAT_FUNC(bp, xfs_bdstrat_cb);
  657. if (XFS_BUF_FSPRIVATE(bp, void *) != NULL) {
  658. lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *);
  659. if (lip->li_type == XFS_LI_BUF) {
  660. return;
  661. }
  662. }
  663. /*
  664. * chunks is the number of XFS_BLI_CHUNK size pieces
  665. * the buffer can be divided into. Make sure not to
  666. * truncate any pieces. map_size is the size of the
  667. * bitmap needed to describe the chunks of the buffer.
  668. */
  669. chunks = (int)((XFS_BUF_COUNT(bp) + (XFS_BLI_CHUNK - 1)) >> XFS_BLI_SHIFT);
  670. map_size = (int)((chunks + NBWORD) >> BIT_TO_WORD_SHIFT);
  671. bip = (xfs_buf_log_item_t*)kmem_zone_zalloc(xfs_buf_item_zone,
  672. KM_SLEEP);
  673. bip->bli_item.li_type = XFS_LI_BUF;
  674. bip->bli_item.li_ops = &xfs_buf_item_ops;
  675. bip->bli_item.li_mountp = mp;
  676. bip->bli_item.li_ailp = mp->m_ail;
  677. bip->bli_buf = bp;
  678. xfs_buf_hold(bp);
  679. bip->bli_format.blf_type = XFS_LI_BUF;
  680. bip->bli_format.blf_blkno = (__int64_t)XFS_BUF_ADDR(bp);
  681. bip->bli_format.blf_len = (ushort)BTOBB(XFS_BUF_COUNT(bp));
  682. bip->bli_format.blf_map_size = map_size;
  683. #ifdef XFS_BLI_TRACE
  684. bip->bli_trace = ktrace_alloc(XFS_BLI_TRACE_SIZE, KM_NOFS);
  685. #endif
  686. #ifdef XFS_TRANS_DEBUG
  687. /*
  688. * Allocate the arrays for tracking what needs to be logged
  689. * and what our callers request to be logged. bli_orig
  690. * holds a copy of the original, clean buffer for comparison
  691. * against, and bli_logged keeps a 1 bit flag per byte in
  692. * the buffer to indicate which bytes the callers have asked
  693. * to have logged.
  694. */
  695. bip->bli_orig = (char *)kmem_alloc(XFS_BUF_COUNT(bp), KM_SLEEP);
  696. memcpy(bip->bli_orig, XFS_BUF_PTR(bp), XFS_BUF_COUNT(bp));
  697. bip->bli_logged = (char *)kmem_zalloc(XFS_BUF_COUNT(bp) / NBBY, KM_SLEEP);
  698. #endif
  699. /*
  700. * Put the buf item into the list of items attached to the
  701. * buffer at the front.
  702. */
  703. if (XFS_BUF_FSPRIVATE(bp, void *) != NULL) {
  704. bip->bli_item.li_bio_list =
  705. XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *);
  706. }
  707. XFS_BUF_SET_FSPRIVATE(bp, bip);
  708. }
  709. /*
  710. * Mark bytes first through last inclusive as dirty in the buf
  711. * item's bitmap.
  712. */
  713. void
  714. xfs_buf_item_log(
  715. xfs_buf_log_item_t *bip,
  716. uint first,
  717. uint last)
  718. {
  719. uint first_bit;
  720. uint last_bit;
  721. uint bits_to_set;
  722. uint bits_set;
  723. uint word_num;
  724. uint *wordp;
  725. uint bit;
  726. uint end_bit;
  727. uint mask;
  728. /*
  729. * Mark the item as having some dirty data for
  730. * quick reference in xfs_buf_item_dirty.
  731. */
  732. bip->bli_flags |= XFS_BLI_DIRTY;
  733. /*
  734. * Convert byte offsets to bit numbers.
  735. */
  736. first_bit = first >> XFS_BLI_SHIFT;
  737. last_bit = last >> XFS_BLI_SHIFT;
  738. /*
  739. * Calculate the total number of bits to be set.
  740. */
  741. bits_to_set = last_bit - first_bit + 1;
  742. /*
  743. * Get a pointer to the first word in the bitmap
  744. * to set a bit in.
  745. */
  746. word_num = first_bit >> BIT_TO_WORD_SHIFT;
  747. wordp = &(bip->bli_format.blf_data_map[word_num]);
  748. /*
  749. * Calculate the starting bit in the first word.
  750. */
  751. bit = first_bit & (uint)(NBWORD - 1);
  752. /*
  753. * First set any bits in the first word of our range.
  754. * If it starts at bit 0 of the word, it will be
  755. * set below rather than here. That is what the variable
  756. * bit tells us. The variable bits_set tracks the number
  757. * of bits that have been set so far. End_bit is the number
  758. * of the last bit to be set in this word plus one.
  759. */
  760. if (bit) {
  761. end_bit = MIN(bit + bits_to_set, (uint)NBWORD);
  762. mask = ((1 << (end_bit - bit)) - 1) << bit;
  763. *wordp |= mask;
  764. wordp++;
  765. bits_set = end_bit - bit;
  766. } else {
  767. bits_set = 0;
  768. }
  769. /*
  770. * Now set bits a whole word at a time that are between
  771. * first_bit and last_bit.
  772. */
  773. while ((bits_to_set - bits_set) >= NBWORD) {
  774. *wordp |= 0xffffffff;
  775. bits_set += NBWORD;
  776. wordp++;
  777. }
  778. /*
  779. * Finally, set any bits left to be set in one last partial word.
  780. */
  781. end_bit = bits_to_set - bits_set;
  782. if (end_bit) {
  783. mask = (1 << end_bit) - 1;
  784. *wordp |= mask;
  785. }
  786. xfs_buf_item_log_debug(bip, first, last);
  787. }
  788. /*
  789. * Return 1 if the buffer has some data that has been logged (at any
  790. * point, not just the current transaction) and 0 if not.
  791. */
  792. uint
  793. xfs_buf_item_dirty(
  794. xfs_buf_log_item_t *bip)
  795. {
  796. return (bip->bli_flags & XFS_BLI_DIRTY);
  797. }
  798. STATIC void
  799. xfs_buf_item_free(
  800. xfs_buf_log_item_t *bip)
  801. {
  802. #ifdef XFS_TRANS_DEBUG
  803. kmem_free(bip->bli_orig);
  804. kmem_free(bip->bli_logged);
  805. #endif /* XFS_TRANS_DEBUG */
  806. #ifdef XFS_BLI_TRACE
  807. ktrace_free(bip->bli_trace);
  808. #endif
  809. kmem_zone_free(xfs_buf_item_zone, bip);
  810. }
  811. /*
  812. * This is called when the buf log item is no longer needed. It should
  813. * free the buf log item associated with the given buffer and clear
  814. * the buffer's pointer to the buf log item. If there are no more
  815. * items in the list, clear the b_iodone field of the buffer (see
  816. * xfs_buf_attach_iodone() below).
  817. */
  818. void
  819. xfs_buf_item_relse(
  820. xfs_buf_t *bp)
  821. {
  822. xfs_buf_log_item_t *bip;
  823. xfs_buftrace("XFS_RELSE", bp);
  824. bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t*);
  825. XFS_BUF_SET_FSPRIVATE(bp, bip->bli_item.li_bio_list);
  826. if ((XFS_BUF_FSPRIVATE(bp, void *) == NULL) &&
  827. (XFS_BUF_IODONE_FUNC(bp) != NULL)) {
  828. XFS_BUF_CLR_IODONE_FUNC(bp);
  829. }
  830. xfs_buf_rele(bp);
  831. xfs_buf_item_free(bip);
  832. }
  833. /*
  834. * Add the given log item with its callback to the list of callbacks
  835. * to be called when the buffer's I/O completes. If it is not set
  836. * already, set the buffer's b_iodone() routine to be
  837. * xfs_buf_iodone_callbacks() and link the log item into the list of
  838. * items rooted at b_fsprivate. Items are always added as the second
  839. * entry in the list if there is a first, because the buf item code
  840. * assumes that the buf log item is first.
  841. */
  842. void
  843. xfs_buf_attach_iodone(
  844. xfs_buf_t *bp,
  845. void (*cb)(xfs_buf_t *, xfs_log_item_t *),
  846. xfs_log_item_t *lip)
  847. {
  848. xfs_log_item_t *head_lip;
  849. ASSERT(XFS_BUF_ISBUSY(bp));
  850. ASSERT(XFS_BUF_VALUSEMA(bp) <= 0);
  851. lip->li_cb = cb;
  852. if (XFS_BUF_FSPRIVATE(bp, void *) != NULL) {
  853. head_lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *);
  854. lip->li_bio_list = head_lip->li_bio_list;
  855. head_lip->li_bio_list = lip;
  856. } else {
  857. XFS_BUF_SET_FSPRIVATE(bp, lip);
  858. }
  859. ASSERT((XFS_BUF_IODONE_FUNC(bp) == xfs_buf_iodone_callbacks) ||
  860. (XFS_BUF_IODONE_FUNC(bp) == NULL));
  861. XFS_BUF_SET_IODONE_FUNC(bp, xfs_buf_iodone_callbacks);
  862. }
  863. STATIC void
  864. xfs_buf_do_callbacks(
  865. xfs_buf_t *bp,
  866. xfs_log_item_t *lip)
  867. {
  868. xfs_log_item_t *nlip;
  869. while (lip != NULL) {
  870. nlip = lip->li_bio_list;
  871. ASSERT(lip->li_cb != NULL);
  872. /*
  873. * Clear the next pointer so we don't have any
  874. * confusion if the item is added to another buf.
  875. * Don't touch the log item after calling its
  876. * callback, because it could have freed itself.
  877. */
  878. lip->li_bio_list = NULL;
  879. lip->li_cb(bp, lip);
  880. lip = nlip;
  881. }
  882. }
  883. /*
  884. * This is the iodone() function for buffers which have had callbacks
  885. * attached to them by xfs_buf_attach_iodone(). It should remove each
  886. * log item from the buffer's list and call the callback of each in turn.
  887. * When done, the buffer's fsprivate field is set to NULL and the buffer
  888. * is unlocked with a call to iodone().
  889. */
  890. void
  891. xfs_buf_iodone_callbacks(
  892. xfs_buf_t *bp)
  893. {
  894. xfs_log_item_t *lip;
  895. static ulong lasttime;
  896. static xfs_buftarg_t *lasttarg;
  897. xfs_mount_t *mp;
  898. ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
  899. lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *);
  900. if (XFS_BUF_GETERROR(bp) != 0) {
  901. /*
  902. * If we've already decided to shutdown the filesystem
  903. * because of IO errors, there's no point in giving this
  904. * a retry.
  905. */
  906. mp = lip->li_mountp;
  907. if (XFS_FORCED_SHUTDOWN(mp)) {
  908. ASSERT(XFS_BUF_TARGET(bp) == mp->m_ddev_targp);
  909. XFS_BUF_SUPER_STALE(bp);
  910. xfs_buftrace("BUF_IODONE_CB", bp);
  911. xfs_buf_do_callbacks(bp, lip);
  912. XFS_BUF_SET_FSPRIVATE(bp, NULL);
  913. XFS_BUF_CLR_IODONE_FUNC(bp);
  914. xfs_biodone(bp);
  915. return;
  916. }
  917. if ((XFS_BUF_TARGET(bp) != lasttarg) ||
  918. (time_after(jiffies, (lasttime + 5*HZ)))) {
  919. lasttime = jiffies;
  920. cmn_err(CE_ALERT, "Device %s, XFS metadata write error"
  921. " block 0x%llx in %s",
  922. XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)),
  923. (__uint64_t)XFS_BUF_ADDR(bp), mp->m_fsname);
  924. }
  925. lasttarg = XFS_BUF_TARGET(bp);
  926. if (XFS_BUF_ISASYNC(bp)) {
  927. /*
  928. * If the write was asynchronous then noone will be
  929. * looking for the error. Clear the error state
  930. * and write the buffer out again delayed write.
  931. *
  932. * XXXsup This is OK, so long as we catch these
  933. * before we start the umount; we don't want these
  934. * DELWRI metadata bufs to be hanging around.
  935. */
  936. XFS_BUF_ERROR(bp,0); /* errno of 0 unsets the flag */
  937. if (!(XFS_BUF_ISSTALE(bp))) {
  938. XFS_BUF_DELAYWRITE(bp);
  939. XFS_BUF_DONE(bp);
  940. XFS_BUF_SET_START(bp);
  941. }
  942. ASSERT(XFS_BUF_IODONE_FUNC(bp));
  943. xfs_buftrace("BUF_IODONE ASYNC", bp);
  944. xfs_buf_relse(bp);
  945. } else {
  946. /*
  947. * If the write of the buffer was not asynchronous,
  948. * then we want to make sure to return the error
  949. * to the caller of bwrite(). Because of this we
  950. * cannot clear the B_ERROR state at this point.
  951. * Instead we install a callback function that
  952. * will be called when the buffer is released, and
  953. * that routine will clear the error state and
  954. * set the buffer to be written out again after
  955. * some delay.
  956. */
  957. /* We actually overwrite the existing b-relse
  958. function at times, but we're gonna be shutting down
  959. anyway. */
  960. XFS_BUF_SET_BRELSE_FUNC(bp,xfs_buf_error_relse);
  961. XFS_BUF_DONE(bp);
  962. XFS_BUF_FINISH_IOWAIT(bp);
  963. }
  964. return;
  965. }
  966. #ifdef XFSERRORDEBUG
  967. xfs_buftrace("XFS BUFCB NOERR", bp);
  968. #endif
  969. xfs_buf_do_callbacks(bp, lip);
  970. XFS_BUF_SET_FSPRIVATE(bp, NULL);
  971. XFS_BUF_CLR_IODONE_FUNC(bp);
  972. xfs_biodone(bp);
  973. }
  974. /*
  975. * This is a callback routine attached to a buffer which gets an error
  976. * when being written out synchronously.
  977. */
  978. STATIC void
  979. xfs_buf_error_relse(
  980. xfs_buf_t *bp)
  981. {
  982. xfs_log_item_t *lip;
  983. xfs_mount_t *mp;
  984. lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *);
  985. mp = (xfs_mount_t *)lip->li_mountp;
  986. ASSERT(XFS_BUF_TARGET(bp) == mp->m_ddev_targp);
  987. XFS_BUF_STALE(bp);
  988. XFS_BUF_DONE(bp);
  989. XFS_BUF_UNDELAYWRITE(bp);
  990. XFS_BUF_ERROR(bp,0);
  991. xfs_buftrace("BUF_ERROR_RELSE", bp);
  992. if (! XFS_FORCED_SHUTDOWN(mp))
  993. xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
  994. /*
  995. * We have to unpin the pinned buffers so do the
  996. * callbacks.
  997. */
  998. xfs_buf_do_callbacks(bp, lip);
  999. XFS_BUF_SET_FSPRIVATE(bp, NULL);
  1000. XFS_BUF_CLR_IODONE_FUNC(bp);
  1001. XFS_BUF_SET_BRELSE_FUNC(bp,NULL);
  1002. xfs_buf_relse(bp);
  1003. }
  1004. /*
  1005. * This is the iodone() function for buffers which have been
  1006. * logged. It is called when they are eventually flushed out.
  1007. * It should remove the buf item from the AIL, and free the buf item.
  1008. * It is called by xfs_buf_iodone_callbacks() above which will take
  1009. * care of cleaning up the buffer itself.
  1010. */
  1011. /* ARGSUSED */
  1012. void
  1013. xfs_buf_iodone(
  1014. xfs_buf_t *bp,
  1015. xfs_buf_log_item_t *bip)
  1016. {
  1017. struct xfs_ail *ailp = bip->bli_item.li_ailp;
  1018. ASSERT(bip->bli_buf == bp);
  1019. xfs_buf_rele(bp);
  1020. /*
  1021. * If we are forcibly shutting down, this may well be
  1022. * off the AIL already. That's because we simulate the
  1023. * log-committed callbacks to unpin these buffers. Or we may never
  1024. * have put this item on AIL because of the transaction was
  1025. * aborted forcibly. xfs_trans_ail_delete() takes care of these.
  1026. *
  1027. * Either way, AIL is useless if we're forcing a shutdown.
  1028. */
  1029. spin_lock(&ailp->xa_lock);
  1030. xfs_trans_ail_delete(ailp, (xfs_log_item_t *)bip);
  1031. xfs_buf_item_free(bip);
  1032. }
  1033. #if defined(XFS_BLI_TRACE)
  1034. void
  1035. xfs_buf_item_trace(
  1036. char *id,
  1037. xfs_buf_log_item_t *bip)
  1038. {
  1039. xfs_buf_t *bp;
  1040. ASSERT(bip->bli_trace != NULL);
  1041. bp = bip->bli_buf;
  1042. ktrace_enter(bip->bli_trace,
  1043. (void *)id,
  1044. (void *)bip->bli_buf,
  1045. (void *)((unsigned long)bip->bli_flags),
  1046. (void *)((unsigned long)bip->bli_recur),
  1047. (void *)((unsigned long)atomic_read(&bip->bli_refcount)),
  1048. (void *)((unsigned long)
  1049. (0xFFFFFFFF & XFS_BUF_ADDR(bp) >> 32)),
  1050. (void *)((unsigned long)(0xFFFFFFFF & XFS_BUF_ADDR(bp))),
  1051. (void *)((unsigned long)XFS_BUF_COUNT(bp)),
  1052. (void *)((unsigned long)XFS_BUF_BFLAGS(bp)),
  1053. XFS_BUF_FSPRIVATE(bp, void *),
  1054. XFS_BUF_FSPRIVATE2(bp, void *),
  1055. (void *)(unsigned long)XFS_BUF_ISPINNED(bp),
  1056. (void *)XFS_BUF_IODONE_FUNC(bp),
  1057. (void *)((unsigned long)(XFS_BUF_VALUSEMA(bp))),
  1058. (void *)bip->bli_item.li_desc,
  1059. (void *)((unsigned long)bip->bli_item.li_flags));
  1060. }
  1061. #endif /* XFS_BLI_TRACE */