Print this page
5269 zfs: zpool import slow
PORTING: this code relies on the property of taskq_wait to wait
until no more tasks are queued and no more tasks are active. As
we always queue new tasks from within other tasks, task_wait
reliably waits for the full recursion to finish, even though we
enqueue new tasks after taskq_wait has been called.
On platforms other than illumos, taskq_wait may not have this
property.
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: George Wilson <george.wilson@delphix.com>


  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.
  55  */
  56 typedef struct zil_header {
  57         uint64_t zh_claim_txg;  /* txg in which log blocks were claimed */
  58         uint64_t zh_replay_seq; /* highest replayed sequence number */
  59         blkptr_t zh_log;        /* log chain */


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


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


  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 struct dsl_pool;
  41 struct dsl_dataset;
  42 
  43 /*
  44  * Intent log format:
  45  *
  46  * Each objset has its own intent log.  The log header (zil_header_t)
  47  * for objset N's intent log is kept in the Nth object of the SPA's
  48  * intent_log objset.  The log header points to a chain of log blocks,
  49  * each of which contains log records (i.e., transactions) followed by
  50  * a log block trailer (zil_trailer_t).  The format of a log record
  51  * depends on the record (or transaction) type, but all records begin
  52  * with a common structure that defines the type, length, and txg.
  53  */
  54 
  55 /*
  56  * Intent log header - this on disk structure holds fields to manage
  57  * the log.  All fields are 64 bit to easily handle cross architectures.
  58  */
  59 typedef struct zil_header {
  60         uint64_t zh_claim_txg;  /* txg in which log blocks were claimed */
  61         uint64_t zh_replay_seq; /* highest replayed sequence number */
  62         blkptr_t zh_log;        /* log chain */


 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(struct dsl_pool *dp,
 411     struct dsl_dataset *ds, void *txarg);
 412 extern int      zil_check_log_chain(struct dsl_pool *dp,
 413     struct dsl_dataset *ds, void *tx);
 414 extern void     zil_sync(zilog_t *zilog, dmu_tx_t *tx);
 415 extern void     zil_clean(zilog_t *zilog, uint64_t synced_txg);
 416 
 417 extern int      zil_suspend(const char *osname, void **cookiep);
 418 extern void     zil_resume(void *cookie);
 419 
 420 extern void     zil_add_block(zilog_t *zilog, const blkptr_t *bp);
 421 extern int      zil_bp_tree_add(zilog_t *zilog, const blkptr_t *bp);
 422 
 423 extern void     zil_set_sync(zilog_t *zilog, uint64_t syncval);
 424 
 425 extern void     zil_set_logbias(zilog_t *zilog, uint64_t slogval);
 426 
 427 extern int zil_replay_disable;
 428 
 429 #ifdef  __cplusplus
 430 }
 431 #endif
 432 
 433 #endif  /* _SYS_ZIL_H */