summaryrefslogtreecommitdiffstats
path: root/include/sys/dmu_traverse.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sys/dmu_traverse.h')
-rw-r--r--include/sys/dmu_traverse.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/sys/dmu_traverse.h b/include/sys/dmu_traverse.h
index 8ceef5cf1..d76bfe3c9 100644
--- a/include/sys/dmu_traverse.h
+++ b/include/sys/dmu_traverse.h
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2018 by Delphix. All rights reserved.
*/
#ifndef _SYS_DMU_TRAVERSE_H
@@ -71,6 +71,20 @@ int traverse_dataset_destroyed(spa_t *spa, blkptr_t *blkptr,
int traverse_pool(spa_t *spa,
uint64_t txg_start, int flags, blkptr_cb_t func, void *arg);
+/*
+ * Note that this calculation cannot overflow with the current maximum indirect
+ * block size (128k). If that maximum is increased to 1M, however, this
+ * calculation can overflow, and handling would need to be added to ensure
+ * continued correctness.
+ */
+static inline uint64_t
+bp_span_in_blocks(uint8_t indblkshift, uint64_t level)
+{
+ unsigned int shift = level * (indblkshift - SPA_BLKPTRSHIFT);
+ ASSERT3U(shift, <, 64);
+ return (1ULL << shift);
+}
+
#ifdef __cplusplus
}
#endif