Lines Matching refs:bip

86 	struct xfs_buf_log_item		*bip,  in xfs_buf_item_size_segment()  argument
92 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_size_segment()
192 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_size() local
193 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_size()
198 ASSERT(atomic_read(&bip->bli_refcount) > 0); in xfs_buf_item_size()
199 if (bip->bli_flags & XFS_BLI_STALE) { in xfs_buf_item_size()
205 trace_xfs_buf_item_size_stale(bip); in xfs_buf_item_size()
206 ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); in xfs_buf_item_size()
207 *nvecs += bip->bli_format_count; in xfs_buf_item_size()
208 for (i = 0; i < bip->bli_format_count; i++) { in xfs_buf_item_size()
209 *nbytes += xfs_buf_log_format_size(&bip->bli_formats[i]); in xfs_buf_item_size()
214 ASSERT(bip->bli_flags & XFS_BLI_LOGGED); in xfs_buf_item_size()
216 if (bip->bli_flags & XFS_BLI_ORDERED) { in xfs_buf_item_size()
222 trace_xfs_buf_item_size_ordered(bip); in xfs_buf_item_size()
237 for (i = 0; i < bip->bli_format_count; i++) { in xfs_buf_item_size()
238 xfs_buf_item_size_segment(bip, &bip->bli_formats[i], offset, in xfs_buf_item_size()
249 trace_xfs_buf_item_size(bip); in xfs_buf_item_size()
269 struct xfs_buf_log_item *bip, in xfs_buf_item_format_segment() argument
275 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_format_segment()
283 blfp->blf_flags = bip->__bli_format.blf_flags; in xfs_buf_item_format_segment()
293 if (!(bip->bli_flags & XFS_BLI_STALE) && first_bit == -1) { in xfs_buf_item_format_segment()
304 if (bip->bli_flags & XFS_BLI_STALE) { in xfs_buf_item_format_segment()
310 trace_xfs_buf_item_format_stale(bip); in xfs_buf_item_format_segment()
400 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_format() local
401 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_format()
406 ASSERT(atomic_read(&bip->bli_refcount) > 0); in xfs_buf_item_format()
407 ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || in xfs_buf_item_format()
408 (bip->bli_flags & XFS_BLI_STALE)); in xfs_buf_item_format()
409 ASSERT((bip->bli_flags & XFS_BLI_STALE) || in xfs_buf_item_format()
410 (xfs_blft_from_flags(&bip->__bli_format) > XFS_BLFT_UNKNOWN_BUF in xfs_buf_item_format()
411 && xfs_blft_from_flags(&bip->__bli_format) < XFS_BLFT_MAX_BUF)); in xfs_buf_item_format()
412 ASSERT(!(bip->bli_flags & XFS_BLI_ORDERED) || in xfs_buf_item_format()
413 (bip->bli_flags & XFS_BLI_STALE)); in xfs_buf_item_format()
430 if (bip->bli_flags & XFS_BLI_INODE_BUF) { in xfs_buf_item_format()
432 !((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) && in xfs_buf_item_format()
434 bip->__bli_format.blf_flags |= XFS_BLF_INODE_BUF; in xfs_buf_item_format()
435 bip->bli_flags &= ~XFS_BLI_INODE_BUF; in xfs_buf_item_format()
438 for (i = 0; i < bip->bli_format_count; i++) { in xfs_buf_item_format()
439 xfs_buf_item_format_segment(bip, lv, &vecp, offset, in xfs_buf_item_format()
440 &bip->bli_formats[i]); in xfs_buf_item_format()
447 trace_xfs_buf_item_format(bip); in xfs_buf_item_format()
463 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_pin() local
465 ASSERT(atomic_read(&bip->bli_refcount) > 0); in xfs_buf_item_pin()
466 ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || in xfs_buf_item_pin()
467 (bip->bli_flags & XFS_BLI_ORDERED) || in xfs_buf_item_pin()
468 (bip->bli_flags & XFS_BLI_STALE)); in xfs_buf_item_pin()
470 trace_xfs_buf_item_pin(bip); in xfs_buf_item_pin()
472 atomic_inc(&bip->bli_refcount); in xfs_buf_item_pin()
473 atomic_inc(&bip->bli_buf->b_pin_count); in xfs_buf_item_pin()
485 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_unpin() local
486 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_unpin()
487 int stale = bip->bli_flags & XFS_BLI_STALE; in xfs_buf_item_unpin()
490 ASSERT(bp->b_log_item == bip); in xfs_buf_item_unpin()
491 ASSERT(atomic_read(&bip->bli_refcount) > 0); in xfs_buf_item_unpin()
493 trace_xfs_buf_item_unpin(bip); in xfs_buf_item_unpin()
504 freed = atomic_dec_and_test(&bip->bli_refcount); in xfs_buf_item_unpin()
515 ASSERT(bip->bli_flags & XFS_BLI_STALE); in xfs_buf_item_unpin()
518 ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); in xfs_buf_item_unpin()
522 trace_xfs_buf_item_unpin_stale(bip); in xfs_buf_item_unpin()
530 if (bip->bli_flags & XFS_BLI_STALE_INODE) { in xfs_buf_item_unpin()
557 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_push() local
558 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_push()
576 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); in xfs_buf_item_push()
578 trace_xfs_buf_item_push(bip); in xfs_buf_item_push()
602 struct xfs_buf_log_item *bip) in xfs_buf_item_put() argument
604 struct xfs_log_item *lip = &bip->bli_item; in xfs_buf_item_put()
609 if (!atomic_dec_and_test(&bip->bli_refcount)) in xfs_buf_item_put()
620 dirty = bip->bli_flags & XFS_BLI_DIRTY; in xfs_buf_item_put()
632 xfs_buf_item_relse(bip->bli_buf); in xfs_buf_item_put()
659 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_release() local
660 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_release()
662 bool hold = bip->bli_flags & XFS_BLI_HOLD; in xfs_buf_item_release()
663 bool stale = bip->bli_flags & XFS_BLI_STALE; in xfs_buf_item_release()
665 bool ordered = bip->bli_flags & XFS_BLI_ORDERED; in xfs_buf_item_release()
666 bool dirty = bip->bli_flags & XFS_BLI_DIRTY; in xfs_buf_item_release()
671 trace_xfs_buf_item_release(bip); in xfs_buf_item_release()
677 ASSERT((!ordered && dirty == xfs_buf_item_dirty_format(bip)) || in xfs_buf_item_release()
678 (ordered && dirty && !xfs_buf_item_dirty_format(bip))); in xfs_buf_item_release()
679 ASSERT(!stale || (bip->__bli_format.blf_flags & XFS_BLF_CANCEL)); in xfs_buf_item_release()
686 bip->bli_flags &= ~(XFS_BLI_LOGGED | XFS_BLI_HOLD | XFS_BLI_ORDERED); in xfs_buf_item_release()
694 released = xfs_buf_item_put(bip); in xfs_buf_item_release()
732 struct xfs_buf_log_item *bip = BUF_ITEM(lip); in xfs_buf_item_committed() local
734 trace_xfs_buf_item_committed(bip); in xfs_buf_item_committed()
736 if ((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) && lip->li_lsn != 0) in xfs_buf_item_committed()
754 struct xfs_buf_log_item *bip, in xfs_buf_item_get_format() argument
757 ASSERT(bip->bli_formats == NULL); in xfs_buf_item_get_format()
758 bip->bli_format_count = count; in xfs_buf_item_get_format()
761 bip->bli_formats = &bip->__bli_format; in xfs_buf_item_get_format()
765 bip->bli_formats = kmem_zalloc(count * sizeof(struct xfs_buf_log_format), in xfs_buf_item_get_format()
771 struct xfs_buf_log_item *bip) in xfs_buf_item_free_format() argument
773 if (bip->bli_formats != &bip->__bli_format) { in xfs_buf_item_free_format()
774 kmem_free(bip->bli_formats); in xfs_buf_item_free_format()
775 bip->bli_formats = NULL; in xfs_buf_item_free_format()
789 struct xfs_buf_log_item *bip = bp->b_log_item; in xfs_buf_item_init() local
800 if (bip) { in xfs_buf_item_init()
801 ASSERT(bip->bli_item.li_type == XFS_LI_BUF); in xfs_buf_item_init()
803 ASSERT(bip->bli_buf == bp); in xfs_buf_item_init()
807 bip = kmem_cache_zalloc(xfs_buf_item_cache, GFP_KERNEL | __GFP_NOFAIL); in xfs_buf_item_init()
808 xfs_log_item_init(mp, &bip->bli_item, XFS_LI_BUF, &xfs_buf_item_ops); in xfs_buf_item_init()
809 bip->bli_buf = bp; in xfs_buf_item_init()
820 xfs_buf_item_get_format(bip, bp->b_map_count); in xfs_buf_item_init()
822 for (i = 0; i < bip->bli_format_count; i++) { in xfs_buf_item_init()
828 kmem_cache_free(xfs_buf_item_cache, bip); in xfs_buf_item_init()
836 bip->bli_formats[i].blf_type = XFS_LI_BUF; in xfs_buf_item_init()
837 bip->bli_formats[i].blf_blkno = bp->b_maps[i].bm_bn; in xfs_buf_item_init()
838 bip->bli_formats[i].blf_len = bp->b_maps[i].bm_len; in xfs_buf_item_init()
839 bip->bli_formats[i].blf_map_size = map_size; in xfs_buf_item_init()
842 bp->b_log_item = bip; in xfs_buf_item_init()
938 struct xfs_buf_log_item *bip, in xfs_buf_item_log() argument
945 struct xfs_buf *bp = bip->bli_buf; in xfs_buf_item_log()
951 for (i = 0; i < bip->bli_format_count; i++) { in xfs_buf_item_log()
973 &bip->bli_formats[i].blf_data_map[0]); in xfs_buf_item_log()
986 struct xfs_buf_log_item *bip) in xfs_buf_item_dirty_format() argument
990 for (i = 0; i < bip->bli_format_count; i++) { in xfs_buf_item_dirty_format()
991 if (!xfs_bitmap_empty(bip->bli_formats[i].blf_data_map, in xfs_buf_item_dirty_format()
992 bip->bli_formats[i].blf_map_size)) in xfs_buf_item_dirty_format()
1001 struct xfs_buf_log_item *bip) in xfs_buf_item_free() argument
1003 xfs_buf_item_free_format(bip); in xfs_buf_item_free()
1004 kmem_free(bip->bli_item.li_lv_shadow); in xfs_buf_item_free()
1005 kmem_cache_free(xfs_buf_item_cache, bip); in xfs_buf_item_free()
1015 struct xfs_buf_log_item *bip = bp->b_log_item; in xfs_buf_item_relse() local
1018 ASSERT(!test_bit(XFS_LI_IN_AIL, &bip->bli_item.li_flags)); in xfs_buf_item_relse()
1022 xfs_buf_item_free(bip); in xfs_buf_item_relse()