Subject: Re: Do some disk accesses miss the UVM?
To: <>
From: David Laight <>
List: tech-kern
Date: 01/25/2002 00:56:10
> > The buffer cache (currently the default 13Mb) is large enough that 'find
>  > . | wc' leaves all the data it wants cached,  however 'du -s .' has to
>  > access the disk.  I can't see how the latter requires access to any more
>  > data.
> Metadata (inodes) still lives in the old buffer cache, IIRC.

But 'find' and 'du' both walk the entire tree.....  So why does du require
so much more data.  My suspicion is that both the buffer cache and UBC fail
to cache 'unused' buffers properly.  In sw development the 'working set' 
of a system is often technically 'free buffers'
>  > FWIW I've found this snippet of code in brelse() (kern/vfs_bio.c):
>  > 
>  >                 if (bp->b_vp) {
>  >                         reassignbuf(bp, bp->b_vp);
>  >                         brelvp(bp);
>  >                 }
>  >  
>  > I can't see the point of the reassignbuf() at all - even if it weren't
>  > followed by a brelvp() call, which makes it particularly pointless.
> That bit of code can be arrived at if there was an error performing I/O (see
> the handling of B_ERROR some lines up).  It is just checking if the buffer
> is still associated with a device's vnode and, if so, taking action to grab
> it back.

And then throwing it away.
The only purpose on the reassignbuf() is to move the buffer onto (maybe off?)
the dirty list.
I couldn't see any side effects of the reassignbuf() call that brelvp()
doesn't undo.