aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/abd.c
diff options
context:
space:
mode:
authorAlexander Motin <[email protected]>2021-06-25 19:38:31 -0400
committerGitHub <[email protected]>2021-06-25 16:38:31 -0700
commit5e2c8338bf17d31b44eb1dbbb3c9b6a0f64e96ee (patch)
tree4576ab0198ba260cdb65354bf2d5f23db7887035 /module/zfs/abd.c
parent14d2841b5318f92bc443d24ed65f29ccc4b9f2bd (diff)
Help compiller optimize out abd_verify()
While abd_verify() does nothing when built without debug, compiler can't optimize it out by itself due to calls to external list_*() and abd_verify_scatter(). This commit makes it explicit. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Adam Moss <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored-By: iXsystems, Inc. Closes #12280
Diffstat (limited to 'module/zfs/abd.c')
-rw-r--r--module/zfs/abd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/module/zfs/abd.c b/module/zfs/abd.c
index 2d1be9752..d5fafccd0 100644
--- a/module/zfs/abd.c
+++ b/module/zfs/abd.c
@@ -108,15 +108,14 @@ int zfs_abd_scatter_enabled = B_TRUE;
void
abd_verify(abd_t *abd)
{
+#ifdef ZFS_DEBUG
ASSERT3U(abd->abd_size, >, 0);
ASSERT3U(abd->abd_size, <=, SPA_MAXBLOCKSIZE);
ASSERT3U(abd->abd_flags, ==, abd->abd_flags & (ABD_FLAG_LINEAR |
ABD_FLAG_OWNER | ABD_FLAG_META | ABD_FLAG_MULTI_ZONE |
ABD_FLAG_MULTI_CHUNK | ABD_FLAG_LINEAR_PAGE | ABD_FLAG_GANG |
ABD_FLAG_GANG_FREE | ABD_FLAG_ZEROS | ABD_FLAG_ALLOCD));
-#ifdef ZFS_DEBUG
IMPLY(abd->abd_parent != NULL, !(abd->abd_flags & ABD_FLAG_OWNER));
-#endif
IMPLY(abd->abd_flags & ABD_FLAG_META, abd->abd_flags & ABD_FLAG_OWNER);
if (abd_is_linear(abd)) {
ASSERT3P(ABD_LINEAR_BUF(abd), !=, NULL);
@@ -133,6 +132,7 @@ abd_verify(abd_t *abd)
} else {
abd_verify_scatter(abd);
}
+#endif
}
static void