[Libguestfs] [PATCH nbdkit v2 3/4] cache: Implement LRU structure.

Richard W.M. Jones rjones at redhat.com
Thu Jan 3 11:11:00 UTC 2019


On Wed, Jan 02, 2019 at 09:04:43PM -0600, Eric Blake wrote:
> > + * When a block is accessed, we set the corresponding bit in bm[0] and
> > + * increment c0 (c0 counts the number of bits set in bm[0]).  If c0 ==
> > + * N/2 then we swap the two bitmaps, clear bm[0], and reset c0 to 0.
> 
> Are you incrementing c0 on every access, or just on accesses that flip a
> bit from 0 to 1?  That is, if I access sector 0 repeatedly and nothing
> else (say 100 times), is c0 set to 100 or to just 1?

I changed the wording to "When a _new_ block is accessed, ..."  which
hopefully makes it clearer.

(I didn't push this one because it doesn't make much sense on its own
without the 4/4 commit which I'm fixing up next.)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list