Lines Matching refs:cur

41  * given by cur.
45 struct xfs_btree_cur *cur,
49 trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.agno, bno,
51 cur->bc_rec.rc.rc_startblock = bno;
52 cur->bc_rec.rc.rc_blockcount = 0;
53 return xfs_btree_lookup(cur, XFS_LOOKUP_LE, stat);
58 * given by cur.
62 struct xfs_btree_cur *cur,
66 trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.agno, bno,
68 cur->bc_rec.rc.rc_startblock = bno;
69 cur->bc_rec.rc.rc_blockcount = 0;
70 return xfs_btree_lookup(cur, XFS_LOOKUP_GE, stat);
75 * given by cur.
79 struct xfs_btree_cur *cur,
83 trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.agno, bno,
85 cur->bc_rec.rc.rc_startblock = bno;
86 cur->bc_rec.rc.rc_blockcount = 0;
87 return xfs_btree_lookup(cur, XFS_LOOKUP_EQ, stat);
106 struct xfs_btree_cur *cur,
110 struct xfs_mount *mp = cur->bc_mp;
111 xfs_agnumber_t agno = cur->bc_ag.agno;
116 error = xfs_btree_get_rec(cur, &rec, stat);
122 agno = cur->bc_ag.agno;
147 trace_xfs_refcount_get(cur->bc_mp, cur->bc_ag.agno, irec);
160 * Update the record referred to by cur to the value given
166 struct xfs_btree_cur *cur,
172 trace_xfs_refcount_update(cur->bc_mp, cur->bc_ag.agno, irec);
176 error = xfs_btree_update(cur, &rec);
178 trace_xfs_refcount_update_error(cur->bc_mp,
179 cur->bc_ag.agno, error, _RET_IP_);
184 * Insert the record referred to by cur to the value given
190 struct xfs_btree_cur *cur,
196 trace_xfs_refcount_insert(cur->bc_mp, cur->bc_ag.agno, irec);
197 cur->bc_rec.rc.rc_startblock = irec->rc_startblock;
198 cur->bc_rec.rc.rc_blockcount = irec->rc_blockcount;
199 cur->bc_rec.rc.rc_refcount = irec->rc_refcount;
200 error = xfs_btree_insert(cur, i);
203 if (XFS_IS_CORRUPT(cur->bc_mp, *i != 1)) {
210 trace_xfs_refcount_insert_error(cur->bc_mp,
211 cur->bc_ag.agno, error, _RET_IP_);
216 * Remove the record referred to by cur, then set the pointer to the spot
223 struct xfs_btree_cur *cur,
230 error = xfs_refcount_get_rec(cur, &irec, &found_rec);
233 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
237 trace_xfs_refcount_delete(cur->bc_mp, cur->bc_ag.agno, &irec);
238 error = xfs_btree_delete(cur, i);
239 if (XFS_IS_CORRUPT(cur->bc_mp, *i != 1)) {
245 error = xfs_refcount_lookup_ge(cur, irec.rc_startblock, &found_rec);
248 trace_xfs_refcount_delete_error(cur->bc_mp,
249 cur->bc_ag.agno, error, _RET_IP_);
343 struct xfs_btree_cur *cur,
352 error = xfs_refcount_lookup_le(cur, agbno, &found_rec);
358 error = xfs_refcount_get_rec(cur, &rcext, &found_rec);
361 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
369 trace_xfs_refcount_split_extent(cur->bc_mp, cur->bc_ag.agno,
376 error = xfs_refcount_update(cur, &tmp);
383 error = xfs_refcount_insert(cur, &tmp, &found_rec);
386 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
393 trace_xfs_refcount_split_extent_error(cur->bc_mp,
394 cur->bc_ag.agno, error, _RET_IP_);
403 struct xfs_btree_cur *cur,
413 trace_xfs_refcount_merge_center_extents(cur->bc_mp,
414 cur->bc_ag.agno, left, center, right);
424 error = xfs_refcount_lookup_ge(cur, center->rc_startblock,
428 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
433 error = xfs_refcount_delete(cur, &found_rec);
436 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
442 error = xfs_refcount_delete(cur, &found_rec);
445 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
452 error = xfs_refcount_lookup_le(cur, left->rc_startblock,
456 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
462 error = xfs_refcount_update(cur, left);
470 trace_xfs_refcount_merge_center_extents_error(cur->bc_mp,
471 cur->bc_ag.agno, error, _RET_IP_);
480 struct xfs_btree_cur *cur,
489 trace_xfs_refcount_merge_left_extent(cur->bc_mp,
490 cur->bc_ag.agno, left, cleft);
494 error = xfs_refcount_lookup_le(cur, cleft->rc_startblock,
498 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
503 error = xfs_refcount_delete(cur, &found_rec);
506 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
513 error = xfs_refcount_lookup_le(cur, left->rc_startblock,
517 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
523 error = xfs_refcount_update(cur, left);
532 trace_xfs_refcount_merge_left_extent_error(cur->bc_mp,
533 cur->bc_ag.agno, error, _RET_IP_);
542 struct xfs_btree_cur *cur,
550 trace_xfs_refcount_merge_right_extent(cur->bc_mp,
551 cur->bc_ag.agno, cright, right);
558 error = xfs_refcount_lookup_le(cur, cright->rc_startblock,
562 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
567 error = xfs_refcount_delete(cur, &found_rec);
570 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
577 error = xfs_refcount_lookup_le(cur, right->rc_startblock,
581 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
588 error = xfs_refcount_update(cur, right);
596 trace_xfs_refcount_merge_right_extent_error(cur->bc_mp,
597 cur->bc_ag.agno, error, _RET_IP_);
609 struct xfs_btree_cur *cur,
621 error = xfs_refcount_lookup_le(cur, agbno - 1, &found_rec);
627 error = xfs_refcount_get_rec(cur, &tmp, &found_rec);
630 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
644 error = xfs_btree_increment(cur, 0, &found_rec);
648 error = xfs_refcount_get_rec(cur, &tmp, &found_rec);
651 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
682 trace_xfs_refcount_find_left_extent(cur->bc_mp, cur->bc_ag.agno,
687 trace_xfs_refcount_find_left_extent_error(cur->bc_mp,
688 cur->bc_ag.agno, error, _RET_IP_);
698 struct xfs_btree_cur *cur,
710 error = xfs_refcount_lookup_ge(cur, agbno + aglen, &found_rec);
716 error = xfs_refcount_get_rec(cur, &tmp, &found_rec);
719 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
733 error = xfs_btree_decrement(cur, 0, &found_rec);
737 error = xfs_refcount_get_rec(cur, &tmp, &found_rec);
740 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
771 trace_xfs_refcount_find_right_extent(cur->bc_mp, cur->bc_ag.agno,
776 trace_xfs_refcount_find_right_extent_error(cur->bc_mp,
777 cur->bc_ag.agno, error, _RET_IP_);
794 struct xfs_btree_cur *cur,
813 error = xfs_refcount_find_left_extents(cur, &left, &cleft, *agbno,
817 error = xfs_refcount_find_right_extents(cur, &right, &cright, *agbno,
838 return xfs_refcount_merge_center_extents(cur, &left, &cleft,
848 error = xfs_refcount_merge_left_extent(cur, &left, &cleft,
867 return xfs_refcount_merge_right_extent(cur, &right, &cright,
882 struct xfs_btree_cur *cur)
886 overhead = cur->bc_ag.refc.shape_changes *
887 xfs_allocfree_log_count(cur->bc_mp, 1);
888 overhead *= cur->bc_mp->m_sb.sb_blocksize;
894 if (cur->bc_ag.refc.nr_ops > 2 &&
895 XFS_TEST_ERROR(false, cur->bc_mp,
899 if (cur->bc_ag.refc.nr_ops == 0)
901 else if (overhead > cur->bc_tp->t_log_res)
903 return cur->bc_tp->t_log_res - overhead >
904 cur->bc_ag.refc.nr_ops * XFS_REFCOUNT_ITEM_OVERHEAD;
915 struct xfs_btree_cur *cur,
930 error = xfs_refcount_lookup_ge(cur, *agbno, &found_rec);
934 while (*aglen > 0 && xfs_refcount_still_have_space(cur)) {
935 error = xfs_refcount_get_rec(cur, &ext, &found_rec);
939 ext.rc_startblock = cur->bc_mp->m_sb.sb_agblocks;
954 trace_xfs_refcount_modify_extent(cur->bc_mp,
955 cur->bc_ag.agno, &tmp);
962 error = xfs_refcount_insert(cur, &tmp,
966 if (XFS_IS_CORRUPT(cur->bc_mp,
971 cur->bc_ag.refc.nr_ops++;
973 fsbno = XFS_AGB_TO_FSB(cur->bc_mp,
974 cur->bc_ag.agno,
976 xfs_bmap_add_free(cur->bc_tp, fsbno,
983 error = xfs_refcount_lookup_ge(cur, *agbno,
990 if (*aglen == 0 || !xfs_refcount_still_have_space(cur))
1000 trace_xfs_refcount_modify_extent(cur->bc_mp,
1001 cur->bc_ag.agno, &ext);
1003 error = xfs_refcount_update(cur, &ext);
1006 cur->bc_ag.refc.nr_ops++;
1008 error = xfs_refcount_delete(cur, &found_rec);
1011 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
1015 cur->bc_ag.refc.nr_ops++;
1018 fsbno = XFS_AGB_TO_FSB(cur->bc_mp,
1019 cur->bc_ag.agno,
1021 xfs_bmap_add_free(cur->bc_tp, fsbno, ext.rc_blockcount,
1026 error = xfs_btree_increment(cur, 0, &found_rec);
1037 trace_xfs_refcount_modify_extent_error(cur->bc_mp,
1038 cur->bc_ag.agno, error, _RET_IP_);
1045 struct xfs_btree_cur *cur,
1060 trace_xfs_refcount_increase(cur->bc_mp, cur->bc_ag.agno,
1063 trace_xfs_refcount_decrease(cur->bc_mp, cur->bc_ag.agno,
1069 error = xfs_refcount_split_extent(cur, agbno, &shape_changed);
1075 error = xfs_refcount_split_extent(cur, agbno + aglen, &shape_changed);
1084 error = xfs_refcount_merge_extents(cur, new_agbno, new_aglen, adj,
1091 cur->bc_ag.refc.shape_changes++;
1094 error = xfs_refcount_adjust_extents(cur, new_agbno, new_aglen,
1102 trace_xfs_refcount_adjust_error(cur->bc_mp, cur->bc_ag.agno,
1294 struct xfs_btree_cur *cur,
1306 trace_xfs_refcount_find_shared(cur->bc_mp, cur->bc_ag.agno,
1314 error = xfs_refcount_lookup_le(cur, agbno, &have);
1319 error = xfs_btree_increment(cur, 0, &have);
1325 error = xfs_refcount_get_rec(cur, &tmp, &i);
1328 if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
1335 error = xfs_btree_increment(cur, 0, &have);
1340 error = xfs_refcount_get_rec(cur, &tmp, &i);
1343 if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
1366 error = xfs_btree_increment(cur, 0, &have);
1371 error = xfs_refcount_get_rec(cur, &tmp, &i);
1374 if (XFS_IS_CORRUPT(cur->bc_mp, i != 1)) {
1385 trace_xfs_refcount_find_shared_result(cur->bc_mp,
1386 cur->bc_ag.agno, *fbno, *flen);
1390 trace_xfs_refcount_find_shared_error(cur->bc_mp,
1391 cur->bc_ag.agno, error, _RET_IP_);
1449 struct xfs_btree_cur *cur,
1462 error = xfs_refcount_lookup_ge(cur, agbno, &found_rec);
1465 error = xfs_refcount_get_rec(cur, &ext, &found_rec);
1469 ext.rc_startblock = cur->bc_mp->m_sb.sb_agblocks +
1478 if (XFS_IS_CORRUPT(cur->bc_mp,
1487 trace_xfs_refcount_modify_extent(cur->bc_mp,
1488 cur->bc_ag.agno, &tmp);
1490 error = xfs_refcount_insert(cur, &tmp,
1494 if (XFS_IS_CORRUPT(cur->bc_mp, found_tmp != 1)) {
1501 if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_startblock != agbno)) {
1505 if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_blockcount != aglen)) {
1509 if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_refcount != 1)) {
1515 trace_xfs_refcount_modify_extent(cur->bc_mp,
1516 cur->bc_ag.agno, &ext);
1517 error = xfs_refcount_delete(cur, &found_rec);
1520 if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
1531 trace_xfs_refcount_modify_extent_error(cur->bc_mp,
1532 cur->bc_ag.agno, error, _RET_IP_);
1541 struct xfs_btree_cur *cur,
1554 error = xfs_refcount_split_extent(cur, agbno, &shape_changed);
1558 error = xfs_refcount_split_extent(cur, agbno + aglen, &shape_changed);
1565 error = xfs_refcount_merge_extents(cur, &agbno, &aglen, adj,
1571 error = xfs_refcount_adjust_cow_extents(cur, agbno, aglen, adj);
1578 trace_xfs_refcount_adjust_cow_error(cur->bc_mp, cur->bc_ag.agno,
1662 struct xfs_btree_cur *cur,
1669 if (XFS_IS_CORRUPT(cur->bc_mp,
1687 struct xfs_btree_cur *cur;
1719 cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);
1726 error = xfs_btree_query_range(cur, &low, &high,
1728 xfs_btree_del_cursor(cur, error);
1775 struct xfs_btree_cur *cur,
1788 return xfs_btree_has_record(cur, &low, &high, exists);