diff options
author | Alexander Motin <mav@FreeBSD.org> | 2021-06-25 23:38:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-25 23:38:31 +0000 |
commit | 5e2c8338bf17d31b44eb1dbbb3c9b6a0f64e96ee (patch) | |
tree | 4576ab0198ba260cdb65354bf2d5f23db7887035 /module/zfs/abd.c | |
parent | 14d2841b5318f92bc443d24ed65f29ccc4b9f2bd (diff) | |
download | src-5e2c8338bf17d31b44eb1dbbb3c9b6a0f64e96ee.tar.gz src-5e2c8338bf17d31b44eb1dbbb3c9b6a0f64e96ee.zip |
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 <behlendorf1@llnl.gov>
Reviewed-by: Adam Moss <c@yotes.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12280
Diffstat (limited to 'module/zfs/abd.c')
-rw-r--r-- | module/zfs/abd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/module/zfs/abd.c b/module/zfs/abd.c index 2d1be9752d4f..d5fafccd08af 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 |