summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorNeil Perrin <Neil.Perrin@Sun.COM>2009-10-26 15:41:53 -0600
committerNeil Perrin <Neil.Perrin@Sun.COM>2009-10-26 15:41:53 -0600
commitd48e086f569202b5e178a2f514b8bd9d44c7efe2 (patch)
tree7c6c0328c096eb9d8be07ca35137c2c5170a100f /usr/src
parent437be37266d159c6a27c02e61710a578bef3d15f (diff)
downloadillumos-gate-d48e086f569202b5e178a2f514b8bd9d44c7efe2.tar.gz
6849167 40% write regression with multiple shares
6706578 a single zil writer should not abuse the slog
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/fs/zfs/sys/zio.h2
-rw-r--r--usr/src/uts/common/fs/zfs/zil.c16
-rw-r--r--usr/src/uts/common/fs/zfs/zio.c4
3 files changed, 16 insertions, 6 deletions
diff --git a/usr/src/uts/common/fs/zfs/sys/zio.h b/usr/src/uts/common/fs/zfs/sys/zio.h
index 874ec2820a..ff2a597f73 100644
--- a/usr/src/uts/common/fs/zfs/sys/zio.h
+++ b/usr/src/uts/common/fs/zfs/sys/zio.h
@@ -418,7 +418,7 @@ extern zio_t *zio_write_phys(zio_t *pio, vdev_t *vd, uint64_t offset,
boolean_t labels);
extern int zio_alloc_blk(spa_t *spa, uint64_t size, blkptr_t *new_bp,
- blkptr_t *old_bp, uint64_t txg, boolean_t bypass_slog);
+ blkptr_t *old_bp, uint64_t txg, boolean_t use_slog);
extern void zio_free_blk(spa_t *spa, blkptr_t *bp, uint64_t txg);
extern void zio_flush(zio_t *zio, vdev_t *vd);
diff --git a/usr/src/uts/common/fs/zfs/zil.c b/usr/src/uts/common/fs/zfs/zil.c
index ff13d9ab6b..d10c6f03b6 100644
--- a/usr/src/uts/common/fs/zfs/zil.c
+++ b/usr/src/uts/common/fs/zfs/zil.c
@@ -369,7 +369,7 @@ zil_create(zilog_t *zilog)
}
error = zio_alloc_blk(zilog->zl_spa, ZIL_MIN_BLKSZ, &blk,
- NULL, txg, zilog->zl_logbias != ZFS_LOGBIAS_LATENCY);
+ NULL, txg, zilog->zl_logbias == ZFS_LOGBIAS_LATENCY);
if (error == 0)
zil_init_log_chain(zilog, &blk);
@@ -756,6 +756,16 @@ zil_lwb_write_init(zilog_t *zilog, lwb_t *lwb)
}
/*
+ * Use the slog as long as the logbias is 'latency' and the current commit size
+ * is less than the limit or the total list size is less than 2X the limit.
+ * Limit checking is disabled by setting zil_slog_limit to UINT64_MAX.
+ */
+uint64_t zil_slog_limit = 1024 * 1024;
+#define USE_SLOG(zilog) (((zilog)->zl_logbias == ZFS_LOGBIAS_LATENCY) && \
+ (((zilog)->zl_cur_used < zil_slog_limit) || \
+ ((zilog)->zl_itx_list_sz < (zil_slog_limit << 1))))
+
+/*
* Start a log block write and advance to the next log block.
* Calls are serialized.
*/
@@ -797,7 +807,7 @@ zil_lwb_write_start(zilog_t *zilog, lwb_t *lwb)
BP_ZERO(bp);
/* pass the old blkptr in order to spread log blocks across devs */
error = zio_alloc_blk(spa, zil_blksz, bp, &lwb->lwb_blk, txg,
- zilog->zl_logbias != ZFS_LOGBIAS_LATENCY);
+ USE_SLOG(zilog));
if (error) {
dmu_tx_t *tx = dmu_tx_create_assigned(zilog->zl_dmu_pool, txg);
@@ -1042,7 +1052,7 @@ zil_clean(zilog_t *zilog)
if ((itx != NULL) &&
(itx->itx_lr.lrc_txg <= spa_last_synced_txg(zilog->zl_spa))) {
(void) taskq_dispatch(zilog->zl_clean_taskq,
- (task_func_t *)zil_itx_clean, zilog, TQ_SLEEP);
+ (task_func_t *)zil_itx_clean, zilog, TQ_NOSLEEP);
}
mutex_exit(&zilog->zl_lock);
}
diff --git a/usr/src/uts/common/fs/zfs/zio.c b/usr/src/uts/common/fs/zfs/zio.c
index 98c593e375..c7eb4e61b5 100644
--- a/usr/src/uts/common/fs/zfs/zio.c
+++ b/usr/src/uts/common/fs/zfs/zio.c
@@ -1716,11 +1716,11 @@ zio_dva_unallocate(zio_t *zio, zio_gang_node_t *gn, blkptr_t *bp)
*/
int
zio_alloc_blk(spa_t *spa, uint64_t size, blkptr_t *new_bp, blkptr_t *old_bp,
- uint64_t txg, boolean_t bypass_slog)
+ uint64_t txg, boolean_t use_slog)
{
int error = 1;
- if (!bypass_slog)
+ if (use_slog)
error = metaslab_alloc(spa, spa->spa_log_class, size,
new_bp, 1, txg, old_bp, METASLAB_HINTBP_AVOID);