On Tue, Jul 16, 2013 at 11:14:29AM -0400, sheng qiu wrote:
> Hi Kent,
> 
> sorry to bother you again. i got another question. it's about the
> bucket->pin. Can you explain what's the usage for this data member?
> i see only bucket with pin value "0" can be invalidated. And only "0"
> valued pin bucket's prio will be decreased within the
> bch_rescale_priorities(). But every time when you write data to
> bucket, you increase that bucket's pin, and i did not see when it will
> be decreased. This makes me a little confused. Or do i miss anything
> where you might reset it?

It's to keep buckets from being garbage collected after they're
allocated but before we've added a pointer to them to the btree.

I've actually been meaning to get rid of it, and just keep a refcount on
the open buckets (the ones pick_data_bucket() uses) and have garbage
collection mark those buckets too.

Originally I also used it for preventing buckets from being invalidated
while we were reading from them (on cache hit), but I got rid of that
ages ago for performance reasons - now it just checks after the read
finishes if it was invalidated, and if so rereads from the backing
device.
--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to