bptree.c revision 1b912ec7100c10e7243bf0879af0fe580e08c73d
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
#include <sys/dmu_objset.h>
#include <sys/dmu_traverse.h>
#include <sys/dsl_dataset.h>
#include <sys/dsl_pool.h>
#include <sys/refcount.h>
/*
* A bptree is a queue of root block pointers from destroyed datasets. When a
* dataset is destroyed its root block pointer is put on the end of the pool's
* bptree queue so the dataset's blocks can be freed asynchronously by
* dsl_scan_sync. This allows the delete operation to finish without traversing
* all the dataset's blocks.
*
* Note that while bt_begin and bt_end are only ever incremented in this code
* they are effectively reset to 0 every time the entire bptree is freed because
* the bptree's object is destroyed and re-created.
*/
struct bptree_args {
void *ba_arg; /* caller supplied argument to ba_func */
{
sizeof (bptree_phys_t), tx);
/*
* Bonus buffer contents are already initialized to 0, but for
* readability we make it explicit.
*/
return (obj);
}
int
{
}
void
{
/*
* bptree objects are in the pool mos, therefore they can only be
* modified in syncing context. Furthermore, this is only modified
* by the sync thread, so no locking is necessary.
*/
}
/* ARGSUSED */
static int
{
int err;
return (0);
}
return (err);
}
int
{
int err;
uint64_t i;
struct bptree_args ba;
if (err != 0)
return (err);
if (free)
err = 0;
if (err != 0)
break;
bptree_visit_cb, &ba);
if (free) {
if (err != 0) {
/* save bookmark for future resume */
break;
} else {
}
}
}
/* if all blocks are free there should be no used space */
}
return (err);
}