Lines Matching defs:leaf

37  * Routines to implement leaf blocks of attributes as Btrees of hashed names.
75 STATIC int xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index);
81 * of an attr leaf block. The region starts at the tail of the block and expands
83 * size for an empty leaf block and is reduced from there.
241 struct xfs_attr_leafblock *leaf,
269 lentry = xfs_attr3_leaf_name_local(leaf, idx);
276 rentry = xfs_attr3_leaf_name_remote(leaf, idx);
293 * Validate an attribute leaf block.
295 * Empty leaf blocks can occur under the following circumstances:
300 * 4. The attribute is small enough to fit in a leaf block;
302 * the (empty) leaf block; and
304 * attribute can be committed to the leaf block.
307 * because the leaf is empty.
315 struct xfs_attr_leafblock *leaf = bp->b_addr;
324 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);
336 if (ichdr.firstused < xfs_attr3_leaf_hdr_size(leaf))
346 * NOTE: This verifier historically failed empty leaf buffers because
350 * cannot assume leaf blocks are non-empty until that is addressed.
354 fa = xfs_attr3_leaf_verify_entry(mp, buf_end, leaf, &ichdr,
415 * leaf/node format detection on trees is sketchy, so a node read can be done on
416 * leaf level blocks when detection identifies the tree as a node format tree
931 /* Convert from using the shortform to the leaf format. */
1002 * Check a leaf attribute block to see if all the entries would fit into
1010 struct xfs_attr_leafblock *leaf;
1018 leaf = bp->b_addr;
1019 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &leafhdr, leaf);
1020 entry = xfs_attr3_leaf_entryp(leaf);
1028 name_loc = xfs_attr3_leaf_name_local(leaf, i);
1120 * Convert a leaf attribute list to shortform attribute list
1128 struct xfs_attr_leafblock *leaf;
1146 leaf = (xfs_attr_leafblock_t *)tmpbuffer;
1147 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
1148 entry = xfs_attr3_leaf_entryp(leaf);
1194 name_loc = xfs_attr3_leaf_name_local(leaf, i);
1211 * Convert from using a single leaf to a root node and a leaf.
1217 struct xfs_attr_leafblock *leaf;
1247 /* copy leaf to new buffer, update identifiers */
1266 leaf = bp2->b_addr;
1267 xfs_attr3_leaf_hdr_from_disk(args->geo, &icleafhdr, leaf);
1268 entries = xfs_attr3_leaf_entryp(leaf);
1286 * Create the initial contents of a leaf attribute list
1287 * or a leaf in a node attribute list.
1295 struct xfs_attr_leafblock *leaf;
1310 leaf = bp->b_addr;
1311 memset(leaf, 0, args->geo->blksize);
1332 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr);
1340 * Split the leaf node, rebalance, then add the new entry.
1354 * Allocate space for a new leaf node.
1399 * Add a name to the leaf attribute list structure.
1406 struct xfs_attr_leafblock *leaf;
1416 leaf = bp->b_addr;
1417 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
1426 + xfs_attr3_leaf_hdr_size(leaf);
1470 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr);
1472 XFS_DA_LOGRANGE(leaf, &leaf->hdr,
1473 xfs_attr3_leaf_hdr_size(leaf)));
1478 * Add a name to a leaf attribute list structure.
1487 struct xfs_attr_leafblock *leaf;
1497 leaf = bp->b_addr;
1504 entry = &xfs_attr3_leaf_entryp(leaf)[args->index];
1510 XFS_DA_LOGRANGE(leaf, entry, tmp + sizeof(*entry)));
1542 XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry)));
1556 name_loc = xfs_attr3_leaf_name_local(leaf, args->index);
1563 name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);
1575 XFS_DA_LOGRANGE(leaf, xfs_attr3_leaf_name(leaf, args->index),
1576 xfs_attr_leaf_entsize(leaf, args->index)));
1579 * Update the control info for this leaf node
1585 + xfs_attr3_leaf_hdr_size(leaf));
1587 + xfs_attr3_leaf_hdr_size(leaf);
1597 ichdr->usedbytes += xfs_attr_leaf_entsize(leaf, args->index);
1602 * Garbage collect a leaf attribute list block by copying it to a new buffer.
1660 * Compare two leaf blocks "order".
1700 * Redistribute the attribute list entries between two leaf nodes,
1707 * to match what it is doing in splitting the attribute leaf block. Those
1777 * Move any entries required from leaf to leaf:
1781 * Figure the total bytes to be added to the destination leaf.
1810 * Figure the total bytes to be added to the destination leaf.
1870 * On a double leaf split, the original attr location
1881 * decide where in the leaf to place it.
1960 * Figure out if next leaf entry would be too much.
1991 * Check a leaf block and its neighbors to see if the block should be
2006 struct xfs_attr_leafblock *leaf;
2025 leaf = blk->bp->b_addr;
2026 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr, leaf);
2027 bytes = xfs_attr3_leaf_hdr_size(leaf) +
2089 xfs_attr3_leaf_hdr_size(leaf);
2123 * Remove a name from the leaf attribute list structure.
2125 * Return 1 if leaf is less than 37% full, 0 if >= 37% full.
2133 struct xfs_attr_leafblock *leaf;
2146 leaf = bp->b_addr;
2147 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2152 xfs_attr3_leaf_hdr_size(leaf));
2154 entry = &xfs_attr3_leaf_entryp(leaf)[args->index];
2166 + xfs_attr3_leaf_hdr_size(leaf);
2170 entsize = xfs_attr_leaf_entsize(leaf, args->index);
2228 memset(xfs_attr3_leaf_name(leaf, args->index), 0, entsize);
2231 XFS_DA_LOGRANGE(leaf, xfs_attr3_leaf_name(leaf, args->index),
2238 XFS_DA_LOGRANGE(leaf, entry, tmp + sizeof(xfs_attr_leaf_entry_t)));
2240 entry = &xfs_attr3_leaf_entryp(leaf)[ichdr.count];
2251 entry = xfs_attr3_leaf_entryp(leaf);
2264 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr);
2266 XFS_DA_LOGRANGE(leaf, &leaf->hdr,
2267 xfs_attr3_leaf_hdr_size(leaf)));
2270 * Check if leaf is less than 50% full, caller may want to
2271 * "join" the leaf with a sibling if so.
2273 tmp = ichdr.usedbytes + xfs_attr3_leaf_hdr_size(leaf) +
2276 return tmp < args->geo->magicpct; /* leaf is < 37% full */
2307 * Note that we don't check "leaf" for holes because we will
2312 * dest leaf has no holes, so we add there. May need
2330 * of the leaf and add them both to that.
2338 * Copy the header into the temp leaf so that all the stuff
2394 * Look up a name in a leaf attribute list structure.
2398 * current leaf node. The Btree code must check in adjacent leaf nodes.
2411 struct xfs_attr_leafblock *leaf;
2423 leaf = bp->b_addr;
2424 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2425 entries = xfs_attr3_leaf_entryp(leaf);
2456 * hashval in the leaf.
2481 name_loc = xfs_attr3_leaf_name_local(leaf, probe);
2488 name_rmt = xfs_attr3_leaf_name_remote(leaf, probe);
2506 * Get the value associated with an attribute name from a leaf attribute
2518 struct xfs_attr_leafblock *leaf;
2524 leaf = bp->b_addr;
2525 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2529 entry = &xfs_attr3_leaf_entryp(leaf)[args->index];
2531 name_loc = xfs_attr3_leaf_name_local(leaf, args->index);
2539 name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);
2554 * Move the indicated entries from one leaf to another.
2600 * Move the entries in the destination leaf up to make a hole?
2696 ichdr_s->holes = 1; /* leaf may not be compact */
2700 * Pick up the last hashvalue from a leaf block.
2725 xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index)
2732 entries = xfs_attr3_leaf_entryp(leaf);
2734 name_loc = xfs_attr3_leaf_name_local(leaf, index);
2738 name_rmt = xfs_attr3_leaf_name_remote(leaf, index);
2770 * Manage the INCOMPLETE flag in a leaf entry
2774 * Clear the INCOMPLETE flag on an entry in a leaf block.
2780 struct xfs_attr_leafblock *leaf;
2800 leaf = bp->b_addr;
2801 entry = &xfs_attr3_leaf_entryp(leaf)[args->index];
2805 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2810 name_loc = xfs_attr3_leaf_name_local(leaf, args->index);
2814 name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);
2825 XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry)));
2829 name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);
2833 XFS_DA_LOGRANGE(leaf, name_rmt, sizeof(*name_rmt)));
2840 * Set the INCOMPLETE flag on an entry in a leaf block.
2846 struct xfs_attr_leafblock *leaf;
2864 leaf = bp->b_addr;
2866 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2870 entry = &xfs_attr3_leaf_entryp(leaf)[args->index];
2875 XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry)));
2877 name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index);
2881 XFS_DA_LOGRANGE(leaf, name_rmt, sizeof(*name_rmt)));
2888 * In a single transaction, clear the INCOMPLETE flag on the leaf entry
2889 * given by args->blkno/index and set the INCOMPLETE flag on the leaf