Skip to content
Permalink
Browse files

9166 zfs storage pool checkpoint

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
  • Loading branch information...
sdimitro authored and prakashsurya committed Dec 16, 2016
1 parent 5f5913b commit 8671400134a11c848244896ca51a7db4d0f69da4
Showing with 6,299 additions and 849 deletions.
  1. +38 −29 usr/src/cmd/mdb/common/modules/zfs/zfs.c
  2. +5 −1 usr/src/cmd/truss/codes.c
  3. +727 −120 usr/src/cmd/zdb/zdb.c
  4. +9 −3 usr/src/cmd/zdb/zdb_il.c
  5. +208 −7 usr/src/cmd/zpool/zpool_main.c
  6. +109 −11 usr/src/cmd/ztest/ztest.c
  7. +6 −1 usr/src/common/zfs/zfeature_common.c
  8. +2 −1 usr/src/common/zfs/zfeature_common.h
  9. +3 −1 usr/src/common/zfs/zpool_prop.c
  10. +7 −0 usr/src/lib/libzfs/common/libzfs.h
  11. +43 −0 usr/src/lib/libzfs/common/libzfs_pool.c
  12. +27 −2 usr/src/lib/libzfs/common/libzfs_util.c
  13. +2 −0 usr/src/lib/libzfs/common/mapfile-vers
  14. +68 −0 usr/src/lib/libzfs_core/common/libzfs_core.c
  15. +3 −0 usr/src/lib/libzfs_core/common/libzfs_core.h
  16. +8 −1 usr/src/lib/libzfs_core/common/mapfile-vers
  17. +4 −1 usr/src/man/man1m/zdb.1m
  18. +93 −0 usr/src/man/man1m/zpool.1m
  19. +19 −1 usr/src/man/man5/zpool-features.5
  20. +52 −0 usr/src/pkg/manifests/system-test-zfstest.mf
  21. +19 −0 usr/src/test/zfs-tests/cmd/randwritecomp/Makefile
  22. +192 −0 usr/src/test/zfs-tests/cmd/randwritecomp/randwritecomp.c
  23. +1 −0 usr/src/test/zfs-tests/include/commands.cfg
  24. +19 −1 usr/src/test/zfs-tests/include/libtest.shlib
  25. +10 −1 usr/src/test/zfs-tests/runfiles/delphix.run
  26. +23 −0 usr/src/test/zfs-tests/runfiles/longevity.run
  27. +12 −1 usr/src/test/zfs-tests/runfiles/omnios.run
  28. +12 −1 usr/src/test/zfs-tests/runfiles/openindiana.run
  29. +2 −2 usr/src/test/zfs-tests/tests/functional/cli_root/zdb/zdb_001_neg.ksh
  30. +29 −7 usr/src/test/zfs-tests/tests/functional/cli_root/zpool_import/import_rewind_config_changed.ksh
  31. +21 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/Makefile
  32. +55 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_after_rewind.ksh
  33. +57 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_big_rewind.ksh
  34. +90 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh
  35. +43 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_conf_change.ksh
  36. +53 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard.ksh
  37. +106 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard_busy.ksh
  38. +52 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard_many.ksh
  39. +59 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_indirect.ksh
  40. +80 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_invalid.ksh
  41. +61 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_lun_expsz.ksh
  42. +48 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_open.ksh
  43. +72 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_removal.ksh
  44. +49 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_rewind.ksh
  45. +57 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_ro_rewind.ksh
  46. +74 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_sm_scale.ksh
  47. +40 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_twice.ksh
  48. +63 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_vdev_add.ksh
  49. +80 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_zdb.ksh
  50. +66 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/checkpoint_zhack_feat.ksh
  51. +23 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/cleanup.ksh
  52. +392 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/pool_checkpoint.kshlib
  53. +25 −0 usr/src/test/zfs-tests/tests/functional/pool_checkpoint/setup.ksh
  54. +52 −56 usr/src/test/zfs-tests/tests/functional/removal/removal.kshlib
  55. +2 −3 usr/src/test/zfs-tests/tests/functional/removal/removal_remap_deadlists.ksh
  56. +2 −7 usr/src/test/zfs-tests/tests/functional/removal/removal_reservation.ksh
  57. +5 −9 usr/src/test/zfs-tests/tests/functional/removal/removal_with_add.ksh
  58. +3 −6 usr/src/test/zfs-tests/tests/functional/removal/removal_with_create_fs.ksh
  59. +14 −17 usr/src/test/zfs-tests/tests/functional/removal/removal_with_export.ksh
  60. +2 −11 usr/src/test/zfs-tests/tests/functional/removal/removal_with_remap.ksh
  61. +3 −6 usr/src/test/zfs-tests/tests/functional/removal/removal_with_remove.ksh
  62. +2 −11 usr/src/test/zfs-tests/tests/functional/removal/removal_with_scrub.ksh
  63. +4 −7 usr/src/test/zfs-tests/tests/functional/removal/removal_with_send.ksh
  64. +5 −8 usr/src/test/zfs-tests/tests/functional/removal/removal_with_send_recv.ksh
  65. +3 −6 usr/src/test/zfs-tests/tests/functional/removal/removal_with_snapshot.ksh
  66. +6 −9 usr/src/test/zfs-tests/tests/functional/removal/removal_with_zdb.ksh
  67. +21 −0 usr/src/test/zfs-tests/tests/longevity/Makefile
  68. +255 −0 usr/src/test/zfs-tests/tests/longevity/slop_space_test.ksh
  69. +1 −0 usr/src/uts/common/Makefile.files
  70. +6 −8 usr/src/uts/common/fs/zfs/dmu_traverse.c
  71. +3 −1 usr/src/uts/common/fs/zfs/dnode.c
  72. +1 −1 usr/src/uts/common/fs/zfs/dnode_sync.c
  73. +8 −4 usr/src/uts/common/fs/zfs/dsl_dataset.c
  74. +2 −2 usr/src/uts/common/fs/zfs/dsl_destroy.c
  75. +24 −13 usr/src/uts/common/fs/zfs/dsl_dir.c
  76. +99 −12 usr/src/uts/common/fs/zfs/dsl_pool.c
  77. +87 −58 usr/src/uts/common/fs/zfs/dsl_scan.c
  78. +88 −36 usr/src/uts/common/fs/zfs/dsl_synctask.c
  79. +3 −2 usr/src/uts/common/fs/zfs/dsl_userhold.c
  80. +285 −156 usr/src/uts/common/fs/zfs/metaslab.c
  81. +8 −2 usr/src/uts/common/fs/zfs/range_tree.c
  82. +411 −40 usr/src/uts/common/fs/zfs/spa.c
  83. +623 −0 usr/src/uts/common/fs/zfs/spa_checkpoint.c
  84. +72 −5 usr/src/uts/common/fs/zfs/spa_misc.c
  85. +140 −9 usr/src/uts/common/fs/zfs/space_map.c
  86. +1 −0 usr/src/uts/common/fs/zfs/sys/dmu.h
  87. +2 −1 usr/src/uts/common/fs/zfs/sys/dsl_dir.h
  88. +7 −1 usr/src/uts/common/fs/zfs/sys/dsl_pool.h
  89. +36 −5 usr/src/uts/common/fs/zfs/sys/dsl_synctask.h
  90. +3 −3 usr/src/uts/common/fs/zfs/sys/metaslab.h
  91. +28 −25 usr/src/uts/common/fs/zfs/sys/metaslab_impl.h
  92. +2 −1 usr/src/uts/common/fs/zfs/sys/range_tree.h
  93. +8 −0 usr/src/uts/common/fs/zfs/sys/spa.h
  94. +44 −0 usr/src/uts/common/fs/zfs/sys/spa_checkpoint.h
  95. +5 −0 usr/src/uts/common/fs/zfs/sys/spa_impl.h
  96. +7 −5 usr/src/uts/common/fs/zfs/sys/space_map.h
  97. +23 −1 usr/src/uts/common/fs/zfs/sys/uberblock_impl.h
  98. +3 −2 usr/src/uts/common/fs/zfs/sys/vdev.h
  99. +10 −1 usr/src/uts/common/fs/zfs/sys/vdev_impl.h
  100. +2 −2 usr/src/uts/common/fs/zfs/sys/vdev_removal.h
  101. +0 −1 usr/src/uts/common/fs/zfs/sys/zio.h
  102. +0 −1 usr/src/uts/common/fs/zfs/sys/zthr.h
  103. +2 −1 usr/src/uts/common/fs/zfs/uberblock.c
  104. +163 −16 usr/src/uts/common/fs/zfs/vdev.c
  105. +9 −8 usr/src/uts/common/fs/zfs/vdev_indirect.c
  106. +57 −22 usr/src/uts/common/fs/zfs/vdev_label.c
  107. +57 −21 usr/src/uts/common/fs/zfs/vdev_removal.c
  108. +1 −1 usr/src/uts/common/fs/zfs/zcp.c
  109. +4 −5 usr/src/uts/common/fs/zfs/zcp_synctask.c
  110. +32 −0 usr/src/uts/common/fs/zfs/zfs_ioctl.c
  111. +96 −13 usr/src/uts/common/fs/zfs/zil.c
  112. +3 −14 usr/src/uts/common/fs/zfs/zio.c
  113. +0 −2 usr/src/uts/common/fs/zfs/zthr.c
  114. +36 −0 usr/src/uts/common/sys/fs/zfs.h
@@ -21,8 +21,8 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2011, 2016 by Delphix. All rights reserved.
* Copyright (c) 2017, Joyent, Inc. All rights reserved.
* Copyright (c) 2011, 2017 by Delphix. All rights reserved.
*/

/* Portions Copyright 2010 Robert Milkowski */
@@ -1316,22 +1316,23 @@ typedef struct mdb_metaslab {
int64_t ms_deferspace;
uint64_t ms_fragmentation;
uint64_t ms_weight;
uintptr_t ms_alloctree[TXG_SIZE];
uintptr_t ms_freeingtree;
uintptr_t ms_freedtree;
uintptr_t ms_tree;
uintptr_t ms_allocating[TXG_SIZE];
uintptr_t ms_checkpointing;
uintptr_t ms_freeing;
uintptr_t ms_freed;
uintptr_t ms_allocatable;
uintptr_t ms_sm;
} mdb_metaslab_t;

typedef struct mdb_space_map_phys_t {
uint64_t smp_alloc;
int64_t smp_alloc;
uint64_t smp_histogram[SPACE_MAP_HISTOGRAM_SIZE];
} mdb_space_map_phys_t;

typedef struct mdb_space_map {
uint64_t sm_size;
uint8_t sm_shift;
uint64_t sm_alloc;
int64_t sm_alloc;
uintptr_t sm_phys;
} mdb_space_map_t;

@@ -1937,10 +1938,11 @@ typedef struct mdb_dsl_dir_phys {
} mdb_dsl_dir_phys_t;

typedef struct space_data {
uint64_t ms_alloctree[TXG_SIZE];
uint64_t ms_freeingtree;
uint64_t ms_freedtree;
uint64_t ms_tree;
uint64_t ms_allocating[TXG_SIZE];
uint64_t ms_checkpointing;
uint64_t ms_freeing;
uint64_t ms_freed;
uint64_t ms_allocatable;
int64_t ms_deferspace;
uint64_t avail;
uint64_t nowavail;
@@ -1963,27 +1965,32 @@ space_cb(uintptr_t addr, const void *unknown, void *arg)

for (i = 0; i < TXG_SIZE; i++) {
if (mdb_ctf_vread(&rt, "range_tree_t",
"mdb_range_tree_t", ms.ms_alloctree[i], 0) == -1)
"mdb_range_tree_t", ms.ms_allocating[i], 0) == -1)
return (WALK_ERR);

sd->ms_alloctree[i] += rt.rt_space;
sd->ms_allocating[i] += rt.rt_space;

}

if (mdb_ctf_vread(&rt, "range_tree_t",
"mdb_range_tree_t", ms.ms_freeingtree, 0) == -1)
"mdb_range_tree_t", ms.ms_checkpointing, 0) == -1)
return (WALK_ERR);
sd->ms_freeingtree += rt.rt_space;
sd->ms_checkpointing += rt.rt_space;

if (mdb_ctf_vread(&rt, "range_tree_t",
"mdb_range_tree_t", ms.ms_freedtree, 0) == -1)
"mdb_range_tree_t", ms.ms_freeing, 0) == -1)
return (WALK_ERR);
sd->ms_freedtree += rt.rt_space;
sd->ms_freeing += rt.rt_space;

if (mdb_ctf_vread(&rt, "range_tree_t",
"mdb_range_tree_t", ms.ms_tree, 0) == -1)
"mdb_range_tree_t", ms.ms_freed, 0) == -1)
return (WALK_ERR);
sd->ms_tree += rt.rt_space;
sd->ms_freed += rt.rt_space;

if (mdb_ctf_vread(&rt, "range_tree_t",
"mdb_range_tree_t", ms.ms_allocatable, 0) == -1)
return (WALK_ERR);
sd->ms_allocatable += rt.rt_space;

if (ms.ms_sm != NULL &&
mdb_ctf_vread(&sm, "space_map_t",
@@ -2067,16 +2074,18 @@ spa_space(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
}

mdb_printf("ms_allocmap = %llu%s %llu%s %llu%s %llu%s\n",
sd.ms_alloctree[0] >> shift, suffix,
sd.ms_alloctree[1] >> shift, suffix,
sd.ms_alloctree[2] >> shift, suffix,
sd.ms_alloctree[3] >> shift, suffix);
mdb_printf("ms_freeingtree = %llu%s\n",
sd.ms_freeingtree >> shift, suffix);
mdb_printf("ms_freedtree = %llu%s\n",
sd.ms_freedtree >> shift, suffix);
mdb_printf("ms_tree = %llu%s\n",
sd.ms_tree >> shift, suffix);
sd.ms_allocating[0] >> shift, suffix,
sd.ms_allocating[1] >> shift, suffix,
sd.ms_allocating[2] >> shift, suffix,
sd.ms_allocating[3] >> shift, suffix);
mdb_printf("ms_checkpointing = %llu%s\n",
sd.ms_checkpointing >> shift, suffix);
mdb_printf("ms_freeing = %llu%s\n",
sd.ms_freeing >> shift, suffix);
mdb_printf("ms_freed = %llu%s\n",
sd.ms_freed >> shift, suffix);
mdb_printf("ms_allocatable = %llu%s\n",
sd.ms_allocatable >> shift, suffix);
mdb_printf("ms_deferspace = %llu%s\n",
sd.ms_deferspace >> shift, suffix);
mdb_printf("last synced avail = %llu%s\n",
@@ -21,7 +21,7 @@

/*
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2016 by Delphix. All rights reserved.
* Copyright (c) 2011, 2017 by Delphix. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2015, Joyent, Inc. All rights reserved.
* Copyright (c) 2014, OmniTI Computer Consulting, Inc. All rights reserved.
@@ -1164,6 +1164,10 @@ const struct ioc {
"zfs_cmd_t" },
{ (uint_t)ZFS_IOC_POOL_GET_HISTORY, "ZFS_IOC_POOL_GET_HISTORY",
"zfs_cmd_t" },
{ (uint_t)ZFS_IOC_POOL_CHECKPOINT, "ZFS_IOC_POOL_CHECKPOINT",
"zfs_cmd_t" },
{ (uint_t)ZFS_IOC_POOL_DISCARD_CHECKPOINT,
"ZFS_IOC_POOL_DISCARD_CHECKPOINT", "zfs_cmd_t" },
{ (uint_t)ZFS_IOC_VDEV_ADD, "ZFS_IOC_VDEV_ADD",
"zfs_cmd_t" },
{ (uint_t)ZFS_IOC_VDEV_REMOVE, "ZFS_IOC_VDEV_REMOVE",

0 comments on commit 8671400

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