On Mar 3, 2014, at 11:32 AM, Thomas Klausner <w...@netbsd.org> wrote:
> On Mon, Mar 03, 2014 at 11:11:04AM +0100, J. Hannken-Illjes wrote: >> A diff implementing this and using it for those operations running >> vrecycle() is at http://www.netbsd.org/~hannken/vnode-pass4-1.diff >> >> Once all operations are converted, vmark() / vunmark() will go and >> man pages will be updated. >> >> Comments or objections anyone? > > I have no background clue, so please excuse my questions if they are > stupid :) > > +void > +vfs_vnode_iterator_init(struct mount *mp, void **marker) > +{ > + struct vnode **mvpp = (struct vnode **)marker; > + > + *mvpp = vnalloc(mp); > + > + mutex_enter(&mntvnode_lock); > + TAILQ_INSERT_HEAD(&mp->mnt_vnodelist, *mvpp, v_mntvnodes); > + mutex_exit(&mntvnode_lock); > +} > + > +void > +vfs_vnode_iterator_destroy(void *marker) > +{ > + struct vnode *mvp = marker; > + > + KASSERT((mvp->v_iflag & VI_MARKER) != 0); > + vnfree(mvp); > +} > > Why do you cast marker in init, but not in destroy or next? Because (void **) to (othertype **) needs a cast. Added casts to destroy and next anyway. > I assume that the marker is not struct vnode * so that you can change > the type later if you want. It is struct vnode * for now, to the caller it is simply opaque as the caller doesn't need to know the internals. > In init, you insert into a tailq, but in destroy you don't remove from > any tailq. Where does that happen? (Let's say I forget iterating > between init & destroy, or stop at some random point before going > through all of them.) Good catch. Changed to track this state using v_usecount. > lfs part: there are new mutex_enter for which I don't see the exits. > Where did they happen before? Does vget release them? because vrecycle > tries to acquire that mutex too. Yes, vget() gets called with v_interlock held and releases on return. New diff at http://www.netbsd.org/~hannken/vnode-pass4-2.diff -- J. Hannken-Illjes - hann...@eis.cs.tu-bs.de - TU Braunschweig (Germany)