Rebase master to b108

This commit is contained in:
Brian Behlendorf
2009-02-18 12:51:31 -08:00
parent c65e71073f
commit d164b20935
39 changed files with 1091 additions and 739 deletions
+17 -12
View File
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -2204,6 +2204,12 @@ dsl_dataset_rename(char *oldname, const char *newname, boolean_t recursive)
err = dsl_dir_open(oldname, FTAG, &dd, &tail);
if (err)
return (err);
/*
* If there are more than 2 references there may be holds
* hanging around that haven't been cleared out yet.
*/
if (dmu_buf_refcount(dd->dd_dbuf) > 2)
txg_wait_synced(dd->dd_pool, 0);
if (tail == NULL) {
int delta = strlen(newname) - strlen(oldname);
@@ -3024,12 +3030,8 @@ dsl_dataset_set_reservation_check(void *arg1, void *arg2, dmu_tx_t *tx)
dsl_dataset_t *ds = arg1;
uint64_t *reservationp = arg2;
uint64_t new_reservation = *reservationp;
int64_t delta;
uint64_t unique;
if (new_reservation > INT64_MAX)
return (EOVERFLOW);
if (spa_version(ds->ds_dir->dd_pool->dp_spa) <
SPA_VERSION_REFRESERVATION)
return (ENOTSUP);
@@ -3046,15 +3048,18 @@ dsl_dataset_set_reservation_check(void *arg1, void *arg2, dmu_tx_t *tx)
mutex_enter(&ds->ds_lock);
unique = dsl_dataset_unique(ds);
delta = MAX(unique, new_reservation) - MAX(unique, ds->ds_reserved);
mutex_exit(&ds->ds_lock);
if (delta > 0 &&
delta > dsl_dir_space_available(ds->ds_dir, NULL, 0, TRUE))
return (ENOSPC);
if (delta > 0 && ds->ds_quota > 0 &&
new_reservation > ds->ds_quota)
return (ENOSPC);
if (MAX(unique, new_reservation) > MAX(unique, ds->ds_reserved)) {
uint64_t delta = MAX(unique, new_reservation) -
MAX(unique, ds->ds_reserved);
if (delta > dsl_dir_space_available(ds->ds_dir, NULL, 0, TRUE))
return (ENOSPC);
if (ds->ds_quota > 0 &&
new_reservation > ds->ds_quota)
return (ENOSPC);
}
return (0);
}