+
+ mutex_enter(&ds->ds_sendstream_lock);
+ *dsp->dsa_off += dbi->dbi_len;
+ mutex_exit(&ds->ds_sendstream_lock);
+}
+
+static int
+dump_bytes(dmu_sendarg_t *dsp, void *buf, int len)
+{
+ dump_bytes_io_t dbi;
+
+ dbi.dbi_dsp = dsp;
+ dbi.dbi_buf = buf;
+ dbi.dbi_len = len;
+
+ /*
+ * The vn_rdwr() call is performed in a taskq to ensure that there is
+ * always enough stack space to write safely to the target filesystem.
+ * The ZIO_TYPE_FREE threads are used because there can be a lot of
+ * them and they are used in vdev_file.c for a similar purpose.
+ */
+ spa_taskq_dispatch_sync(dmu_objset_spa(dsp->dsa_os), ZIO_TYPE_FREE,
+ ZIO_TASKQ_ISSUE, dump_bytes_strategy, &dbi, TQ_SLEEP);
+
+ return (dsp->dsa_err);