From: Tang Junhui <tang.junhui@xxxxxxxxxx> Thanks to Mike and Coly's comments. >> + if(ca->set->avail_nbuckets > 0) { >> + ca->set->avail_nbuckets--; >> + bch_update_bucket_in_use(ca->set); >> + } >> + > > I am not sure this needs an atomic. All accesses to this variable are >> done with the bucket_lock held, so that seems correct. Is this right? Yes, you are right. >> static void bch_btree_gc_finish(struct cache_set *c) > available should be removed and this function should return 0. I have changed this function to a void type, so nothing need return. >> + stats.in_use = (c->nbuckets - c->avail_nbuckets) * 100 / c->nbuckets; > > This should instead call bch_update_bucket_in_use to avoid code duplication. OK, I will modify it and resend a v2 patch later. > Overall I think this is a good piece of progress. Thanks for your review and comments again. Tang Junhui