Lines Matching refs:state
57 STATIC int xfs_da3_root_split(xfs_da_state_t *state,
60 STATIC int xfs_da3_node_split(xfs_da_state_t *state,
66 STATIC void xfs_da3_node_rebalance(xfs_da_state_t *state,
69 STATIC void xfs_da3_node_add(xfs_da_state_t *state,
76 STATIC int xfs_da3_root_join(xfs_da_state_t *state,
78 STATIC int xfs_da3_node_toosmall(xfs_da_state_t *state, int *retval);
79 STATIC void xfs_da3_node_remove(xfs_da_state_t *state,
81 STATIC void xfs_da3_node_unbalance(xfs_da_state_t *state,
88 STATIC int xfs_da3_blk_unlink(xfs_da_state_t *state,
109 xfs_da_state_kill_altpath(xfs_da_state_t *state) in xfs_da_state_kill_altpath() argument
113 for (i = 0; i < state->altpath.active; i++) in xfs_da_state_kill_altpath()
114 state->altpath.blk[i].bp = NULL; in xfs_da_state_kill_altpath()
115 state->altpath.active = 0; in xfs_da_state_kill_altpath()
122 xfs_da_state_free(xfs_da_state_t *state) in xfs_da_state_free() argument
124 xfs_da_state_kill_altpath(state); in xfs_da_state_free()
126 memset((char *)state, 0, sizeof(*state)); in xfs_da_state_free()
128 kmem_zone_free(xfs_da_state_zone, state); in xfs_da_state_free()
353 struct xfs_da_state *state) in xfs_da3_split() argument
365 trace_xfs_da_split(state->args); in xfs_da3_split()
373 max = state->path.active - 1; in xfs_da3_split()
375 ASSERT(state->path.blk[max].magic == XFS_ATTR_LEAF_MAGIC || in xfs_da3_split()
376 state->path.blk[max].magic == XFS_DIR2_LEAFN_MAGIC); in xfs_da3_split()
378 addblk = &state->path.blk[max]; /* initial dummy value */ in xfs_da3_split()
379 for (i = max; (i >= 0) && addblk; state->path.active--, i--) { in xfs_da3_split()
380 oldblk = &state->path.blk[i]; in xfs_da3_split()
381 newblk = &state->altpath.blk[i]; in xfs_da3_split()
391 error = xfs_attr3_leaf_split(state, oldblk, newblk); in xfs_da3_split()
402 state->extravalid = 1; in xfs_da3_split()
403 if (state->inleaf) { in xfs_da3_split()
404 state->extraafter = 0; /* before newblk */ in xfs_da3_split()
405 trace_xfs_attr_leaf_split_before(state->args); in xfs_da3_split()
406 error = xfs_attr3_leaf_split(state, oldblk, in xfs_da3_split()
407 &state->extrablk); in xfs_da3_split()
409 state->extraafter = 1; /* after newblk */ in xfs_da3_split()
410 trace_xfs_attr_leaf_split_after(state->args); in xfs_da3_split()
411 error = xfs_attr3_leaf_split(state, newblk, in xfs_da3_split()
412 &state->extrablk); in xfs_da3_split()
419 error = xfs_dir2_leafn_split(state, oldblk, newblk); in xfs_da3_split()
425 error = xfs_da3_node_split(state, oldblk, newblk, addblk, in xfs_da3_split()
443 xfs_da3_fixhashpath(state, &state->path); in xfs_da3_split()
451 ASSERT(state->path.active == 0); in xfs_da3_split()
452 oldblk = &state->path.blk[0]; in xfs_da3_split()
453 error = xfs_da3_root_split(state, oldblk, addblk); in xfs_da3_split()
475 ASSERT(state->extravalid); in xfs_da3_split()
476 bp = state->extrablk.bp; in xfs_da3_split()
480 xfs_trans_log_buf(state->args->trans, bp, in xfs_da3_split()
489 ASSERT(state->extravalid); in xfs_da3_split()
490 bp = state->extrablk.bp; in xfs_da3_split()
494 xfs_trans_log_buf(state->args->trans, bp, in xfs_da3_split()
509 struct xfs_da_state *state, in xfs_da3_root_split() argument
527 trace_xfs_da_root_split(state->args); in xfs_da3_root_split()
533 args = state->args; in xfs_da3_root_split()
640 struct xfs_da_state *state, in xfs_da3_node_split() argument
653 struct xfs_inode *dp = state->args->dp; in xfs_da3_node_split()
655 trace_xfs_da_node_split(state->args); in xfs_da3_node_split()
663 useextra = state->extravalid && state->args->whichfork == XFS_ATTR_FORK; in xfs_da3_node_split()
668 if (nodehdr.count + newcount > state->args->geo->node_ents) { in xfs_da3_node_split()
673 error = xfs_da_grow_inode(state->args, &blkno); in xfs_da3_node_split()
677 error = xfs_da3_node_create(state->args, blkno, treelevel, in xfs_da3_node_split()
678 &newblk->bp, state->args->whichfork); in xfs_da3_node_split()
683 xfs_da3_node_rebalance(state, oldblk, newblk); in xfs_da3_node_split()
684 error = xfs_da3_blk_link(state, oldblk, newblk); in xfs_da3_node_split()
708 xfs_da3_node_add(state, oldblk, addblk); in xfs_da3_node_split()
710 if (state->extraafter) in xfs_da3_node_split()
712 xfs_da3_node_add(state, oldblk, &state->extrablk); in xfs_da3_node_split()
713 state->extravalid = 0; in xfs_da3_node_split()
717 xfs_da3_node_add(state, newblk, addblk); in xfs_da3_node_split()
719 if (state->extraafter) in xfs_da3_node_split()
721 xfs_da3_node_add(state, newblk, &state->extrablk); in xfs_da3_node_split()
722 state->extravalid = 0; in xfs_da3_node_split()
737 struct xfs_da_state *state, in xfs_da3_node_rebalance() argument
754 struct xfs_inode *dp = state->args->dp; in xfs_da3_node_rebalance()
756 trace_xfs_da_node_rebalance(state->args); in xfs_da3_node_rebalance()
786 tp = state->args->trans; in xfs_da3_node_rebalance()
880 struct xfs_da_state *state, in xfs_da3_node_add() argument
888 struct xfs_inode *dp = state->args->dp; in xfs_da3_node_add()
890 trace_xfs_da_node_add(state->args); in xfs_da3_node_add()
898 if (state->args->whichfork == XFS_DATA_FORK) in xfs_da3_node_add()
899 ASSERT(newblk->blkno >= state->args->geo->leafblk && in xfs_da3_node_add()
900 newblk->blkno < state->args->geo->freeblk); in xfs_da3_node_add()
912 xfs_trans_log_buf(state->args->trans, oldblk->bp, in xfs_da3_node_add()
918 xfs_trans_log_buf(state->args->trans, oldblk->bp, in xfs_da3_node_add()
937 struct xfs_da_state *state) in xfs_da3_join() argument
944 trace_xfs_da_join(state->args); in xfs_da3_join()
946 drop_blk = &state->path.blk[ state->path.active-1 ]; in xfs_da3_join()
947 save_blk = &state->altpath.blk[ state->path.active-1 ]; in xfs_da3_join()
948 ASSERT(state->path.blk[0].magic == XFS_DA_NODE_MAGIC); in xfs_da3_join()
956 for ( ; state->path.active >= 2; drop_blk--, save_blk--, in xfs_da3_join()
957 state->path.active--) { in xfs_da3_join()
966 error = xfs_attr3_leaf_toosmall(state, &action); in xfs_da3_join()
971 xfs_attr3_leaf_unbalance(state, drop_blk, save_blk); in xfs_da3_join()
974 error = xfs_dir2_leafn_toosmall(state, &action); in xfs_da3_join()
979 xfs_dir2_leafn_unbalance(state, drop_blk, save_blk); in xfs_da3_join()
986 xfs_da3_node_remove(state, drop_blk); in xfs_da3_join()
987 xfs_da3_fixhashpath(state, &state->path); in xfs_da3_join()
988 error = xfs_da3_node_toosmall(state, &action); in xfs_da3_join()
993 xfs_da3_node_unbalance(state, drop_blk, save_blk); in xfs_da3_join()
996 xfs_da3_fixhashpath(state, &state->altpath); in xfs_da3_join()
997 error = xfs_da3_blk_unlink(state, drop_blk, save_blk); in xfs_da3_join()
998 xfs_da_state_kill_altpath(state); in xfs_da3_join()
1001 error = xfs_da_shrink_inode(state->args, drop_blk->blkno, in xfs_da3_join()
1012 xfs_da3_node_remove(state, drop_blk); in xfs_da3_join()
1013 xfs_da3_fixhashpath(state, &state->path); in xfs_da3_join()
1014 error = xfs_da3_root_join(state, &state->path.blk[0]); in xfs_da3_join()
1046 struct xfs_da_state *state, in xfs_da3_root_join() argument
1056 struct xfs_inode *dp = state->args->dp; in xfs_da3_root_join()
1058 trace_xfs_da_root_join(state->args); in xfs_da3_root_join()
1062 args = state->args; in xfs_da3_root_join()
1118 struct xfs_da_state *state, in xfs_da3_node_toosmall() argument
1132 struct xfs_inode *dp = state->args->dp; in xfs_da3_node_toosmall()
1134 trace_xfs_da_node_toosmall(state->args); in xfs_da3_node_toosmall()
1141 blk = &state->path.blk[ state->path.active-1 ]; in xfs_da3_node_toosmall()
1145 if (nodehdr.count > (state->args->geo->node_ents >> 1)) { in xfs_da3_node_toosmall()
1162 memcpy(&state->altpath, &state->path, sizeof(state->path)); in xfs_da3_node_toosmall()
1163 error = xfs_da3_path_shift(state, &state->altpath, forward, in xfs_da3_node_toosmall()
1182 count = state->args->geo->node_ents; in xfs_da3_node_toosmall()
1183 count -= state->args->geo->node_ents >> 2; in xfs_da3_node_toosmall()
1196 error = xfs_da3_node_read(state->args->trans, dp, in xfs_da3_node_toosmall()
1197 blkno, -1, &bp, state->args->whichfork); in xfs_da3_node_toosmall()
1203 xfs_trans_brelse(state->args->trans, bp); in xfs_da3_node_toosmall()
1217 memcpy(&state->altpath, &state->path, sizeof(state->path)); in xfs_da3_node_toosmall()
1219 error = xfs_da3_path_shift(state, &state->altpath, forward, in xfs_da3_node_toosmall()
1222 error = xfs_da3_path_shift(state, &state->path, forward, in xfs_da3_node_toosmall()
1264 struct xfs_da_state *state, in xfs_da3_fixhashpath() argument
1273 struct xfs_inode *dp = state->args->dp; in xfs_da3_fixhashpath()
1275 trace_xfs_da_fixhashpath(state->args); in xfs_da3_fixhashpath()
1306 xfs_trans_log_buf(state->args->trans, blk->bp, in xfs_da3_fixhashpath()
1319 struct xfs_da_state *state, in xfs_da3_node_remove() argument
1327 struct xfs_inode *dp = state->args->dp; in xfs_da3_node_remove()
1329 trace_xfs_da_node_remove(state->args); in xfs_da3_node_remove()
1345 xfs_trans_log_buf(state->args->trans, drop_blk->bp, in xfs_da3_node_remove()
1350 xfs_trans_log_buf(state->args->trans, drop_blk->bp, in xfs_da3_node_remove()
1354 xfs_trans_log_buf(state->args->trans, drop_blk->bp, in xfs_da3_node_remove()
1369 struct xfs_da_state *state, in xfs_da3_node_unbalance() argument
1382 struct xfs_inode *dp = state->args->dp; in xfs_da3_node_unbalance()
1384 trace_xfs_da_node_unbalance(state->args); in xfs_da3_node_unbalance()
1392 tp = state->args->trans; in xfs_da3_node_unbalance()
1453 struct xfs_da_state *state, in xfs_da3_node_lookup_int() argument
1470 struct xfs_inode *dp = state->args->dp; in xfs_da3_node_lookup_int()
1472 args = state->args; in xfs_da3_node_lookup_int()
1479 for (blk = &state->path.blk[0], state->path.active = 1; in xfs_da3_node_lookup_int()
1480 state->path.active <= XFS_DA_NODE_MAXDEPTH; in xfs_da3_node_lookup_int()
1481 blk++, state->path.active++) { in xfs_da3_node_lookup_int()
1490 state->path.active--; in xfs_da3_node_lookup_int()
1577 &blk->index, state); in xfs_da3_node_lookup_int()
1588 error = xfs_da3_path_shift(state, &state->path, 1, 1, in xfs_da3_node_lookup_int()
1646 struct xfs_da_state *state, in xfs_da3_blk_link() argument
1657 struct xfs_inode *dp = state->args->dp; in xfs_da3_blk_link()
1662 args = state->args; in xfs_da3_blk_link()
1739 struct xfs_da_state *state, in xfs_da3_blk_unlink() argument
1753 args = state->args; in xfs_da3_blk_unlink()
1819 struct xfs_da_state *state, in xfs_da3_path_shift() argument
1835 struct xfs_inode *dp = state->args->dp; in xfs_da3_path_shift()
1837 trace_xfs_da_path_shift(state->args); in xfs_da3_path_shift()
1844 args = state->args; in xfs_da3_path_shift()