Lines Matching refs:state

29 static void xfs_dir2_leafn_rebalance(xfs_da_state_t *state,
622 * The extrablk in state is a freespace block.
629 xfs_da_state_t *state) /* state to fill in */
664 if (state->extravalid) {
666 curbp = state->extrablk.bp;
667 curfdb = state->extrablk.blkno;
752 state->extravalid = 1;
753 state->extrablk.bp = curbp;
754 state->extrablk.index = fi;
755 state->extrablk.blkno = curfdb;
762 state->extrablk.magic = XFS_DIR2_FREE_MAGIC;
764 state->extravalid = 0;
775 * The extrablk in state a data block.
782 xfs_da_state_t *state) /* state to fill in */
817 if (state->extravalid) {
818 curbp = state->extrablk.bp;
819 curdb = state->extrablk.blkno;
849 curdb != state->extrablk.blkno))
856 newdb == state->extrablk.blkno) {
857 ASSERT(state->extravalid);
858 curbp = state->extrablk.bp;
885 curdb != state->extrablk.blkno)
886 xfs_trans_brelse(tp, state->extrablk.bp);
891 state->extravalid = 1;
892 state->extrablk.bp = curbp;
893 state->extrablk.blkno = curdb;
894 state->extrablk.index = (int)((char *)dep -
896 state->extrablk.magic = XFS_DIR2_DATA_MAGIC;
907 state->extravalid = 1;
908 state->extrablk.bp = curbp;
909 state->extrablk.index = -1;
910 state->extrablk.blkno = curdb;
911 state->extrablk.magic = XFS_DIR2_DATA_MAGIC;
916 if (state->extrablk.bp != curbp)
920 state->extravalid = 0;
928 * If this is an addname then the extrablk in state is a freespace block,
936 xfs_da_state_t *state) /* state to fill in */
940 state);
941 return xfs_dir2_leafn_lookup_for_entry(bp, args, indexp, state);
1062 xfs_da_state_t *state, /* btree cursor */
1081 struct xfs_inode *dp = state->args->dp;
1083 args = state->args;
1154 state->inleaf = swap_blocks;
1156 state->inleaf = !swap_blocks;
1158 state->inleaf = swap_blocks ^ (blk1->index <= hdr1.count);
1162 if (!state->inleaf)
1170 state->inleaf = 1;
1419 xfs_da_state_t *state, /* btree cursor */
1431 args = state->args;
1452 xfs_dir2_leafn_rebalance(state, oldblk, newblk);
1453 error = xfs_da3_blk_link(state, oldblk, newblk);
1460 if (state->inleaf)
1479 * If the block is empty, fill in the state structure and return 2.
1480 * If it can be collapsed, fill in the state structure and return 1.
1485 xfs_da_state_t *state, /* btree cursor */
1500 struct xfs_inode *dp = state->args->dp;
1507 blk = &state->path.blk[state->path.active - 1];
1514 bytes = state->args->geo->leaf_hdr_size + count * sizeof(ents[0]);
1515 if (bytes > (state->args->geo->blksize >> 1)) {
1534 memcpy(&state->altpath, &state->path, sizeof(state->path));
1535 error = xfs_da3_path_shift(state, &state->altpath, forward, 0,
1559 error = xfs_dir3_leafn_read(state->args->trans, dp, blkno, &bp);
1567 bytes = state->args->geo->blksize -
1568 (state->args->geo->blksize >> 2);
1581 xfs_trans_brelse(state->args->trans, bp);
1595 memcpy(&state->altpath, &state->path, sizeof(state->path));
1597 error = xfs_da3_path_shift(state, &state->altpath, forward, 0,
1600 error = xfs_da3_path_shift(state, &state->path, forward, 0,
1615 xfs_da_state_t *state, /* cursor */
1626 struct xfs_inode *dp = state->args->dp;
1628 args = state->args;
2011 xfs_da_state_t *state; /* btree cursor */
2016 * Allocate and initialize the state (btree cursor).
2018 state = xfs_da_state_alloc(args);
2023 error = xfs_da3_node_lookup_int(state, &rval);
2034 state->extravalid ? &state->extrablk : NULL);
2038 blk = &state->path.blk[state->path.active - 1];
2049 xfs_da3_fixhashpath(state, &state->path);
2061 rval = xfs_da3_split(state);
2064 xfs_da_state_free(state);
2080 xfs_da_state_t *state; /* btree cursor */
2087 state = xfs_da_state_alloc(args);
2092 error = xfs_da3_node_lookup_int(state, &rval);
2100 ((char *)state->extrablk.bp->b_addr +
2101 state->extrablk.index);
2107 for (i = 0; i < state->path.active; i++) {
2108 xfs_trans_brelse(args->trans, state->path.blk[i].bp);
2109 state->path.blk[i].bp = NULL;
2114 if (state->extravalid && state->extrablk.bp) {
2115 xfs_trans_brelse(args->trans, state->extrablk.bp);
2116 state->extrablk.bp = NULL;
2118 xfs_da_state_free(state);
2132 struct xfs_da_state *state; /* btree cursor */
2139 state = xfs_da_state_alloc(args);
2142 error = xfs_da3_node_lookup_int(state, &rval);
2152 blk = &state->path.blk[state->path.active - 1];
2154 ASSERT(state->extravalid);
2160 &state->extrablk, &rval);
2166 xfs_da3_fixhashpath(state, &state->path);
2170 if (rval && state->path.active > 1)
2171 error = xfs_da3_join(state);
2176 error = xfs_dir2_node_to_leaf(state);
2178 xfs_da_state_free(state);
2197 xfs_da_state_t *state; /* btree cursor */
2204 state = xfs_da_state_alloc(args);
2216 error = xfs_da3_node_lookup_int(state, &rval);
2230 blk = &state->path.blk[state->path.active - 1];
2232 ASSERT(state->extravalid);
2234 xfs_dir2_leaf_hdr_from_disk(state->mp, &leafhdr,
2239 hdr = state->extrablk.bp->b_addr;
2251 xfs_dir2_data_put_ftype(state->mp, dep, ftype);
2252 xfs_dir2_data_log_entry(args, state->extrablk.bp, dep);
2258 else if (state->extravalid) {
2259 xfs_trans_brelse(args->trans, state->extrablk.bp);
2260 state->extrablk.bp = NULL;
2265 for (i = 0; i < state->path.active; i++) {
2266 xfs_trans_brelse(args->trans, state->path.blk[i].bp);
2267 state->path.blk[i].bp = NULL;
2269 xfs_da_state_free(state);