Lines Matching full:leaf
104 struct xfs_dir2_leaf *leaf = bp->b_addr; in xfs_dir3_leaf1_check() local
107 xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf); in xfs_dir3_leaf1_check()
116 return xfs_dir3_leaf_check_int(dp->i_mount, &leafhdr, leaf, false); in xfs_dir3_leaf1_check()
142 struct xfs_dir2_leaf *leaf, in xfs_dir3_leaf_check_int() argument
152 ltp = xfs_dir2_leaf_tail_p(geo, leaf); in xfs_dir3_leaf_check_int()
162 /* Leaves and bests don't overlap in leaf format. */ in xfs_dir3_leaf_check_int()
190 * We verify the magic numbers before decoding the leaf header so that on debug
302 * Initialize a new leaf block, leaf1 or leafn magic accepted.
312 struct xfs_dir2_leaf *leaf = bp->b_addr; in xfs_dir3_leaf_init() local
328 memset(leaf, 0, sizeof(*leaf)); in xfs_dir3_leaf_init()
329 leaf->hdr.info.magic = cpu_to_be16(type); in xfs_dir3_leaf_init()
333 * If it's a leaf-format directory initialize the tail. in xfs_dir3_leaf_init()
339 ltp = xfs_dir2_leaf_tail_p(mp->m_dir_geo, leaf); in xfs_dir3_leaf_init()
380 * Convert a block form directory to a leaf form directory.
387 __be16 *bestsp; /* leaf's bestsp entries */ in xfs_dir2_block_to_leaf()
388 xfs_dablk_t blkno; /* leaf block's bno */ in xfs_dir2_block_to_leaf()
390 xfs_dir2_leaf_entry_t *blp; /* block's leaf entries */ in xfs_dir2_block_to_leaf()
394 struct xfs_buf *lbp; /* leaf block's buffer */ in xfs_dir2_block_to_leaf()
395 xfs_dir2_db_t ldb; /* leaf block's bno */ in xfs_dir2_block_to_leaf()
396 xfs_dir2_leaf_t *leaf; /* leaf structure */ in xfs_dir2_block_to_leaf() local
397 xfs_dir2_leaf_tail_t *ltp; /* leaf's tail */ in xfs_dir2_block_to_leaf()
409 * Add the leaf block to the inode. in xfs_dir2_block_to_leaf()
410 * This interface will only put blocks in the leaf/node range. in xfs_dir2_block_to_leaf()
419 * Initialize the leaf block, get a buffer for it. in xfs_dir2_block_to_leaf()
425 leaf = lbp->b_addr; in xfs_dir2_block_to_leaf()
433 * Set the counts in the leaf header. in xfs_dir2_block_to_leaf()
435 xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf); in xfs_dir2_block_to_leaf()
438 xfs_dir2_leaf_hdr_to_disk(dp->i_mount, leaf, &leafhdr); in xfs_dir2_block_to_leaf()
451 * Make the space formerly occupied by the leaf entries and block in xfs_dir2_block_to_leaf()
472 * Set up leaf tail and bests table. in xfs_dir2_block_to_leaf()
474 ltp = xfs_dir2_leaf_tail_p(args->geo, leaf); in xfs_dir2_block_to_leaf()
479 * Log the data header and leaf bests table. in xfs_dir2_block_to_leaf()
524 int index, /* leaf table position */ in xfs_dir3_leaf_find_entry()
526 int lowstale, /* index of prev stale leaf */ in xfs_dir3_leaf_find_entry()
527 int highstale, /* index of next stale leaf */ in xfs_dir3_leaf_find_entry()
528 int *lfloglow, /* low leaf logging index */ in xfs_dir3_leaf_find_entry()
529 int *lfloghigh) /* high leaf logging index */ in xfs_dir3_leaf_find_entry()
532 xfs_dir2_leaf_entry_t *lep; /* leaf entry table pointer */ in xfs_dir3_leaf_find_entry()
535 * Now we need to make room to insert the leaf entry. in xfs_dir3_leaf_find_entry()
545 * Record low and high logging indices for the leaf. in xfs_dir3_leaf_find_entry()
611 * Add an entry to a leaf form directory.
619 __be16 *bestsp; /* freespace table in leaf */ in xfs_dir2_leaf_addname()
622 struct xfs_buf *lbp; /* leaf's buffer */ in xfs_dir2_leaf_addname()
623 struct xfs_dir2_leaf *leaf; /* leaf structure */ in xfs_dir2_leaf_addname() local
627 struct xfs_dir2_leaf_entry *lep; /* leaf entry table pointer */ in xfs_dir2_leaf_addname()
630 struct xfs_dir2_leaf_tail *ltp; /* leaf tail pointer */ in xfs_dir2_leaf_addname()
635 int highstale = 0; /* index of next stale leaf */ in xfs_dir2_leaf_addname()
637 int index; /* leaf table position */ in xfs_dir2_leaf_addname()
639 int lfloglow; /* low leaf logging index */ in xfs_dir2_leaf_addname()
640 int lfloghigh; /* high leaf logging index */ in xfs_dir2_leaf_addname()
641 int lowstale = 0; /* index of prev stale leaf */ in xfs_dir2_leaf_addname()
642 int needbytes; /* leaf block bytes needed */ in xfs_dir2_leaf_addname()
660 leaf = lbp->b_addr; in xfs_dir2_leaf_addname()
661 ltp = xfs_dir2_leaf_tail_p(args->geo, leaf); in xfs_dir2_leaf_addname()
662 xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf); in xfs_dir2_leaf_addname()
704 * How many bytes do we need in the leaf block? in xfs_dir2_leaf_addname()
772 * Need to compact the leaf entries, removing stale ones. in xfs_dir2_leaf_addname()
898 * Fill in the new leaf entry. in xfs_dir2_leaf_addname()
905 * Log the leaf fields and give up the buffers. in xfs_dir2_leaf_addname()
907 xfs_dir2_leaf_hdr_to_disk(dp->i_mount, leaf, &leafhdr); in xfs_dir2_leaf_addname()
916 * Compact out any stale entries in the leaf.
917 * Log the header and changed leaf entries, if any.
923 struct xfs_buf *bp) /* leaf buffer */ in xfs_dir3_leaf_compact()
925 int from; /* source leaf index */ in xfs_dir3_leaf_compact()
926 xfs_dir2_leaf_t *leaf; /* leaf structure */ in xfs_dir3_leaf_compact() local
927 int loglow; /* first leaf entry to log */ in xfs_dir3_leaf_compact()
928 int to; /* target leaf index */ in xfs_dir3_leaf_compact()
931 leaf = bp->b_addr; in xfs_dir3_leaf_compact()
953 * Update and log the header, log the leaf entries. in xfs_dir3_leaf_compact()
959 xfs_dir2_leaf_hdr_to_disk(dp->i_mount, leaf, leafhdr); in xfs_dir3_leaf_compact()
966 * Compact the leaf entries, removing stale ones.
971 * and leaf logging indices.
1042 * Adjust the leaf header values. in xfs_dir3_leaf_compact_x1()
1065 struct xfs_buf *bp, /* leaf buffer */ in xfs_dir3_leaf_log_bests()
1071 struct xfs_dir2_leaf *leaf = bp->b_addr; in xfs_dir3_leaf_log_bests() local
1072 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ in xfs_dir3_leaf_log_bests()
1074 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || in xfs_dir3_leaf_log_bests()
1075 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC)); in xfs_dir3_leaf_log_bests()
1077 ltp = xfs_dir2_leaf_tail_p(args->geo, leaf); in xfs_dir3_leaf_log_bests()
1081 (uint)((char *)firstb - (char *)leaf), in xfs_dir3_leaf_log_bests()
1082 (uint)((char *)lastb - (char *)leaf + sizeof(*lastb) - 1)); in xfs_dir3_leaf_log_bests()
1086 * Log the leaf entries indicated from a leaf1 or leafn block.
1098 struct xfs_dir2_leaf *leaf = bp->b_addr; in xfs_dir3_leaf_log_ents() local
1100 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || in xfs_dir3_leaf_log_ents()
1101 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC) || in xfs_dir3_leaf_log_ents()
1102 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || in xfs_dir3_leaf_log_ents()
1103 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); in xfs_dir3_leaf_log_ents()
1108 (uint)((char *)firstlep - (char *)leaf), in xfs_dir3_leaf_log_ents()
1109 (uint)((char *)lastlep - (char *)leaf + sizeof(*lastlep) - 1)); in xfs_dir3_leaf_log_ents()
1120 struct xfs_dir2_leaf *leaf = bp->b_addr; in xfs_dir3_leaf_log_header() local
1122 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || in xfs_dir3_leaf_log_header()
1123 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC) || in xfs_dir3_leaf_log_header()
1124 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || in xfs_dir3_leaf_log_header()
1125 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); in xfs_dir3_leaf_log_header()
1128 (uint)((char *)&leaf->hdr - (char *)leaf), in xfs_dir3_leaf_log_header()
1140 struct xfs_dir2_leaf *leaf = bp->b_addr; in xfs_dir3_leaf_log_tail() local
1141 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ in xfs_dir3_leaf_log_tail()
1143 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || in xfs_dir3_leaf_log_tail()
1144 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC) || in xfs_dir3_leaf_log_tail()
1145 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || in xfs_dir3_leaf_log_tail()
1146 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); in xfs_dir3_leaf_log_tail()
1148 ltp = xfs_dir2_leaf_tail_p(args->geo, leaf); in xfs_dir3_leaf_log_tail()
1149 xfs_trans_log_buf(args->trans, bp, (uint)((char *)ltp - (char *)leaf), in xfs_dir3_leaf_log_tail()
1154 * Look up the entry referred to by args in the leaf format directory.
1167 struct xfs_buf *lbp; /* leaf buffer */ in xfs_dir2_leaf_lookup()
1168 xfs_dir2_leaf_entry_t *lep; /* leaf entry */ in xfs_dir2_leaf_lookup()
1175 * Look up name in the leaf block, returning both buffers and index. in xfs_dir2_leaf_lookup()
1186 * Get to the leaf entry and contained data entry address. in xfs_dir2_leaf_lookup()
1208 * Look up name/hash in the leaf block.
1211 * lbpp will always be filled in with the leaf buffer unless there's an error.
1216 struct xfs_buf **lbpp, /* out: leaf buffer */ in xfs_dir2_leaf_lookup_int()
1217 int *indexp, /* out: index in leaf block */ in xfs_dir2_leaf_lookup_int()
1226 int index; /* index in leaf block */ in xfs_dir2_leaf_lookup_int()
1227 struct xfs_buf *lbp; /* leaf buffer */ in xfs_dir2_leaf_lookup_int()
1228 xfs_dir2_leaf_entry_t *lep; /* leaf entry */ in xfs_dir2_leaf_lookup_int()
1229 xfs_dir2_leaf_t *leaf; /* leaf structure */ in xfs_dir2_leaf_lookup_int() local
1245 leaf = lbp->b_addr; in xfs_dir2_leaf_lookup_int()
1247 xfs_dir2_leaf_hdr_from_disk(mp, leafhdr, leaf); in xfs_dir2_leaf_lookup_int()
1250 * Look for the first leaf entry with our hash value. in xfs_dir2_leaf_lookup_int()
1262 * Skip over stale leaf entries. in xfs_dir2_leaf_lookup_int()
1342 * Remove an entry from a leaf format directory.
1349 __be16 *bestsp; /* leaf block best freespace */ in xfs_dir2_leaf_removename()
1357 int index; /* index into leaf entries */ in xfs_dir2_leaf_removename()
1358 struct xfs_buf *lbp; /* leaf buffer */ in xfs_dir2_leaf_removename()
1359 xfs_dir2_leaf_t *leaf; /* leaf structure */ in xfs_dir2_leaf_removename() local
1360 xfs_dir2_leaf_entry_t *lep; /* leaf entry */ in xfs_dir2_leaf_removename()
1361 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ in xfs_dir2_leaf_removename()
1371 * Lookup the leaf entry, get the leaf and data blocks read in. in xfs_dir2_leaf_removename()
1378 leaf = lbp->b_addr; in xfs_dir2_leaf_removename()
1384 * Point to the leaf entry, use that to point to the data entry. in xfs_dir2_leaf_removename()
1392 ltp = xfs_dir2_leaf_tail_p(geo, leaf); in xfs_dir2_leaf_removename()
1406 * We just mark the leaf entry stale by putting a null in it. in xfs_dir2_leaf_removename()
1409 xfs_dir2_leaf_hdr_to_disk(dp->i_mount, leaf, &leafhdr); in xfs_dir2_leaf_removename()
1490 * Replace the inode number in a leaf format directory entry.
1500 int index; /* index of leaf entry */ in xfs_dir2_leaf_replace()
1501 struct xfs_buf *lbp; /* leaf buffer */ in xfs_dir2_leaf_replace()
1502 xfs_dir2_leaf_entry_t *lep; /* leaf entry */ in xfs_dir2_leaf_replace()
1517 * Point to the leaf entry, get data address from it. in xfs_dir2_leaf_replace()
1540 * Return index in the leaf block (lbp) which is either the first
1547 struct xfs_buf *lbp) /* leaf buffer */ in xfs_dir2_leaf_search_hash()
1551 int high; /* high leaf index */ in xfs_dir2_leaf_search_hash()
1552 int low; /* low leaf index */ in xfs_dir2_leaf_search_hash()
1553 xfs_dir2_leaf_entry_t *lep; /* leaf entry */ in xfs_dir2_leaf_search_hash()
1554 int mid=0; /* current leaf index */ in xfs_dir2_leaf_search_hash()
1561 * Binary search the leaf entries looking for our hash value. in xfs_dir2_leaf_search_hash()
1591 * Trim off a trailing data block. We know it's empty since the leaf
1597 struct xfs_buf *lbp, /* leaf buffer */ in xfs_dir2_leaf_trim_data()
1601 __be16 *bestsp; /* leaf bests table */ in xfs_dir2_leaf_trim_data()
1605 xfs_dir2_leaf_t *leaf; /* leaf structure */ in xfs_dir2_leaf_trim_data() local
1606 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ in xfs_dir2_leaf_trim_data()
1618 leaf = lbp->b_addr; in xfs_dir2_leaf_trim_data()
1619 ltp = xfs_dir2_leaf_tail_p(geo, leaf); in xfs_dir2_leaf_trim_data()
1675 * Convert node form directory to leaf form directory.
1688 struct xfs_buf *lbp; /* buffer for leaf block */ in xfs_dir2_node_to_leaf()
1689 xfs_dir2_leaf_tail_t *ltp; /* tail of leaf structure */ in xfs_dir2_node_to_leaf()
1690 xfs_dir2_leaf_t *leaf; /* leaf structure */ in xfs_dir2_node_to_leaf() local
1698 * There's more than a leaf level in the btree, so there must in xfs_dir2_node_to_leaf()
1739 * If it's not the single leaf block, give up. in xfs_dir2_node_to_leaf()
1744 leaf = lbp->b_addr; in xfs_dir2_node_to_leaf()
1745 xfs_dir2_leaf_hdr_from_disk(mp, &leafhdr, leaf); in xfs_dir2_node_to_leaf()
1770 * If the leaf has any stale entries in it, compress them out. in xfs_dir2_node_to_leaf()
1782 * Set up the leaf tail from the freespace block. in xfs_dir2_node_to_leaf()
1784 ltp = xfs_dir2_leaf_tail_p(args->geo, leaf); in xfs_dir2_node_to_leaf()
1788 * Set up the leaf bests table. in xfs_dir2_node_to_leaf()
1793 xfs_dir2_leaf_hdr_to_disk(mp, leaf, &leafhdr); in xfs_dir2_node_to_leaf()
1816 * Now see if we can convert the single-leaf directory in xfs_dir2_node_to_leaf()
1818 * This routine always kills the dabuf for the leaf, so in xfs_dir2_node_to_leaf()