if (dd == NULL) {
dsl_dir_t *winner;
- dd = kmem_zalloc(sizeof (dsl_dir_t), KM_SLEEP);
+ dd = kmem_zalloc(sizeof (dsl_dir_t), KM_PUSHPAGE);
dd->dd_object = ddobj;
dd->dd_dbuf = dbuf;
dd->dd_pool = dp;
kmem_free(dd, sizeof (dsl_dir_t));
dmu_buf_rele(dbuf, tag);
return (err);
-
}
void
}
}
-/* Calculate name legnth, avoiding all the strcat calls of dsl_dir_name */
+/* Calculate name length, avoiding all the strcat calls of dsl_dir_name */
int
dsl_dir_namelen(dsl_dir_t *dd)
{
}
/*
- * same as dsl_open_dir, ignore the first component of name and use the
+ * same as dsl_dir_open, ignore the first component of name and use the
* spa instead
*/
int
dprintf("%s\n", name);
- buf = kmem_alloc(MAXNAMELEN, KM_SLEEP);
+ buf = kmem_alloc(MAXNAMELEN, KM_PUSHPAGE);
err = getcomponent(name, buf, &next);
if (err)
goto error;
/*
* There should be exactly two holds, both from
* dsl_dataset_destroy: one on the dd directory, and one on its
- * head ds. Otherwise, someone is trying to lookup something
- * inside this dir while we want to destroy it. The
- * config_rwlock ensures that nobody else opens it after we
- * check.
+ * head ds. If there are more holds, then a concurrent thread is
+ * performing a lookup inside this dir while we're trying to destroy
+ * it. To minimize this possibility, we perform this check only
+ * in syncing context and fail the operation if we encounter
+ * additional holds. The dp_config_rwlock ensures that nobody else
+ * opens it after we check.
*/
- if (dmu_buf_refcount(dd->dd_dbuf) > 2)
+ if (dmu_tx_is_syncing(tx) && dmu_buf_refcount(dd->dd_dbuf) > 2)
return (EBUSY);
err = zap_count(mos, dd->dd_phys->dd_child_dir_zapobj, &count);
{
ASSERT(dmu_tx_is_syncing(tx));
- dmu_buf_will_dirty(dd->dd_dbuf, tx);
-
mutex_enter(&dd->dd_lock);
ASSERT3U(dd->dd_tempreserved[tx->tx_txg&TXG_MASK], ==, 0);
dprintf_dd(dd, "txg=%llu towrite=%lluK\n", tx->tx_txg,
asize - ref_rsrv);
mutex_exit(&dd->dd_lock);
- tr = kmem_zalloc(sizeof (struct tempreserve), KM_SLEEP);
+ tr = kmem_zalloc(sizeof (struct tempreserve), KM_PUSHPAGE);
tr->tr_ds = dd;
tr->tr_size = asize;
list_insert_tail(tr_list, tr);
return (0);
}
- tr_list = kmem_alloc(sizeof (list_t), KM_SLEEP);
+ tr_list = kmem_alloc(sizeof (list_t), KM_PUSHPAGE);
list_create(tr_list, sizeof (struct tempreserve),
offsetof(struct tempreserve, tr_node));
ASSERT3S(asize, >, 0);
if (err == 0) {
struct tempreserve *tr;
- tr = kmem_zalloc(sizeof (struct tempreserve), KM_SLEEP);
+ tr = kmem_zalloc(sizeof (struct tempreserve), KM_PUSHPAGE);
tr->tr_size = lsize;
list_insert_tail(tr_list, tr);
if (err == 0) {
struct tempreserve *tr;
- tr = kmem_zalloc(sizeof (struct tempreserve), KM_SLEEP);
+ tr = kmem_zalloc(sizeof (struct tempreserve), KM_PUSHPAGE);
tr->tr_dp = dd->dd_pool;
tr->tr_size = asize;
list_insert_tail(tr_list, tr);
ASSERT(dmu_tx_is_syncing(tx));
ASSERT(type < DD_USED_NUM);
- dsl_dir_dirty(dd, tx);
-
if (needlock)
mutex_enter(&dd->dd_lock);
accounted_delta = parent_delta(dd, dd->dd_phys->dd_used_bytes, used);
dd->dd_phys->dd_compressed_bytes >= -compressed);
ASSERT(uncompressed >= 0 ||
dd->dd_phys->dd_uncompressed_bytes >= -uncompressed);
+ dmu_buf_will_dirty(dd->dd_dbuf, tx);
dd->dd_phys->dd_used_bytes += used;
dd->dd_phys->dd_uncompressed_bytes += uncompressed;
dd->dd_phys->dd_compressed_bytes += compressed;
if (delta == 0 || !(dd->dd_phys->dd_flags & DD_FLAG_USED_BREAKDOWN))
return;
- dsl_dir_dirty(dd, tx);
if (needlock)
mutex_enter(&dd->dd_lock);
ASSERT(delta > 0 ?
dd->dd_phys->dd_used_breakdown[oldtype] >= delta :
dd->dd_phys->dd_used_breakdown[newtype] >= -delta);
ASSERT(dd->dd_phys->dd_used_bytes >= ABS(delta));
+ dmu_buf_will_dirty(dd->dd_dbuf, tx);
dd->dd_phys->dd_used_breakdown[oldtype] -= delta;
dd->dd_phys->dd_used_breakdown[newtype] += delta;
if (needlock)
mutex_enter(&dd->dd_lock);
dd->dd_phys->dd_quota = effective_value;
mutex_exit(&dd->dd_lock);
-
- spa_history_log_internal(LOG_DS_QUOTA, dd->dd_pool->dp_spa,
- tx, "%lld dataset = %llu ",
- (longlong_t)effective_value, dd->dd_phys->dd_head_dataset_obj);
}
int
delta, 0, 0, tx);
}
mutex_exit(&dd->dd_lock);
-
- spa_history_log_internal(LOG_DS_RESERVATION, dd->dd_pool->dp_spa,
- tx, "%lld dataset = %llu",
- (longlong_t)effective_value, dd->dd_phys->dd_head_dataset_obj);
}
int
dd->dd_snap_cmtime = t;
mutex_exit(&dd->dd_lock);
}
+
+#if defined(_KERNEL) && defined(HAVE_SPL)
+EXPORT_SYMBOL(dsl_dir_set_quota);
+EXPORT_SYMBOL(dsl_dir_set_reservation);
+EXPORT_SYMBOL(dsl_dir_open);
+EXPORT_SYMBOL(dsl_dir_close);
+#endif