Project

General

Profile

Bug #1017

zfs_znode_alloc should not call vn_reinit

Added by Albert Lee over 8 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
kernel
Start date:
2011-05-10
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage

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.

History

#1

Updated by Ryan Zezeski almost 5 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

#2

Updated by Ryan Zezeski almost 5 years ago

  • Status changed from New to Closed

Also available in: Atom PDF