aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/cmd/zhack/zhack.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2015-08-12 23:59:17 +0000
committerAlexander Motin <mav@FreeBSD.org>2015-08-12 23:59:17 +0000
commit0d0def87fe0cfb97ed1732492cc49538c5e69880 (patch)
treefde4c6e72afe9d2b5eb0a48efeff4e899efcd81a /cddl/contrib/opensolaris/cmd/zhack/zhack.c
parentb696497df0197b0dc72d87fd0fedac61a504d0b7 (diff)
parentad688e7c0e0cf668429742217ac2b0fdfde65f35 (diff)
downloadsrc-0d0def87fe0cfb97ed1732492cc49538c5e69880.tar.gz
src-0d0def87fe0cfb97ed1732492cc49538c5e69880.zip
MFV 286707: 5959 clean up per-dataset feature count code
Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: George Wilson <george@delphix.com> Reviewed by: Alex Reece <alex@delphix.com> Approved by: Richard Lowe <richlowe@richlowe.net> Author: Matthew Ahrens <mahrens@delphix.com> illumos/illumos-gate@ca0cc3918a1789fa839194af2a9245f801a06b1a A ZFS feature flags (large blocks) tracks its refcounts as the number of datasets that have ever used the feature. Several features of this type are planned to be added (new checksum functions). This code should be made common infrastructure rather than duplicating the code for each feature.
Notes
Notes: svn path=/head/; revision=286708
Diffstat (limited to 'cddl/contrib/opensolaris/cmd/zhack/zhack.c')
-rw-r--r--cddl/contrib/opensolaris/cmd/zhack/zhack.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/cddl/contrib/opensolaris/cmd/zhack/zhack.c b/cddl/contrib/opensolaris/cmd/zhack/zhack.c
index 6e3f0294a623..f4434a1a468d 100644
--- a/cddl/contrib/opensolaris/cmd/zhack/zhack.c
+++ b/cddl/contrib/opensolaris/cmd/zhack/zhack.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
*/
@@ -294,8 +294,8 @@ zhack_feature_enable_sync(void *arg, dmu_tx_t *tx)
feature_enable_sync(spa, feature, tx);
spa_history_log_internal(spa, "zhack enable feature", tx,
- "name=%s can_readonly=%u",
- feature->fi_guid, feature->fi_can_readonly);
+ "guid=%s flags=%x",
+ feature->fi_guid, feature->fi_flags);
}
static void
@@ -314,9 +314,7 @@ zhack_do_feature_enable(int argc, char **argv)
*/
desc = NULL;
feature.fi_uname = "zhack";
- feature.fi_mos = B_FALSE;
- feature.fi_can_readonly = B_FALSE;
- feature.fi_activate_on_enable = B_FALSE;
+ feature.fi_flags = 0;
feature.fi_depends = nodeps;
feature.fi_feature = SPA_FEATURE_NONE;
@@ -324,7 +322,7 @@ zhack_do_feature_enable(int argc, char **argv)
while ((c = getopt(argc, argv, "rmd:")) != -1) {
switch (c) {
case 'r':
- feature.fi_can_readonly = B_TRUE;
+ feature.fi_flags |= ZFEATURE_FLAG_READONLY_COMPAT;
break;
case 'd':
desc = strdup(optarg);
@@ -413,7 +411,7 @@ zhack_do_feature_ref(int argc, char **argv)
* disk later.
*/
feature.fi_uname = "zhack";
- feature.fi_mos = B_FALSE;
+ feature.fi_flags = 0;
feature.fi_desc = NULL;
feature.fi_depends = nodeps;
feature.fi_feature = SPA_FEATURE_NONE;
@@ -422,7 +420,7 @@ zhack_do_feature_ref(int argc, char **argv)
while ((c = getopt(argc, argv, "md")) != -1) {
switch (c) {
case 'm':
- feature.fi_mos = B_TRUE;
+ feature.fi_flags |= ZFEATURE_FLAG_MOS;
break;
case 'd':
decr = B_TRUE;
@@ -455,10 +453,10 @@ zhack_do_feature_ref(int argc, char **argv)
if (0 == zap_contains(mos, spa->spa_feat_for_read_obj,
feature.fi_guid)) {
- feature.fi_can_readonly = B_FALSE;
+ feature.fi_flags &= ~ZFEATURE_FLAG_READONLY_COMPAT;
} else if (0 == zap_contains(mos, spa->spa_feat_for_write_obj,
feature.fi_guid)) {
- feature.fi_can_readonly = B_TRUE;
+ feature.fi_flags |= ZFEATURE_FLAG_READONLY_COMPAT;
} else {
fatal(spa, FTAG, "feature is not enabled: %s", feature.fi_guid);
}