Mercurial > illumos > illumos-gate
changeset 10879:420834d9266b
6849167 40% write regression with multiple shares
6706578 a single zil writer should not abuse the slog
author | Neil Perrin <Neil.Perrin@Sun.COM> |
---|---|
date | Mon, 26 Oct 2009 15:41:53 -0600 |
parents | 6ecfd56a37e4 |
children | 94b6193debfc |
files | usr/src/uts/common/fs/zfs/sys/zio.h usr/src/uts/common/fs/zfs/zil.c usr/src/uts/common/fs/zfs/zio.c |
diffstat | 3 files changed, 16 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/sys/zio.h Mon Oct 26 21:20:13 2009 -0700 +++ b/usr/src/uts/common/fs/zfs/sys/zio.h Mon Oct 26 15:41:53 2009 -0600 @@ -418,7 +418,7 @@ 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);
--- a/usr/src/uts/common/fs/zfs/zil.c Mon Oct 26 21:20:13 2009 -0700 +++ b/usr/src/uts/common/fs/zfs/zil.c Mon Oct 26 15:41:53 2009 -0600 @@ -369,7 +369,7 @@ } 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 @@ } /* + * 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 @@ 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 @@ 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); }
--- a/usr/src/uts/common/fs/zfs/zio.c Mon Oct 26 21:20:13 2009 -0700 +++ b/usr/src/uts/common/fs/zfs/zio.c Mon Oct 26 15:41:53 2009 -0600 @@ -1716,11 +1716,11 @@ */ 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);