8585 improve batching done in zil_commit()
illumos/illumos-gate@1271e4b10d
1271e4b10d
https://www.illumos.org/issues/8585
The current implementation of zil_commit() can introduce significant
latency, beyond what is inherent due to the latency of the underlying
storage. The additional latency comes from two main problems:
1. When there's outstanding ZIL blocks being written (i.e. there's
already a "writer thread" in progress), then any new calls to
zil_commit() will block waiting for the currently oustanding ZIL
blocks to complete. The blocks written for each "writer thread" is
coined a "batch", and there can only ever be a single "batch" being
written at a time. When a batch is being written, any new ZIL
transactions will have to wait for the next batch to be written,
which won't occur until the current batch finishes.
As a result, the underlying storage may not be used as efficiently
as possible. While "new" threads enter zil_commit() and are blocked
waiting for the next batch, it's possible that the underlying
storage isn't fully utilized by the current batch of ZIL blocks. In
that case, it'd be better to allow these new threads to generate
(and issue) a new ZIL block, such that it could be serviced by the
underlying storage concurrently with the other ZIL blocks that are
being serviced.
2. Any call to zil_commit() must wait for all ZIL blocks in its "batch"
to complete, prior to zil_commit() returning. The size of any given
batch is proportional to the number of ZIL transaction in the queue
at the time that the batch starts processing the queue; which
doesn't occur until the previous batch completes. Thus, if there's a
lot of transactions in the queue, the batch could be composed of
many ZIL blocks, and each call to zil_commit() will have to wait for
all of these writes to complete (even if the thread calling
zil_commit() only cared about one of the transactions in the batch).
Reviewed by: Brad Lewis <brad.lewis@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Prakash Surya <prakash.surya@delphix.com>
This commit is contained in:
parent
f8453396dc
commit
f3dbcb8c81
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor-sys/illumos/dist/; revision=323535
@ -1829,13 +1829,14 @@ ztest_get_done(zgd_t *zgd, int error)
|
||||
ztest_object_unlock(zd, object);
|
||||
|
||||
if (error == 0 && zgd->zgd_bp)
|
||||
zil_add_block(zgd->zgd_zilog, zgd->zgd_bp);
|
||||
zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp);
|
||||
|
||||
umem_free(zgd, sizeof (*zgd));
|
||||
}
|
||||
|
||||
static int
|
||||
ztest_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
|
||||
ztest_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb,
|
||||
zio_t *zio)
|
||||
{
|
||||
ztest_ds_t *zd = arg;
|
||||
objset_t *os = zd->zd_os;
|
||||
@ -1849,6 +1850,10 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
|
||||
zgd_t *zgd;
|
||||
int error;
|
||||
|
||||
ASSERT3P(lwb, !=, NULL);
|
||||
ASSERT3P(zio, !=, NULL);
|
||||
ASSERT3U(size, !=, 0);
|
||||
|
||||
ztest_object_lock(zd, object, RL_READER);
|
||||
error = dmu_bonus_hold(os, object, FTAG, &db);
|
||||
if (error) {
|
||||
@ -1869,7 +1874,7 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
|
||||
db = NULL;
|
||||
|
||||
zgd = umem_zalloc(sizeof (*zgd), UMEM_NOFAIL);
|
||||
zgd->zgd_zilog = zd->zd_zilog;
|
||||
zgd->zgd_lwb = lwb;
|
||||
zgd->zgd_private = zd;
|
||||
|
||||
if (buf != NULL) { /* immediate write */
|
||||
|
@ -1645,6 +1645,13 @@ dmu_sync_late_arrival(zio_t *pio, objset_t *os, dmu_sync_cb_t *done, zgd_t *zgd,
|
||||
return (SET_ERROR(EIO));
|
||||
}
|
||||
|
||||
/*
|
||||
* In order to prevent the zgd's lwb from being free'd prior to
|
||||
* dmu_sync_late_arrival_done() being called, we have to ensure
|
||||
* the lwb's "max txg" takes this tx's txg into account.
|
||||
*/
|
||||
zil_lwb_add_txg(zgd->zgd_lwb, dmu_tx_get_txg(tx));
|
||||
|
||||
dsa = kmem_alloc(sizeof (dmu_sync_arg_t), KM_SLEEP);
|
||||
dsa->dsa_dr = NULL;
|
||||
dsa->dsa_done = done;
|
||||
|
@ -911,7 +911,7 @@ uint64_t dmu_tx_get_txg(dmu_tx_t *tx);
|
||||
* {zfs,zvol,ztest}_get_done() args
|
||||
*/
|
||||
typedef struct zgd {
|
||||
struct zilog *zgd_zilog;
|
||||
struct lwb *zgd_lwb;
|
||||
struct blkptr *zgd_bp;
|
||||
dmu_buf_t *zgd_db;
|
||||
struct rl *zgd_rl;
|
||||
|
@ -40,6 +40,7 @@ extern "C" {
|
||||
|
||||
struct dsl_pool;
|
||||
struct dsl_dataset;
|
||||
struct lwb;
|
||||
|
||||
/*
|
||||
* Intent log format:
|
||||
@ -140,6 +141,7 @@ typedef enum zil_create {
|
||||
/*
|
||||
* Intent log transaction types and record structures
|
||||
*/
|
||||
#define TX_COMMIT 0 /* Commit marker (no on-disk state) */
|
||||
#define TX_CREATE 1 /* Create file */
|
||||
#define TX_MKDIR 2 /* Make directory */
|
||||
#define TX_MKXATTR 3 /* Make XATTR directory */
|
||||
@ -388,7 +390,8 @@ typedef int zil_parse_blk_func_t(zilog_t *zilog, blkptr_t *bp, void *arg,
|
||||
typedef int zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg,
|
||||
uint64_t txg);
|
||||
typedef int zil_replay_func_t();
|
||||
typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, zio_t *zio);
|
||||
typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf,
|
||||
struct lwb *lwb, zio_t *zio);
|
||||
|
||||
extern int zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func,
|
||||
zil_parse_lr_func_t *parse_lr_func, void *arg, uint64_t txg);
|
||||
@ -426,7 +429,8 @@ extern void zil_clean(zilog_t *zilog, uint64_t synced_txg);
|
||||
extern int zil_suspend(const char *osname, void **cookiep);
|
||||
extern void zil_resume(void *cookie);
|
||||
|
||||
extern void zil_add_block(zilog_t *zilog, const blkptr_t *bp);
|
||||
extern void zil_lwb_add_block(struct lwb *lwb, const blkptr_t *bp);
|
||||
extern void zil_lwb_add_txg(struct lwb *lwb, uint64_t txg);
|
||||
extern int zil_bp_tree_add(zilog_t *zilog, const blkptr_t *bp);
|
||||
|
||||
extern void zil_set_sync(zilog_t *zilog, uint64_t syncval);
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2012, 2017 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2014 Integros [integros.com]
|
||||
*/
|
||||
|
||||
@ -37,7 +37,30 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Log write buffer.
|
||||
* Possbile states for a given lwb structure. An lwb will start out in
|
||||
* the "closed" state, and then transition to the "opened" state via a
|
||||
* call to zil_lwb_write_open(). After the lwb is "open", it can
|
||||
* transition into the "issued" state via zil_lwb_write_issue(). After
|
||||
* the lwb's zio completes, and the vdev's are flushed, the lwb will
|
||||
* transition into the "done" state via zil_lwb_write_done(), and the
|
||||
* structure eventually freed.
|
||||
*/
|
||||
typedef enum {
|
||||
LWB_STATE_CLOSED,
|
||||
LWB_STATE_OPENED,
|
||||
LWB_STATE_ISSUED,
|
||||
LWB_STATE_DONE,
|
||||
LWB_NUM_STATES
|
||||
} lwb_state_t;
|
||||
|
||||
/*
|
||||
* Log write block (lwb)
|
||||
*
|
||||
* Prior to an lwb being issued to disk via zil_lwb_write_issue(), it
|
||||
* will be protected by the zilog's "zl_writer_lock". Basically, prior
|
||||
* to it being issued, it will only be accessed by the thread that's
|
||||
* holding the "zl_writer_lock". After the lwb is issued, the zilog's
|
||||
* "zl_lock" is used to protect the lwb against concurrent access.
|
||||
*/
|
||||
typedef struct lwb {
|
||||
zilog_t *lwb_zilog; /* back pointer to log struct */
|
||||
@ -45,13 +68,44 @@ typedef struct lwb {
|
||||
boolean_t lwb_slog; /* lwb_blk is on SLOG device */
|
||||
int lwb_nused; /* # used bytes in buffer */
|
||||
int lwb_sz; /* size of block and buffer */
|
||||
lwb_state_t lwb_state; /* the state of this lwb */
|
||||
char *lwb_buf; /* log write buffer */
|
||||
zio_t *lwb_zio; /* zio for this buffer */
|
||||
zio_t *lwb_write_zio; /* zio for the lwb buffer */
|
||||
zio_t *lwb_root_zio; /* root zio for lwb write and flushes */
|
||||
dmu_tx_t *lwb_tx; /* tx for log block allocation */
|
||||
uint64_t lwb_max_txg; /* highest txg in this lwb */
|
||||
list_node_t lwb_node; /* zilog->zl_lwb_list linkage */
|
||||
list_t lwb_waiters; /* list of zil_commit_waiter's */
|
||||
avl_tree_t lwb_vdev_tree; /* vdevs to flush after lwb write */
|
||||
kmutex_t lwb_vdev_lock; /* protects lwb_vdev_tree */
|
||||
hrtime_t lwb_issued_timestamp; /* when was the lwb issued? */
|
||||
} lwb_t;
|
||||
|
||||
/*
|
||||
* ZIL commit waiter.
|
||||
*
|
||||
* This structure is allocated each time zil_commit() is called, and is
|
||||
* used by zil_commit() to communicate with other parts of the ZIL, such
|
||||
* that zil_commit() can know when it safe for it return. For more
|
||||
* details, see the comment above zil_commit().
|
||||
*
|
||||
* The "zcw_lock" field is used to protect the commit waiter against
|
||||
* concurrent access. This lock is often acquired while already holding
|
||||
* the zilog's "zl_writer_lock" or "zl_lock"; see the functions
|
||||
* zil_process_commit_list() and zil_lwb_flush_vdevs_done() as examples
|
||||
* of this. Thus, one must be careful not to acquire the
|
||||
* "zl_writer_lock" or "zl_lock" when already holding the "zcw_lock";
|
||||
* e.g. see the zil_commit_waiter_timeout() function.
|
||||
*/
|
||||
typedef struct zil_commit_waiter {
|
||||
kcondvar_t zcw_cv; /* signalled when "done" */
|
||||
kmutex_t zcw_lock; /* protects fields of this struct */
|
||||
list_node_t zcw_node; /* linkage in lwb_t:lwb_waiter list */
|
||||
lwb_t *zcw_lwb; /* back pointer to lwb when linked */
|
||||
boolean_t zcw_done; /* B_TRUE when "done", else B_FALSE */
|
||||
int zcw_zio_error; /* contains the zio io_error value */
|
||||
} zil_commit_waiter_t;
|
||||
|
||||
/*
|
||||
* Intent log transaction lists
|
||||
*/
|
||||
@ -94,20 +148,20 @@ struct zilog {
|
||||
const zil_header_t *zl_header; /* log header buffer */
|
||||
objset_t *zl_os; /* object set we're logging */
|
||||
zil_get_data_t *zl_get_data; /* callback to get object content */
|
||||
zio_t *zl_root_zio; /* log writer root zio */
|
||||
lwb_t *zl_last_lwb_opened; /* most recent lwb opened */
|
||||
hrtime_t zl_last_lwb_latency; /* zio latency of last lwb done */
|
||||
uint64_t zl_lr_seq; /* on-disk log record sequence number */
|
||||
uint64_t zl_commit_lr_seq; /* last committed on-disk lr seq */
|
||||
uint64_t zl_destroy_txg; /* txg of last zil_destroy() */
|
||||
uint64_t zl_replayed_seq[TXG_SIZE]; /* last replayed rec seq */
|
||||
uint64_t zl_replaying_seq; /* current replay seq number */
|
||||
uint32_t zl_suspend; /* log suspend count */
|
||||
kcondvar_t zl_cv_writer; /* log writer thread completion */
|
||||
kcondvar_t zl_cv_suspend; /* log suspend completion */
|
||||
uint8_t zl_suspending; /* log is currently suspending */
|
||||
uint8_t zl_keep_first; /* keep first log block in destroy */
|
||||
uint8_t zl_replay; /* replaying records while set */
|
||||
uint8_t zl_stop_sync; /* for debugging */
|
||||
uint8_t zl_writer; /* boolean: write setup in progress */
|
||||
kmutex_t zl_writer_lock; /* single writer, per ZIL, at a time */
|
||||
uint8_t zl_logbias; /* latency or throughput */
|
||||
uint8_t zl_sync; /* synchronous or asynchronous */
|
||||
int zl_parse_error; /* last zil_parse() error */
|
||||
@ -115,15 +169,10 @@ struct zilog {
|
||||
uint64_t zl_parse_lr_seq; /* highest lr seq on last parse */
|
||||
uint64_t zl_parse_blk_count; /* number of blocks parsed */
|
||||
uint64_t zl_parse_lr_count; /* number of log records parsed */
|
||||
uint64_t zl_next_batch; /* next batch number */
|
||||
uint64_t zl_com_batch; /* committed batch number */
|
||||
kcondvar_t zl_cv_batch[2]; /* batch condition variables */
|
||||
itxg_t zl_itxg[TXG_SIZE]; /* intent log txg chains */
|
||||
list_t zl_itx_commit_list; /* itx list to be committed */
|
||||
uint64_t zl_cur_used; /* current commit log size used */
|
||||
list_t zl_lwb_list; /* in-flight log write list */
|
||||
kmutex_t zl_vdev_lock; /* protects zl_vdev_tree */
|
||||
avl_tree_t zl_vdev_tree; /* vdevs to flush in zil_commit() */
|
||||
avl_tree_t zl_bp_tree; /* track bps during log parse */
|
||||
clock_t zl_replay_time; /* lbolt of when replay started */
|
||||
uint64_t zl_replay_blks; /* number of log blocks replayed */
|
||||
@ -131,6 +180,7 @@ struct zilog {
|
||||
uint_t zl_prev_blks[ZIL_PREV_BLKS]; /* size - sector rounded */
|
||||
uint_t zl_prev_rotor; /* rotor for zl_prev[] */
|
||||
txg_node_t zl_dirty_link; /* protected by dp_dirty_zilogs list */
|
||||
uint64_t zl_dirty_max_txg; /* highest txg used to dirty zilog */
|
||||
};
|
||||
|
||||
typedef struct zil_bp_node {
|
||||
|
@ -556,6 +556,7 @@ extern enum zio_checksum zio_checksum_dedup_select(spa_t *spa,
|
||||
extern enum zio_compress zio_compress_select(spa_t *spa,
|
||||
enum zio_compress child, enum zio_compress parent);
|
||||
|
||||
extern void zio_cancel(zio_t *zio);
|
||||
extern void zio_suspend(spa_t *spa, zio_t *zio);
|
||||
extern int zio_resume(spa_t *spa);
|
||||
extern void zio_resume_wait(spa_t *spa);
|
||||
|
@ -158,7 +158,7 @@ txg_fini(dsl_pool_t *dp)
|
||||
tx_state_t *tx = &dp->dp_tx;
|
||||
int c;
|
||||
|
||||
ASSERT(tx->tx_threads == 0);
|
||||
ASSERT0(tx->tx_threads);
|
||||
|
||||
mutex_destroy(&tx->tx_sync_lock);
|
||||
|
||||
@ -199,7 +199,7 @@ txg_sync_start(dsl_pool_t *dp)
|
||||
|
||||
dprintf("pool %p\n", dp);
|
||||
|
||||
ASSERT(tx->tx_threads == 0);
|
||||
ASSERT0(tx->tx_threads);
|
||||
|
||||
tx->tx_threads = 2;
|
||||
|
||||
@ -261,7 +261,7 @@ txg_sync_stop(dsl_pool_t *dp)
|
||||
/*
|
||||
* Finish off any work in progress.
|
||||
*/
|
||||
ASSERT(tx->tx_threads == 2);
|
||||
ASSERT3U(tx->tx_threads, ==, 2);
|
||||
|
||||
/*
|
||||
* We need to ensure that we've vacated the deferred space_maps.
|
||||
@ -273,7 +273,7 @@ txg_sync_stop(dsl_pool_t *dp)
|
||||
*/
|
||||
mutex_enter(&tx->tx_sync_lock);
|
||||
|
||||
ASSERT(tx->tx_threads == 2);
|
||||
ASSERT3U(tx->tx_threads, ==, 2);
|
||||
|
||||
tx->tx_exiting = 1;
|
||||
|
||||
@ -608,7 +608,7 @@ txg_wait_synced(dsl_pool_t *dp, uint64_t txg)
|
||||
ASSERT(!dsl_pool_config_held(dp));
|
||||
|
||||
mutex_enter(&tx->tx_sync_lock);
|
||||
ASSERT(tx->tx_threads == 2);
|
||||
ASSERT3U(tx->tx_threads, ==, 2);
|
||||
if (txg == 0)
|
||||
txg = tx->tx_open_txg + TXG_DEFER_SIZE;
|
||||
if (tx->tx_sync_txg_waiting < txg)
|
||||
@ -633,7 +633,7 @@ txg_wait_open(dsl_pool_t *dp, uint64_t txg)
|
||||
ASSERT(!dsl_pool_config_held(dp));
|
||||
|
||||
mutex_enter(&tx->tx_sync_lock);
|
||||
ASSERT(tx->tx_threads == 2);
|
||||
ASSERT3U(tx->tx_threads, ==, 2);
|
||||
if (txg == 0)
|
||||
txg = tx->tx_open_txg + 1;
|
||||
if (tx->tx_quiesce_txg_waiting < txg)
|
||||
|
@ -83,6 +83,7 @@
|
||||
#include <sys/kidmap.h>
|
||||
#include <sys/cred.h>
|
||||
#include <sys/attr.h>
|
||||
#include <sys/zil.h>
|
||||
|
||||
/*
|
||||
* Programming rules.
|
||||
@ -1032,7 +1033,7 @@ zfs_get_done(zgd_t *zgd, int error)
|
||||
VN_RELE_ASYNC(ZTOV(zp), dsl_pool_vnrele_taskq(dmu_objset_pool(os)));
|
||||
|
||||
if (error == 0 && zgd->zgd_bp)
|
||||
zil_add_block(zgd->zgd_zilog, zgd->zgd_bp);
|
||||
zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp);
|
||||
|
||||
kmem_free(zgd, sizeof (zgd_t));
|
||||
}
|
||||
@ -1045,7 +1046,7 @@ static int zil_fault_io = 0;
|
||||
* Get data to generate a TX_WRITE intent log record.
|
||||
*/
|
||||
int
|
||||
zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
|
||||
zfs_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb, zio_t *zio)
|
||||
{
|
||||
zfsvfs_t *zfsvfs = arg;
|
||||
objset_t *os = zfsvfs->z_os;
|
||||
@ -1057,8 +1058,9 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
|
||||
zgd_t *zgd;
|
||||
int error = 0;
|
||||
|
||||
ASSERT(zio != NULL);
|
||||
ASSERT(size != 0);
|
||||
ASSERT3P(lwb, !=, NULL);
|
||||
ASSERT3P(zio, !=, NULL);
|
||||
ASSERT3U(size, !=, 0);
|
||||
|
||||
/*
|
||||
* Nothing to do if the file has been removed
|
||||
@ -1076,7 +1078,7 @@ zfs_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
|
||||
}
|
||||
|
||||
zgd = (zgd_t *)kmem_zalloc(sizeof (zgd_t), KM_SLEEP);
|
||||
zgd->zgd_zilog = zfsvfs->z_log;
|
||||
zgd->zgd_lwb = lwb;
|
||||
zgd->zgd_private = zp;
|
||||
|
||||
/*
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -397,7 +397,7 @@ zio_add_child(zio_t *pio, zio_t *cio)
|
||||
* Vdev I/Os can only have vdev children.
|
||||
* The following ASSERT captures all of these constraints.
|
||||
*/
|
||||
ASSERT(cio->io_child_type <= pio->io_child_type);
|
||||
ASSERT3S(cio->io_child_type, <=, pio->io_child_type);
|
||||
|
||||
zl->zl_parent = pio;
|
||||
zl->zl_child = cio;
|
||||
@ -1101,9 +1101,9 @@ zio_flush(zio_t *zio, vdev_t *vd)
|
||||
void
|
||||
zio_shrink(zio_t *zio, uint64_t size)
|
||||
{
|
||||
ASSERT(zio->io_executor == NULL);
|
||||
ASSERT(zio->io_orig_size == zio->io_size);
|
||||
ASSERT(size <= zio->io_size);
|
||||
ASSERT3P(zio->io_executor, ==, NULL);
|
||||
ASSERT3P(zio->io_orig_size, ==, zio->io_size);
|
||||
ASSERT3U(size, <=, zio->io_size);
|
||||
|
||||
/*
|
||||
* We don't shrink for raidz because of problems with the
|
||||
@ -1614,8 +1614,8 @@ zio_wait(zio_t *zio)
|
||||
{
|
||||
int error;
|
||||
|
||||
ASSERT(zio->io_stage == ZIO_STAGE_OPEN);
|
||||
ASSERT(zio->io_executor == NULL);
|
||||
ASSERT3P(zio->io_stage, ==, ZIO_STAGE_OPEN);
|
||||
ASSERT3P(zio->io_executor, ==, NULL);
|
||||
|
||||
zio->io_waiter = curthread;
|
||||
ASSERT0(zio->io_queued_timestamp);
|
||||
@ -1637,7 +1637,7 @@ zio_wait(zio_t *zio)
|
||||
void
|
||||
zio_nowait(zio_t *zio)
|
||||
{
|
||||
ASSERT(zio->io_executor == NULL);
|
||||
ASSERT3P(zio->io_executor, ==, NULL);
|
||||
|
||||
if (zio->io_child_type == ZIO_CHILD_LOGICAL &&
|
||||
zio_unique_parent(zio) == NULL) {
|
||||
@ -1658,7 +1658,7 @@ zio_nowait(zio_t *zio)
|
||||
|
||||
/*
|
||||
* ==========================================================================
|
||||
* Reexecute or suspend/resume failed I/O
|
||||
* Reexecute, cancel, or suspend/resume failed I/O
|
||||
* ==========================================================================
|
||||
*/
|
||||
|
||||
@ -1715,6 +1715,20 @@ zio_reexecute(zio_t *pio)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
zio_cancel(zio_t *zio)
|
||||
{
|
||||
/*
|
||||
* Disallow cancellation of a zio that's already been issued.
|
||||
*/
|
||||
VERIFY3P(zio->io_executor, ==, NULL);
|
||||
|
||||
zio->io_pipeline = ZIO_INTERLOCK_PIPELINE;
|
||||
zio->io_done = NULL;
|
||||
|
||||
zio_nowait(zio);
|
||||
}
|
||||
|
||||
void
|
||||
zio_suspend(spa_t *spa, zio_t *zio)
|
||||
{
|
||||
@ -2947,6 +2961,9 @@ zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, blkptr_t *old_bp,
|
||||
BP_SET_LEVEL(new_bp, 0);
|
||||
BP_SET_DEDUP(new_bp, 0);
|
||||
BP_SET_BYTEORDER(new_bp, ZFS_HOST_BYTEORDER);
|
||||
} else {
|
||||
zfs_dbgmsg("%s: zil block allocation failure: "
|
||||
"size %llu, error %d", spa_name(spa), size, error);
|
||||
}
|
||||
|
||||
return (error);
|
||||
|
@ -88,6 +88,7 @@
|
||||
#include <sys/dmu_tx.h>
|
||||
#include <sys/zfeature.h>
|
||||
#include <sys/zio_checksum.h>
|
||||
#include <sys/zil_impl.h>
|
||||
|
||||
#include "zfs_namecheck.h"
|
||||
|
||||
@ -157,7 +158,8 @@ boolean_t zvol_unmap_sync_enabled = B_FALSE;
|
||||
extern int zfs_set_prop_nvlist(const char *, zprop_source_t,
|
||||
nvlist_t *, nvlist_t *);
|
||||
static int zvol_remove_zv(zvol_state_t *);
|
||||
static int zvol_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio);
|
||||
static int zvol_get_data(void *arg, lr_write_t *lr, char *buf,
|
||||
struct lwb *lwb, zio_t *zio);
|
||||
static int zvol_dumpify(zvol_state_t *zv);
|
||||
static int zvol_dump_fini(zvol_state_t *zv);
|
||||
static int zvol_dump_init(zvol_state_t *zv, boolean_t resize);
|
||||
@ -975,7 +977,7 @@ zvol_get_done(zgd_t *zgd, int error)
|
||||
zfs_range_unlock(zgd->zgd_rl);
|
||||
|
||||
if (error == 0 && zgd->zgd_bp)
|
||||
zil_add_block(zgd->zgd_zilog, zgd->zgd_bp);
|
||||
zil_lwb_add_block(zgd->zgd_lwb, zgd->zgd_bp);
|
||||
|
||||
kmem_free(zgd, sizeof (zgd_t));
|
||||
}
|
||||
@ -984,7 +986,7 @@ zvol_get_done(zgd_t *zgd, int error)
|
||||
* Get data to generate a TX_WRITE intent log record.
|
||||
*/
|
||||
static int
|
||||
zvol_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
|
||||
zvol_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb, zio_t *zio)
|
||||
{
|
||||
zvol_state_t *zv = arg;
|
||||
objset_t *os = zv->zv_objset;
|
||||
@ -995,11 +997,12 @@ zvol_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio)
|
||||
zgd_t *zgd;
|
||||
int error;
|
||||
|
||||
ASSERT(zio != NULL);
|
||||
ASSERT(size != 0);
|
||||
ASSERT3P(lwb, !=, NULL);
|
||||
ASSERT3P(zio, !=, NULL);
|
||||
ASSERT3U(size, !=, 0);
|
||||
|
||||
zgd = kmem_zalloc(sizeof (zgd_t), KM_SLEEP);
|
||||
zgd->zgd_zilog = zv->zv_zilog;
|
||||
zgd->zgd_lwb = lwb;
|
||||
zgd->zgd_rl = zfs_range_lock(&zv->zv_znode, offset, size, RL_READER);
|
||||
|
||||
/*
|
||||
|
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2012, 2017 by Delphix. All rights reserved.
|
||||
* Copyright 2013 Saso Kiselkov. All rights reserved.
|
||||
*/
|
||||
|
||||
@ -108,17 +108,20 @@ extern void assfail3(const char *, uintmax_t, const char *, uintmax_t,
|
||||
__FILE__, __LINE__); \
|
||||
_NOTE(CONSTCOND) } while (0)
|
||||
|
||||
#define VERIFY3B(x, y, z) VERIFY3_IMPL(x, y, z, boolean_t)
|
||||
#define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t)
|
||||
#define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t)
|
||||
#define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t)
|
||||
#define VERIFY0(x) VERIFY3_IMPL(x, ==, 0, uintmax_t)
|
||||
|
||||
#if DEBUG
|
||||
#define ASSERT3B(x, y, z) VERIFY3_IMPL(x, y, z, boolean_t)
|
||||
#define ASSERT3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t)
|
||||
#define ASSERT3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t)
|
||||
#define ASSERT3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t)
|
||||
#define ASSERT0(x) VERIFY3_IMPL(x, ==, 0, uintmax_t)
|
||||
#else
|
||||
#define ASSERT3B(x, y, z) ((void)0)
|
||||
#define ASSERT3S(x, y, z) ((void)0)
|
||||
#define ASSERT3U(x, y, z) ((void)0)
|
||||
#define ASSERT3P(x, y, z) ((void)0)
|
||||
|
Loading…
Reference in New Issue
Block a user