Bug #1017
closedzfs_znode_alloc should not call vn_reinit
0%
Description
zfs_znode_alloc pulls a fresh znode from znode_cache, whose constructor calls vn_alloc so it points to a fresh vnode. vn_reinit there is redundant.
Updated by Ryan Zezeski about 8 years ago
After discussing with Robert Mustacchi and reading the code (vnode.h,
vnode.c, zfs_znode.c), I've determined this change should not be made.
Both znode and vnode allocation are backed by object caches. These
caches reduce instruction count by reusing pre-allocated objects, in
this case znodes and vnodes. For any given call to `zfs_znode_alloc()`
there is no guarantee `zfs_znode_cache_constructor()` is called; thus
no guarantee that `vn_alloc()` is called. This is good, we want to
avoid the expensive initialization. However, vnode.h explicitly states
that any reused vnode MUST be reinitialized via `vn_reinit()`. This
code is doing exactly what it should.
https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/common/sys/vnode.h#L135