Hi Kent, Thanks for you previous reply. I know bcache does not care write hit, but is there a easy way to check write hit for write request? If i reuse the search_recurse() as what you do for read request, will it has any impact? Thanks, Sheng On Tue, Jul 16, 2013 at 4:59 PM, Kent Overstreet <kmo@xxxxxxxxxxxxx> wrote: > 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. -- Sheng Qiu Texas A & M University Room 332B Wisenbaker email: herbert1984106@xxxxxxxxx College Station, TX 77843-3259 -- To unsubscribe from this list: send the line "unsubscribe linux-bcache" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html