translate INVARIANTS to DEBUG for code from OpenSolaris

Steven Hartland killing at multiplay.co.uk
Mon Jul 29 18:25:24 UTC 2013


----- Original Message ----- 
From: "Andriy Gapon" <avg at FreeBSD.org>

> [zfs-devel@, fs@, dtrace@ are Bcc-ed]
> 
> In OpenSolaris and its descendants DEBUG is used in a fashion similar to our
> INVARIANTS.  For example, ASSERT macros are enabled by it.
> In our kernel code DEBUG has a different meaning and enables far too verbose or
> far too obscure code and, as such, it is very rarely enabled.
> 
> The idea of a change that I would like to propose is to translate INVARIANTS
> kernel option into DEBUG for the files that originated from OpenSolaris (and
> hopefully only for them).
> 
> The change:
>    opensolaris code: translate INVARIANTS to DEBUG and ZFS_DEBUG
> 
>    do this by forcing inclusion of
>    sys/cddl/compat/opensolaris/sys/debug_compat.h
>    via -include option into all source files from OpenSolaris.
>    Note that this -include option must always be after -include opt_global.h.
> 
>    Additionally, remove forced definition of DEBUG for some modules and fix
>    their build without DEBUG.
> 
>    Also, meaning of DEBUG was overloaded to enable WITNESS support for some
>    OpenSolaris (primarily ZFS) locks.  Now this overloading is removed and
>    that use of DEBUG is replaced with a new option OPENSOLARIS_WITNESS.
> 
> http://people.freebsd.org/~avg/osol-invariants-debug.diff
> 
> I would like to ask for your feedback on the soundness of the whole idea.
> Also on the name, location and style of inclusion for
> sys/cddl/compat/opensolaris/sys/debug_compat.h.
> And on any other details of the proposed change.
> 
> Testing is also welcome, of course.
> 
> Thank you very much.

I'm not sure you need #define ZFS_DEBUG as its already a dependency on
DEBUG see:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h

Should this connection be broken and INVARIANTS only trigger DEBUG by
default? One potential reason for this distinction is that ZFS_DEBUG brings
with it some potentially quite heavy weight validation such as dnode_verify.

If so I have small list of additional fixes here that where required when
I tested enabling ASSERTS checking without ZFS_DEBUG.

What do others think, should INVARIANTS trigger ZFS_DEBUG or should that
be kept seperate?

    Regards
    Steve

================================================
This e.mail is private and confidential between Multiplay (UK) Ltd. and the person or entity to whom it is addressed. In the event of misdirection, the recipient is prohibited from using, copying, printing or otherwise disseminating it or any information contained in it. 

In the event of misdirection, illegible or incomplete transmission please telephone +44 845 868 1337
or return the E.mail to postmaster at multiplay.co.uk.



More information about the freebsd-arch mailing list