Print this page
5269 zfs: zpool import slow
While importing a pool all objsets are enumerated twice, once to check
the zil log chains and once to claim them. On pools with many datasets
this process might take a substantial amount of time.
Speed up the process by parallelizing it utilizing a taskq. The number
of parallel tasks is limited to 4 times the number of leaf vdevs.


  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2012 by Delphix. All rights reserved.
  24  */
  25 
  26 /* Portions Copyright 2010 Robert Milkowski */
  27 
  28 #ifndef _SYS_ZIL_H
  29 #define _SYS_ZIL_H
  30 
  31 #include <sys/types.h>
  32 #include <sys/spa.h>
  33 #include <sys/zio.h>
  34 #include <sys/dmu.h>


  35 
  36 #ifdef  __cplusplus
  37 extern "C" {
  38 #endif
  39 
  40 /*
  41  * Intent log format:
  42  *
  43  * Each objset has its own intent log.  The log header (zil_header_t)
  44  * for objset N's intent log is kept in the Nth object of the SPA's
  45  * intent_log objset.  The log header points to a chain of log blocks,
  46  * each of which contains log records (i.e., transactions) followed by
  47  * a log block trailer (zil_trailer_t).  The format of a log record
  48  * depends on the record (or transaction) type, but all records begin
  49  * with a common structure that defines the type, length, and txg.
  50  */
  51 
  52 /*
  53  * Intent log header - this on disk structure holds fields to manage
  54  * the log.  All fields are 64 bit to easily handle cross architectures.


 388 extern zilog_t  *zil_alloc(objset_t *os, zil_header_t *zh_phys);
 389 extern void     zil_free(zilog_t *zilog);
 390 
 391 extern zilog_t  *zil_open(objset_t *os, zil_get_data_t *get_data);
 392 extern void     zil_close(zilog_t *zilog);
 393 
 394 extern void     zil_replay(objset_t *os, void *arg,
 395     zil_replay_func_t *replay_func[TX_MAX_TYPE]);
 396 extern boolean_t zil_replaying(zilog_t *zilog, dmu_tx_t *tx);
 397 extern void     zil_destroy(zilog_t *zilog, boolean_t keep_first);
 398 extern void     zil_destroy_sync(zilog_t *zilog, dmu_tx_t *tx);
 399 extern void     zil_rollback_destroy(zilog_t *zilog, dmu_tx_t *tx);
 400 
 401 extern itx_t    *zil_itx_create(uint64_t txtype, size_t lrsize);
 402 extern void     zil_itx_destroy(itx_t *itx);
 403 extern void     zil_itx_assign(zilog_t *zilog, itx_t *itx, dmu_tx_t *tx);
 404 
 405 extern void     zil_commit(zilog_t *zilog, uint64_t oid);
 406 
 407 extern int      zil_vdev_offline(const char *osname, void *txarg);
 408 extern int      zil_claim(const char *osname, void *txarg);
 409 extern int      zil_check_log_chain(const char *osname, void *txarg);

 410 extern void     zil_sync(zilog_t *zilog, dmu_tx_t *tx);
 411 extern void     zil_clean(zilog_t *zilog, uint64_t synced_txg);
 412 
 413 extern int      zil_suspend(const char *osname, void **cookiep);
 414 extern void     zil_resume(void *cookie);
 415 
 416 extern void     zil_add_block(zilog_t *zilog, const blkptr_t *bp);
 417 extern int      zil_bp_tree_add(zilog_t *zilog, const blkptr_t *bp);
 418 
 419 extern void     zil_set_sync(zilog_t *zilog, uint64_t syncval);
 420 
 421 extern void     zil_set_logbias(zilog_t *zilog, uint64_t slogval);
 422 
 423 extern int zil_replay_disable;
 424 
 425 #ifdef  __cplusplus
 426 }
 427 #endif
 428 
 429 #endif  /* _SYS_ZIL_H */


  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2012 by Delphix. All rights reserved.
  24  */
  25 
  26 /* Portions Copyright 2010 Robert Milkowski */
  27 
  28 #ifndef _SYS_ZIL_H
  29 #define _SYS_ZIL_H
  30 
  31 #include <sys/types.h>
  32 #include <sys/spa.h>
  33 #include <sys/zio.h>
  34 #include <sys/dmu.h>
  35 #include <sys/dsl_pool.h>
  36 #include <sys/dsl_dataset.h>
  37 
  38 #ifdef  __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 /*
  43  * Intent log format:
  44  *
  45  * Each objset has its own intent log.  The log header (zil_header_t)
  46  * for objset N's intent log is kept in the Nth object of the SPA's
  47  * intent_log objset.  The log header points to a chain of log blocks,
  48  * each of which contains log records (i.e., transactions) followed by
  49  * a log block trailer (zil_trailer_t).  The format of a log record
  50  * depends on the record (or transaction) type, but all records begin
  51  * with a common structure that defines the type, length, and txg.
  52  */
  53 
  54 /*
  55  * Intent log header - this on disk structure holds fields to manage
  56  * the log.  All fields are 64 bit to easily handle cross architectures.


 390 extern zilog_t  *zil_alloc(objset_t *os, zil_header_t *zh_phys);
 391 extern void     zil_free(zilog_t *zilog);
 392 
 393 extern zilog_t  *zil_open(objset_t *os, zil_get_data_t *get_data);
 394 extern void     zil_close(zilog_t *zilog);
 395 
 396 extern void     zil_replay(objset_t *os, void *arg,
 397     zil_replay_func_t *replay_func[TX_MAX_TYPE]);
 398 extern boolean_t zil_replaying(zilog_t *zilog, dmu_tx_t *tx);
 399 extern void     zil_destroy(zilog_t *zilog, boolean_t keep_first);
 400 extern void     zil_destroy_sync(zilog_t *zilog, dmu_tx_t *tx);
 401 extern void     zil_rollback_destroy(zilog_t *zilog, dmu_tx_t *tx);
 402 
 403 extern itx_t    *zil_itx_create(uint64_t txtype, size_t lrsize);
 404 extern void     zil_itx_destroy(itx_t *itx);
 405 extern void     zil_itx_assign(zilog_t *zilog, itx_t *itx, dmu_tx_t *tx);
 406 
 407 extern void     zil_commit(zilog_t *zilog, uint64_t oid);
 408 
 409 extern int      zil_vdev_offline(const char *osname, void *txarg);
 410 extern int      zil_claim(dsl_pool_t *dp, dsl_dataset_t *ds, void *txarg);
 411 extern int      zil_check_log_chain(dsl_pool_t *dp, dsl_dataset_t *ds,
 412     void *tx);
 413 extern void     zil_sync(zilog_t *zilog, dmu_tx_t *tx);
 414 extern void     zil_clean(zilog_t *zilog, uint64_t synced_txg);
 415 
 416 extern int      zil_suspend(const char *osname, void **cookiep);
 417 extern void     zil_resume(void *cookie);
 418 
 419 extern void     zil_add_block(zilog_t *zilog, const blkptr_t *bp);
 420 extern int      zil_bp_tree_add(zilog_t *zilog, const blkptr_t *bp);
 421 
 422 extern void     zil_set_sync(zilog_t *zilog, uint64_t syncval);
 423 
 424 extern void     zil_set_logbias(zilog_t *zilog, uint64_t slogval);
 425 
 426 extern int zil_replay_disable;
 427 
 428 #ifdef  __cplusplus
 429 }
 430 #endif
 431 
 432 #endif  /* _SYS_ZIL_H */