Skip to content
Permalink
Browse files

OpenZFS 9166 - zfs storage pool checkpoint

Details about the motivation of this feature and its usage can
be found in this blogpost:

    https://sdimitro.github.io/post/zpool-checkpoint/

A lightning talk of this feature can be found here:
https://www.youtube.com/watch?v=fPQA8K40jAM

Implementation details can be found in big block comment of
spa_checkpoint.c

Side-changes that are relevant to this commit but not explained
elsewhere:

* renames members of "struct metaslab trees to be shorter without
  losing meaning

* space_map_{alloc,truncate}() accept a block size as a
  parameter. The reason is that in the current state all space
  maps that we allocate through the DMU use a global tunable
  (space_map_blksz) which defauls to 4KB. This is ok for metaslab
  space maps in terms of bandwirdth since they are scattered all
  over the disk. But for other space maps this default is probably
  not what we want. Examples are device removal's vdev_obsolete_sm
  or vdev_chedkpoint_sm from this review. Both of these have a
  1:1 relationship with each vdev and could benefit from a bigger
  block size.

Porting notes:

* The part of dsl_scan_sync() which handles async destroys has
  been moved into the new dsl_process_async_destroys() function.

* Remove "VERIFY(!(flags & FWRITE))" in "kernel.c" so zhack can write
  to block device backed pools.

* ZTS:
  * Fix get_txg() in zpool_sync_001_pos due to "checkpoint_txg".

  * Don't use large dd block sizes on /dev/urandom under Linux in
    checkpoint_capacity.

  * Adopt Delphix-OS's setting of 4 (spa_asize_inflation =
    SPA_DVAS_PER_BP + 1) for the checkpoint_capacity test to speed
    its attempts to fill the pool

  * Create the base and nested pools with sync=disabled to speed up
    the "setup" phase.

  * Clear labels in test pool between checkpoint tests to avoid
    duplicate pool issues.

  * The import_rewind_device_replaced test has been marked as "known
    to fail" for the reasons listed in its DISCLAIMER.

  * New module parameters:

      zfs_spa_discard_memory_limit,
      zfs_remove_max_bytes_pause (not documented - debugging only)
      vdev_max_ms_count (formerly metaslabs_per_vdev)
      vdev_min_ms_count

Authored by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Approved by: Richard Lowe <richlowe@richlowe.net>
Ported-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Tim Chase <tim@chase2k.com>

OpenZFS-issue: https://illumos.org/issues/9166
OpenZFS-commit: openzfs/openzfs@7159fdb
Closes #7570
  • Loading branch information...
sdimitro authored and behlendorf committed Dec 16, 2016
1 parent 88eaf61 commit d2734cce68cf740e015312314415f9034c67851c
Showing with 5,959 additions and 820 deletions.
  1. +733 −120 cmd/zdb/zdb.c
  2. +9 −3 cmd/zdb/zdb_il.c
  3. +207 −8 cmd/zpool/zpool_main.c
  4. +104 −9 cmd/ztest/ztest.c
  5. +2 −0 configure.ac
  6. +7 −0 include/libzfs.h
  7. +3 −0 include/libzfs_core.h
  8. +1 −0 include/sys/Makefile.am
  9. +1 −0 include/sys/dmu.h
  10. +2 −1 include/sys/dsl_dir.h
  11. +7 −1 include/sys/dsl_pool.h
  12. +36 −5 include/sys/dsl_synctask.h
  13. +36 −1 include/sys/fs/zfs.h
  14. +3 −3 include/sys/metaslab.h
  15. +28 −25 include/sys/metaslab_impl.h
  16. +1 −1 include/sys/range_tree.h
  17. +8 −0 include/sys/spa.h
  18. +44 −0 include/sys/spa_checkpoint.h
  19. +5 −0 include/sys/spa_impl.h
  20. +7 −5 include/sys/space_map.h
  21. +23 −1 include/sys/uberblock_impl.h
  22. +3 −2 include/sys/vdev.h
  23. +10 −1 include/sys/vdev_impl.h
  24. +2 −2 include/sys/vdev_removal.h
  25. +0 −1 include/sys/zio.h
  26. +0 −1 include/sys/zthr.h
  27. +2 −1 include/zfeature_common.h
  28. +43 −0 lib/libzfs/libzfs_pool.c
  29. +27 −2 lib/libzfs/libzfs_util.c
  30. +68 −0 lib/libzfs_core/libzfs_core.c
  31. +1 −0 lib/libzpool/Makefile.am
  32. +0 −2 lib/libzpool/kernel.c
  33. +24 −1 man/man5/zfs-module-parameters.5
  34. +19 −1 man/man5/zpool-features.5
  35. +4 −1 man/man8/zdb.8
  36. +93 −0 man/man8/zpool.8
  37. +6 −1 module/zcommon/zfeature_common.c
  38. +3 −1 module/zcommon/zpool_prop.c
  39. +1 −0 module/zfs/Makefile.in
  40. +5 −8 module/zfs/dmu_traverse.c
  41. +4 −1 module/zfs/dnode.c
  42. +1 −1 module/zfs/dnode_sync.c
  43. +8 −4 module/zfs/dsl_dataset.c
  44. +2 −2 module/zfs/dsl_destroy.c
  45. +24 −13 module/zfs/dsl_dir.c
  46. +101 −12 module/zfs/dsl_pool.c
  47. +103 −75 module/zfs/dsl_scan.c
  48. +88 −36 module/zfs/dsl_synctask.c
  49. +3 −2 module/zfs/dsl_userhold.c
  50. +275 −144 module/zfs/metaslab.c
  51. +1 −1 module/zfs/range_tree.c
  52. +411 −40 module/zfs/spa.c
  53. +638 −0 module/zfs/spa_checkpoint.c
  54. +77 −5 module/zfs/spa_misc.c
  55. +140 −9 module/zfs/space_map.c
  56. +2 −1 module/zfs/uberblock.c
  57. +169 −18 module/zfs/vdev.c
  58. +9 −8 module/zfs/vdev_indirect.c
  59. +57 −22 module/zfs/vdev_label.c
  60. +64 −21 module/zfs/vdev_removal.c
  61. +1 −1 module/zfs/zcp.c
  62. +4 −5 module/zfs/zcp_synctask.c
  63. +32 −0 module/zfs/zfs_ioctl.c
  64. +96 −14 module/zfs/zil.c
  65. +3 −14 module/zfs/zio.c
  66. +0 −2 module/zfs/zthr.c
  67. +11 −0 tests/runfiles/linux.run
  68. +23 −0 tests/runfiles/longevity.run
  69. +1 −0 tests/zfs-tests/cmd/Makefile.am
  70. +1 −0 tests/zfs-tests/cmd/randwritecomp/.gitignore
  71. +9 −0 tests/zfs-tests/cmd/randwritecomp/Makefile.am
  72. +194 −0 tests/zfs-tests/cmd/randwritecomp/randwritecomp.c
  73. +1 −0 tests/zfs-tests/include/commands.cfg
  74. +19 −1 tests/zfs-tests/include/libtest.shlib
  75. +1 −0 tests/zfs-tests/tests/functional/Makefile.am
  76. +2 −2 tests/zfs-tests/tests/functional/cli_root/zdb/zdb_001_neg.ksh
  77. +2 −0 tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg
  78. +29 −7 tests/zfs-tests/tests/functional/cli_root/zpool_import/import_rewind_config_changed.ksh
  79. +1 −1 tests/zfs-tests/tests/functional/cli_root/zpool_sync/zpool_sync_001_pos.ksh
  80. +26 −0 tests/zfs-tests/tests/functional/pool_checkpoint/Makefile.am
  81. +55 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_after_rewind.ksh
  82. +57 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_big_rewind.ksh
  83. +92 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh
  84. +43 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_conf_change.ksh
  85. +53 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard.ksh
  86. +106 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard_busy.ksh
  87. +52 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard_many.ksh
  88. +59 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_indirect.ksh
  89. +80 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_invalid.ksh
  90. +61 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_lun_expsz.ksh
  91. +48 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_open.ksh
  92. +72 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_removal.ksh
  93. +49 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_rewind.ksh
  94. +57 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_ro_rewind.ksh
  95. +74 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_sm_scale.ksh
  96. +40 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_twice.ksh
  97. +63 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_vdev_add.ksh
  98. +80 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_zdb.ksh
  99. +66 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_zhack_feat.ksh
  100. +23 −0 tests/zfs-tests/tests/functional/pool_checkpoint/cleanup.ksh
  101. +393 −0 tests/zfs-tests/tests/functional/pool_checkpoint/pool_checkpoint.kshlib
  102. +25 −0 tests/zfs-tests/tests/functional/pool_checkpoint/setup.ksh
  103. +52 −56 tests/zfs-tests/tests/functional/removal/removal.kshlib
  104. +3 −4 tests/zfs-tests/tests/functional/removal/removal_remap_deadlists.ksh
  105. +2 −7 tests/zfs-tests/tests/functional/removal/removal_reservation.ksh
  106. +5 −9 tests/zfs-tests/tests/functional/removal/removal_with_add.ksh
  107. +3 −6 tests/zfs-tests/tests/functional/removal/removal_with_create_fs.ksh
  108. +15 −18 tests/zfs-tests/tests/functional/removal/removal_with_export.ksh
  109. +2 −11 tests/zfs-tests/tests/functional/removal/removal_with_remap.ksh
  110. +3 −6 tests/zfs-tests/tests/functional/removal/removal_with_remove.ksh
  111. +2 −11 tests/zfs-tests/tests/functional/removal/removal_with_scrub.ksh
  112. +4 −7 tests/zfs-tests/tests/functional/removal/removal_with_send.ksh
  113. +5 −8 tests/zfs-tests/tests/functional/removal/removal_with_send_recv.ksh
  114. +3 −6 tests/zfs-tests/tests/functional/removal/removal_with_snapshot.ksh
  115. +1 −1 tests/zfs-tests/tests/functional/removal/removal_with_zdb.ksh

Large diffs are not rendered by default.

@@ -25,7 +25,7 @@
*/

/*
* Copyright (c) 2013, 2016 by Delphix. All rights reserved.
* Copyright (c) 2013, 2017 by Delphix. All rights reserved.
*/

/*
@@ -42,6 +42,7 @@
#include <sys/resource.h>
#include <sys/zil.h>
#include <sys/zil_impl.h>
#include <sys/spa_impl.h>
#include <sys/abd.h>

#include "zdb.h"
@@ -166,7 +167,7 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, void *arg)
if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) {
(void) printf("%shas blkptr, %s\n", tab_prefix,
!BP_IS_HOLE(bp) &&
bp->blk_birth >= spa_first_txg(zilog->zl_spa) ?
bp->blk_birth >= spa_min_claim_txg(zilog->zl_spa) ?
"will claim" : "won't claim");
print_log_bp(bp, tab_prefix);

@@ -361,7 +362,7 @@ print_log_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg)

if (claim_txg != 0)
claim = "already claimed";
else if (bp->blk_birth >= spa_first_txg(zilog->zl_spa))
else if (bp->blk_birth >= spa_min_claim_txg(zilog->zl_spa))
claim = "will claim";
else
claim = "won't claim";
@@ -416,6 +417,11 @@ dump_intent_log(zilog_t *zilog)
for (i = 0; i < TX_MAX_TYPE; i++)
zil_rec_info[i].zri_count = 0;

/* see comment in zil_claim() or zil_check_log_chain() */
if (zilog->zl_spa->spa_uberblock.ub_checkpoint_txg != 0 &&
zh->zh_claim_txg == 0)
return;

if (verbose >= 2) {
(void) printf("\n");
(void) zil_parse(zilog, print_log_block, print_log_record, NULL,

0 comments on commit d2734cc

Please sign in to comment.
You can’t perform that action at this time.