• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/src/linux/linux-2.6/fs/xfs/

Lines Matching refs:leaf

101  * Convert a leaf-format directory to a node-format directory.
102 * We need to change the magic number of the leaf block, and copy
103 * the freespace table out of the leaf block into its own block.
108 xfs_dabuf_t *lbp) /* leaf buffer */
116 int i; /* leaf freespace index */
117 xfs_dir2_leaf_t *leaf; /* leaf structure */
118 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */
145 leaf = lbp->data;
146 ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
155 * Copy freespace entries from the leaf block to the new block.
165 leaf->hdr.info.magic = cpu_to_be16(XFS_DIR2_LEAFN_MAGIC);
178 * Add a leaf entry to a leaf block in a node-form directory.
183 xfs_dabuf_t *bp, /* leaf buffer */
190 xfs_dir2_leaf_t *leaf; /* leaf structure */
191 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
192 int lfloghigh; /* high leaf entry logging */
193 int lfloglow; /* low leaf entry logging */
202 leaf = bp->data;
212 * If there are already the maximum number of leaf entries in
218 if (be16_to_cpu(leaf->hdr.count) == XFS_DIR2_MAX_LEAF_ENTS(mp)) {
219 if (!leaf->hdr.stale)
221 compact = be16_to_cpu(leaf->hdr.stale) > 1;
224 ASSERT(index == 0 || be32_to_cpu(leaf->ents[index - 1].hashval) <= args->hashval);
225 ASSERT(index == be16_to_cpu(leaf->hdr.count) ||
226 be32_to_cpu(leaf->ents[index].hashval) >= args->hashval);
232 * Compact out all but one stale leaf entry. Leaves behind
242 else if (leaf->hdr.stale) {
243 lfloglow = be16_to_cpu(leaf->hdr.count);
249 if (!leaf->hdr.stale) {
250 lep = &leaf->ents[index];
251 if (index < be16_to_cpu(leaf->hdr.count))
253 (be16_to_cpu(leaf->hdr.count) - index) * sizeof(*lep));
255 lfloghigh = be16_to_cpu(leaf->hdr.count);
256 be16_add(&leaf->hdr.count, 1);
272 be32_to_cpu(leaf->ents[lowstale].address) !=
282 highstale < be16_to_cpu(leaf->hdr.count) &&
283 be32_to_cpu(leaf->ents[highstale].address) !=
295 (highstale == be16_to_cpu(leaf->hdr.count) ||
297 ASSERT(be32_to_cpu(leaf->ents[lowstale].address) ==
301 memmove(&leaf->ents[lowstale],
302 &leaf->ents[lowstale + 1],
304 lep = &leaf->ents[index - 1];
313 ASSERT(be32_to_cpu(leaf->ents[highstale].address) ==
317 memmove(&leaf->ents[index + 1],
318 &leaf->ents[index],
320 lep = &leaf->ents[index];
324 be16_add(&leaf->hdr.stale, -1);
345 xfs_dabuf_t *bp) /* leaf buffer */
347 int i; /* leaf index */
348 xfs_dir2_leaf_t *leaf; /* leaf structure */
352 leaf = bp->data;
354 ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC);
355 ASSERT(be16_to_cpu(leaf->hdr.count) <= XFS_DIR2_MAX_LEAF_ENTS(mp));
356 for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) {
357 if (i + 1 < be16_to_cpu(leaf->hdr.count)) {
358 ASSERT(be32_to_cpu(leaf->ents[i].hashval) <=
359 be32_to_cpu(leaf->ents[i + 1].hashval));
361 if (be32_to_cpu(leaf->ents[i].address) == XFS_DIR2_NULL_DATAPTR)
364 ASSERT(be16_to_cpu(leaf->hdr.stale) == stale);
369 * Return the last hash value in the leaf.
374 xfs_dabuf_t *bp, /* leaf buffer */
375 int *count) /* count of entries in leaf */
377 xfs_dir2_leaf_t *leaf; /* leaf structure */
379 leaf = bp->data;
380 ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC);
382 *count = be16_to_cpu(leaf->hdr.count);
383 if (!leaf->hdr.count)
385 return be32_to_cpu(leaf->ents[be16_to_cpu(leaf->hdr.count) - 1].hashval);
389 * Look up a leaf entry in a node-format leaf block.
395 xfs_dabuf_t *bp, /* leaf buffer */
397 int *indexp, /* out: leaf entry index */
408 int index; /* leaf entry index */
409 xfs_dir2_leaf_t *leaf; /* leaf structure */
411 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
420 leaf = bp->data;
421 ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC);
423 ASSERT(be16_to_cpu(leaf->hdr.count) > 0);
427 * Look up the hash value in the leaf entries.
455 * Loop over leaf entries with the right hash value.
457 for (lep = &leaf->ents[index];
458 index < be16_to_cpu(leaf->hdr.count) && be32_to_cpu(lep->hashval) == args->hashval;
461 * Skip stale leaf entries.
623 ASSERT(index == be16_to_cpu(leaf->hdr.count) || args->oknoent);
628 * Move count leaf entries from source to destination leaf.
634 xfs_dabuf_t *bp_s, /* source leaf buffer */
635 int start_s, /* source leaf index */
636 xfs_dabuf_t *bp_d, /* destination leaf buffer */
637 int start_d, /* destination leaf index */
640 xfs_dir2_leaf_t *leaf_d; /* destination leaf structure */
641 xfs_dir2_leaf_t *leaf_s; /* source leaf structure */
658 * destination leaf entries, open up a hole in the destination
673 int i; /* temp leaf index */
682 * Copy the leaf entries from source to destination.
710 * Determine the sort order of two leaf blocks.
735 * Rebalance leaf entries between two leaf blocks.
749 int isleft; /* new goes in left leaf */
750 xfs_dir2_leaf_t *leaf1; /* first leaf structure */
751 xfs_dir2_leaf_t *leaf2; /* second leaf structure */
752 int mid; /* midpoint leaf index */
756 int oldsum; /* old total leaf count */
757 int swap; /* swapped leaf blocks */
778 * If the old leaf count was odd then the new one will be even,
811 * Mark whether we're inserting into the old or new leaf.
833 "xfs_dir2_leafn_rebalance: picked the wrong leaf? reverting original leaf: "
841 * This removes the leaf entry and the data entry,
847 xfs_dabuf_t *bp, /* leaf buffer */
848 int index, /* leaf entry index */
857 xfs_dir2_leaf_t *leaf; /* leaf structure */
858 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
870 leaf = bp->data;
871 ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC);
875 lep = &leaf->ents[index];
884 * Kill the leaf entry by marking it stale.
885 * Log the leaf block changes.
887 be16_add(&leaf->hdr.stale, 1);
1037 * Return indication of whether this leaf block is emtpy enough
1041 ((uint)sizeof(leaf->hdr) +
1042 (uint)sizeof(leaf->ents[0]) *
1043 (be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale))) <
1049 * Split the leaf entries in the old block into old and new blocks.
1058 xfs_dablk_t blkno; /* new leaf block number */
1063 * Allocate space for a new leaf node.
1074 * Initialize the new leaf block.
1110 * Check a leaf block and its neighbors to see if the block should be
1123 xfs_da_state_blk_t *blk; /* leaf block */
1124 xfs_dablk_t blkno; /* leaf block number */
1125 xfs_dabuf_t *bp; /* leaf buffer */
1127 int count; /* leaf live entry count */
1131 xfs_da_blkinfo_t *info; /* leaf block header */
1132 xfs_dir2_leaf_t *leaf; /* leaf structure */
1143 leaf = (xfs_dir2_leaf_t *)info;
1144 count = be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale);
1145 bytes = (uint)sizeof(leaf->hdr) + count * (uint)sizeof(leaf->ents[0]);
1186 * Read the sibling leaf block.
1197 leaf = (xfs_dir2_leaf_t *)info;
1198 count = be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale);
1200 leaf = bp->data;
1201 ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC);
1202 count += be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale);
1203 bytes -= count * (uint)sizeof(leaf->ents[0]);
1219 * Done with the sibling leaf block here, drop the dabuf
1242 * Move all the leaf entries from drop_blk to save_blk.
1252 xfs_dir2_leaf_t *drop_leaf; /* dead leaf structure */
1253 xfs_dir2_leaf_t *save_leaf; /* surviving leaf structure */
1263 * If there are any stale leaf entries, take this opportunity
1291 xfs_da_state_blk_t *blk; /* leaf block for insert */
1327 * Add the new leaf entry.
1338 * It didn't work, we need to split the leaf block.
1345 * Split the leaf block and insert the new entry.
1356 * The leaf entry is added in xfs_dir2_leafn_add.
1770 * Release the btree blocks and leaf block.
1794 xfs_da_state_blk_t *blk; /* leaf block */
1826 * Remove the leaf and data entries.
1839 * If we need to join leaf blocks, do it.
1844 * If no errors so far, try conversion to leaf format.
1859 xfs_da_state_blk_t *blk; /* leaf block */
1865 xfs_dir2_leaf_t *leaf; /* leaf structure */
1866 xfs_dir2_leaf_entry_t *lep; /* leaf entry being changed */
1893 * Find the leaf entry.
1897 leaf = blk->bp->data;
1898 lep = &leaf->ents[blk->index];