Lines Matching refs:bip

87 	struct xfs_buf_log_item		*bip,  in xfs_buf_item_size_segment()  argument
93 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_size_segment()
193 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_size() local
194 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_size()
199 ASSERT(atomic_read(&bip->bli_refcount) > 0); in xfs_buf_item_size()
200 if (bip->bli_flags & XFS_BLI_STALE) { in xfs_buf_item_size()
206 trace_xfs_buf_item_size_stale(bip); in xfs_buf_item_size()
207 ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); in xfs_buf_item_size()
208 *nvecs += bip->bli_format_count; in xfs_buf_item_size()
209 for (i = 0; i < bip->bli_format_count; i++) { in xfs_buf_item_size()
210 *nbytes += xfs_buf_log_format_size(&bip->bli_formats[i]); in xfs_buf_item_size()
215 ASSERT(bip->bli_flags & XFS_BLI_LOGGED); in xfs_buf_item_size()
217 if (bip->bli_flags & XFS_BLI_ORDERED) { in xfs_buf_item_size()
223 trace_xfs_buf_item_size_ordered(bip); in xfs_buf_item_size()
238 for (i = 0; i < bip->bli_format_count; i++) { in xfs_buf_item_size()
239 xfs_buf_item_size_segment(bip, &bip->bli_formats[i], offset, in xfs_buf_item_size()
250 trace_xfs_buf_item_size(bip); in xfs_buf_item_size()
270 struct xfs_buf_log_item *bip, in xfs_buf_item_format_segment() argument
276 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_format_segment()
284 blfp->blf_flags = bip->__bli_format.blf_flags; in xfs_buf_item_format_segment()
294 if (!(bip->bli_flags & XFS_BLI_STALE) && first_bit == -1) { in xfs_buf_item_format_segment()
305 if (bip->bli_flags & XFS_BLI_STALE) { in xfs_buf_item_format_segment()
311 trace_xfs_buf_item_format_stale(bip); in xfs_buf_item_format_segment()
401 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_format() local
402 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_format()
407 ASSERT(atomic_read(&bip->bli_refcount) > 0); in xfs_buf_item_format()
408 ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || in xfs_buf_item_format()
409 (bip->bli_flags & XFS_BLI_STALE)); in xfs_buf_item_format()
410 ASSERT((bip->bli_flags & XFS_BLI_STALE) || in xfs_buf_item_format()
411 (xfs_blft_from_flags(&bip->__bli_format) > XFS_BLFT_UNKNOWN_BUF in xfs_buf_item_format()
412 && xfs_blft_from_flags(&bip->__bli_format) < XFS_BLFT_MAX_BUF)); in xfs_buf_item_format()
413 ASSERT(!(bip->bli_flags & XFS_BLI_ORDERED) || in xfs_buf_item_format()
414 (bip->bli_flags & XFS_BLI_STALE)); in xfs_buf_item_format()
431 if (bip->bli_flags & XFS_BLI_INODE_BUF) { in xfs_buf_item_format()
433 !((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) && in xfs_buf_item_format()
435 bip->__bli_format.blf_flags |= XFS_BLF_INODE_BUF; in xfs_buf_item_format()
436 bip->bli_flags &= ~XFS_BLI_INODE_BUF; in xfs_buf_item_format()
439 for (i = 0; i < bip->bli_format_count; i++) { in xfs_buf_item_format()
440 xfs_buf_item_format_segment(bip, lv, &vecp, offset, in xfs_buf_item_format()
441 &bip->bli_formats[i]); in xfs_buf_item_format()
448 trace_xfs_buf_item_format(bip); in xfs_buf_item_format()
464 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_pin() local
466 ASSERT(atomic_read(&bip->bli_refcount) > 0); in xfs_buf_item_pin()
467 ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || in xfs_buf_item_pin()
468 (bip->bli_flags & XFS_BLI_ORDERED) || in xfs_buf_item_pin()
469 (bip->bli_flags & XFS_BLI_STALE)); in xfs_buf_item_pin()
471 trace_xfs_buf_item_pin(bip); in xfs_buf_item_pin()
473 atomic_inc(&bip->bli_refcount); in xfs_buf_item_pin()
474 atomic_inc(&bip->bli_buf->b_pin_count); in xfs_buf_item_pin()
486 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_unpin() local
487 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_unpin()
488 int stale = bip->bli_flags & XFS_BLI_STALE; in xfs_buf_item_unpin()
491 ASSERT(bp->b_log_item == bip); in xfs_buf_item_unpin()
492 ASSERT(atomic_read(&bip->bli_refcount) > 0); in xfs_buf_item_unpin()
494 trace_xfs_buf_item_unpin(bip); in xfs_buf_item_unpin()
505 freed = atomic_dec_and_test(&bip->bli_refcount); in xfs_buf_item_unpin()
516 ASSERT(bip->bli_flags & XFS_BLI_STALE); in xfs_buf_item_unpin()
519 ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); in xfs_buf_item_unpin()
523 trace_xfs_buf_item_unpin_stale(bip); in xfs_buf_item_unpin()
531 if (bip->bli_flags & XFS_BLI_STALE_INODE) { in xfs_buf_item_unpin()
558 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_push() local
559 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_push()
577 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); in xfs_buf_item_push()
579 trace_xfs_buf_item_push(bip); in xfs_buf_item_push()
603 struct xfs_buf_log_item *bip) in xfs_buf_item_put() argument
605 struct xfs_log_item *lip = &bip->bli_item; in xfs_buf_item_put()
610 if (!atomic_dec_and_test(&bip->bli_refcount)) in xfs_buf_item_put()
621 dirty = bip->bli_flags & XFS_BLI_DIRTY; in xfs_buf_item_put()
633 xfs_buf_item_relse(bip->bli_buf); in xfs_buf_item_put()
660 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_release() local
661 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_release()
663 bool hold = bip->bli_flags & XFS_BLI_HOLD; in xfs_buf_item_release()
664 bool stale = bip->bli_flags & XFS_BLI_STALE; in xfs_buf_item_release()
666 bool ordered = bip->bli_flags & XFS_BLI_ORDERED; in xfs_buf_item_release()
667 bool dirty = bip->bli_flags & XFS_BLI_DIRTY; in xfs_buf_item_release()
672 trace_xfs_buf_item_release(bip); in xfs_buf_item_release()
678 ASSERT((!ordered && dirty == xfs_buf_item_dirty_format(bip)) || in xfs_buf_item_release()
679 (ordered && dirty && !xfs_buf_item_dirty_format(bip))); in xfs_buf_item_release()
680 ASSERT(!stale || (bip->__bli_format.blf_flags & XFS_BLF_CANCEL)); in xfs_buf_item_release()
687 bip->bli_flags &= ~(XFS_BLI_LOGGED | XFS_BLI_HOLD | XFS_BLI_ORDERED); in xfs_buf_item_release()
695 released = xfs_buf_item_put(bip); in xfs_buf_item_release()
733 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_committed() local
735 trace_xfs_buf_item_committed(bip); in xfs_buf_item_committed()
737 if ((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) && lip->li_lsn != 0) in xfs_buf_item_committed()
755 struct xfs_buf_log_item *bip, in xfs_buf_item_get_format() argument
758 ASSERT(bip->bli_formats == NULL); in xfs_buf_item_get_format()
759 bip->bli_format_count = count; in xfs_buf_item_get_format()
762 bip->bli_formats = &bip->__bli_format; in xfs_buf_item_get_format()
766 bip->bli_formats = kmem_zalloc(count * sizeof(struct xfs_buf_log_format), in xfs_buf_item_get_format()
772 struct xfs_buf_log_item *bip) in xfs_buf_item_free_format() argument
774 if (bip->bli_formats != &bip->__bli_format) { in xfs_buf_item_free_format()
775 kmem_free(bip->bli_formats); in xfs_buf_item_free_format()
776 bip->bli_formats = NULL; in xfs_buf_item_free_format()
790 struct xfs_buf_log_item *bip = bp->b_log_item; in xfs_buf_item_init() local
801 if (bip) { in xfs_buf_item_init()
802 ASSERT(bip->bli_item.li_type == XFS_LI_BUF); in xfs_buf_item_init()
804 ASSERT(bip->bli_buf == bp); in xfs_buf_item_init()
808 bip = kmem_cache_zalloc(xfs_buf_item_cache, GFP_KERNEL | __GFP_NOFAIL); in xfs_buf_item_init()
809 xfs_log_item_init(mp, &bip->bli_item, XFS_LI_BUF, &xfs_buf_item_ops); in xfs_buf_item_init()
810 bip->bli_buf = bp; in xfs_buf_item_init()
821 xfs_buf_item_get_format(bip, bp->b_map_count); in xfs_buf_item_init()
823 for (i = 0; i < bip->bli_format_count; i++) { in xfs_buf_item_init()
829 kmem_cache_free(xfs_buf_item_cache, bip); in xfs_buf_item_init()
837 bip->bli_formats[i].blf_type = XFS_LI_BUF; in xfs_buf_item_init()
838 bip->bli_formats[i].blf_blkno = bp->b_maps[i].bm_bn; in xfs_buf_item_init()
839 bip->bli_formats[i].blf_len = bp->b_maps[i].bm_len; in xfs_buf_item_init()
840 bip->bli_formats[i].blf_map_size = map_size; in xfs_buf_item_init()
843 bp->b_log_item = bip; in xfs_buf_item_init()
939 struct xfs_buf_log_item *bip, in xfs_buf_item_log() argument
946 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_log()
952 for (i = 0; i < bip->bli_format_count; i++) { in xfs_buf_item_log()
974 &bip->bli_formats[i].blf_data_map[0]); in xfs_buf_item_log()
987 struct xfs_buf_log_item *bip) in xfs_buf_item_dirty_format() argument
991 for (i = 0; i < bip->bli_format_count; i++) { in xfs_buf_item_dirty_format()
992 if (!xfs_bitmap_empty(bip->bli_formats[i].blf_data_map, in xfs_buf_item_dirty_format()
993 bip->bli_formats[i].blf_map_size)) in xfs_buf_item_dirty_format()
1002 struct xfs_buf_log_item *bip) in xfs_buf_item_free() argument
1004 xfs_buf_item_free_format(bip); in xfs_buf_item_free()
1005 kmem_free(bip->bli_item.li_lv_shadow); in xfs_buf_item_free()
1006 kmem_cache_free(xfs_buf_item_cache, bip); in xfs_buf_item_free()
1016 struct xfs_buf_log_item *bip = bp->b_log_item; in xfs_buf_item_relse() local
1019 ASSERT(!test_bit(XFS_LI_IN_AIL, &bip->bli_item.li_flags)); in xfs_buf_item_relse()
1021 if (atomic_read(&bip->bli_refcount)) in xfs_buf_item_relse()
1025 xfs_buf_item_free(bip); in xfs_buf_item_relse()