I?m trying to understand the inner workings of the adaptive replacement cache (arc). I see there are arc_bufs and arc_buf_hdrs. Each arc_buf_hdr points to an arc_buf_t. The arc_buf_t is really one entry in a list of arc_buf_t entries. The multiple entries are accessed through the arc_buf_t?s b_next member. Why does the arc_buf_hdr point to a list of arc_buf_ts and not just one arc_buf_t, i.e., how and why do multiple arc_buf_ts get inserted into this list? What is the relationship between arc_buf_hdr?s b_datacnt and b_refcnt? Is b_datacnt the number of arc_buf_ts in the list? Does the b_refcnt keep track of all users of all arc_buf_ts in the list? Thanks for any understanding that anyone can offer. Duff -- This messages posted from opensolaris.org
Mark Maybee
2008-Jan-16 19:37 UTC
[zfs-code] Understanding the ARC - arc_buf_hdr and arc_buf_t
J Duff wrote:> I?m trying to understand the inner workings of the adaptive replacement cache (arc). I see there are arc_bufs and arc_buf_hdrs. Each arc_buf_hdr points to an arc_buf_t. The arc_buf_t is really one entry in a list of arc_buf_t entries. The multiple entries are accessed through the arc_buf_t?s b_next member. > > Why does the arc_buf_hdr point to a list of arc_buf_ts and not just one arc_buf_t, i.e., how and why do multiple arc_buf_ts get inserted into this list? >multiple arc_buf_t entries can be strung off of an arc_buf_hdr_t when the same block is accessed from multiple file systems (i.e. snapshots and/or clones).> What is the relationship between arc_buf_hdr?s b_datacnt and b_refcnt? Is b_datacnt the number of arc_buf_ts in the list?yes Does the b_refcnt keep track of all users of all arc_buf_ts in the list?>The refcnt is a count of all *active* users of the buffer. The refcnt should never be larger than the datacnt, but it is possible to have a non-zero datacnt with a zero refcnt. A buffer cannot be evicted while it has a non-zero refcnt.> Thanks for any understanding that anyone can offer. > > Duff > -- > This messages posted from opensolaris.org > _______________________________________________ > zfs-code mailing list > zfs-code at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-code