Jeremy Archer
2009-Jun-01 03:31 UTC
[zfs-code] Superfluous inits in arc.c (and perhaps elsewhere)
I see a consistent coding pattern in the various zfs object cache constructors. These constructors always bzero the new structure. Given this, all subsequent initializations, that merely set various fields to 0 or NULL are unnecessary. No big deal, but fewer CPU cycles, and fewer lines of code to look at are both good. Also, someone may think that those init''s are necessary, and chase a non-existent bug when one of them is missing. :-) -- This message posted from opensolaris.org
Matthew Ahrens
2009-Jun-01 23:46 UTC
[zfs-code] Superfluous inits in arc.c (and perhaps elsewhere)
Jeremy Archer wrote:> Also, someone may think that those init''s are necessary, and chase a non-existent bug when one of them is missing. :-)We try to keep all the mutex_init() & friends there for the ZFS ports to other operating systems. Some of them need it. --matt
Jeremy Archer
2009-Jun-02 15:59 UTC
[zfs-code] Superfluous inits in arc.c (and perhaps elsewhere)
Hello, Thanks for replying. I am merely talking about explicitly assigning 0 or NULL to fields of a structure, right after is was allocated. The structure was zero filled already in its kmem_cache_alloc* constructor. I believe these assignments are not necessary on any OS. Am I missing something? -- This message posted from opensolaris.org