diff options
author | mav <mav@FreeBSD.org> | 2015-10-03 07:58:28 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-10-03 07:58:28 +0000 |
commit | 8cd1ef567defef55434d33170fc041021cc8d1ea (patch) | |
tree | f1e7171f8d52c71705ace48d8cd960cbf8b1c920 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c | |
parent | 2c79b8a95c3e6434e650abc47b8b228b7ea1e29b (diff) | |
download | FreeBSD-src-8cd1ef567defef55434d33170fc041021cc8d1ea.zip FreeBSD-src-8cd1ef567defef55434d33170fc041021cc8d1ea.tar.gz |
MFC r286686: 5269 zpool import slow
illumos/illumos-gate@12380e1e701fda28c9e9f32d01cafb54af279eb5
https://www.illumos.org/issues/5269
When importing a pool (at boot or with zpool import) with many
filesystem, the process can take minutes. It doesn't matter whether
the pool has been exported cleanly or uncleanly. The problem is that
each dataset has its own log chain. On import, all datasets have to be
checked if there are logs to replay. The idea is to speed up this
process by paralellizing it.
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Arne Jansen <jansen@webgods.de>
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c index f9e5e3d..32a9ee7 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c @@ -639,7 +639,7 @@ zil_destroy_sync(zilog_t *zilog, dmu_tx_t *tx) } int -zil_claim(const char *osname, void *txarg) +zil_claim(dsl_pool_t *dp, dsl_dataset_t *ds, void *txarg) { dmu_tx_t *tx = txarg; uint64_t first_txg = dmu_tx_get_txg(tx); @@ -648,15 +648,16 @@ zil_claim(const char *osname, void *txarg) objset_t *os; int error; - error = dmu_objset_own(osname, DMU_OST_ANY, B_FALSE, FTAG, &os); + error = dmu_objset_own_obj(dp, ds->ds_object, + DMU_OST_ANY, B_FALSE, FTAG, &os); if (error != 0) { /* * EBUSY indicates that the objset is inconsistent, in which * case it can not have a ZIL. */ if (error != EBUSY) { - cmn_err(CE_WARN, "can't open objset for %s, error %u", - osname, error); + cmn_err(CE_WARN, "can't open objset for %llu, error %u", + (unsigned long long)ds->ds_object, error); } return (0); } @@ -703,8 +704,9 @@ zil_claim(const char *osname, void *txarg) * Checksum errors are ok as they indicate the end of the chain. * Any other error (no device or read failure) returns an error. */ +/* ARGSUSED */ int -zil_check_log_chain(const char *osname, void *tx) +zil_check_log_chain(dsl_pool_t *dp, dsl_dataset_t *ds, void *tx) { zilog_t *zilog; objset_t *os; @@ -713,9 +715,10 @@ zil_check_log_chain(const char *osname, void *tx) ASSERT(tx == NULL); - error = dmu_objset_hold(osname, FTAG, &os); + error = dmu_objset_from_ds(ds, &os); if (error != 0) { - cmn_err(CE_WARN, "can't open objset for %s", osname); + cmn_err(CE_WARN, "can't open objset %llu, error %d", + (unsigned long long)ds->ds_object, error); return (0); } @@ -738,10 +741,8 @@ zil_check_log_chain(const char *osname, void *tx) valid = vdev_log_state_valid(vd); spa_config_exit(os->os_spa, SCL_STATE, FTAG); - if (!valid) { - dmu_objset_rele(os, FTAG); + if (!valid) return (0); - } } /* @@ -754,8 +755,6 @@ zil_check_log_chain(const char *osname, void *tx) error = zil_parse(zilog, zil_claim_log_block, zil_claim_log_record, tx, zilog->zl_header->zh_claim_txg ? -1ULL : spa_first_txg(os->os_spa)); - dmu_objset_rele(os, FTAG); - return ((error == ECKSUM || error == ENOENT) ? 0 : error); } |