On Tue, Jul 29, 2008 at 09:32:00PM +0200, Christoph Hellwig wrote:
> From: Dave Chinner <dgc@xxxxxxx>
>
> Reimplement xfs_bmbt_newroot and xfs_bmbt_kill_root using the new generic
> btree helpers and clean out all cruft needed for the old implementations.
>
> This requires exporting some functionality from xfs_btree.c that's only
> used locally otherwise.
>
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
.....
> + nrecs += i;
> + xfs_btree_set_numrecs(block, nrecs);
> +
> + ASSERT(nrecs == crecs);
> + kp = xfs_bmbt_key_addr(cur, 1, block);
> + ckp = xfs_bmbt_key_addr(cur, 1, cblock);
> + memcpy(kp, ckp, nrecs * sizeof(xfs_bmbt_key_t));
Should really be xfs_bmbt_copy_keys(), right?
> + pp = xfs_bmbt_ptr_addr(cur, 1, block);
> + cpp = xfs_bmbt_ptr_addr(cur, 1, cblock);
> +
> +#ifdef DEBUG
> + for (i = 0; i < crecs; i++) {
> + int error;
> +
> + error = xfs_btree_check_ptr(cur, cpp, i, level - 1);
> + if (error) {
> + XFS_BTREE_TRACE_CURSOR(cur, XBT_ERROR);
> + return error;
> + }
> + }
> +#endif
> +
> + memcpy(pp, cpp, nrecs * sizeof(xfs_bmbt_key_t));
xfs_bmbt_copy_recs()?
Otherwise looks ok.
Cheers,
Dave.
--
Dave Chinner
david@xxxxxxxxxxxxx
|