Separate add_un_ref for easier tracing (#27652)
This commit is contained in:
parent
e42a39024d
commit
6561428278
|
@ -273,15 +273,16 @@ impl<T: IndexValue> AccountMapEntryInner<T> {
|
||||||
self.ref_count.load(Ordering::Acquire)
|
self.ref_count.load(Ordering::Acquire)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_un_ref(&self, add: bool) {
|
pub fn addref(&self) {
|
||||||
if add {
|
|
||||||
self.ref_count.fetch_add(1, Ordering::Release);
|
self.ref_count.fetch_add(1, Ordering::Release);
|
||||||
} else {
|
self.set_dirty(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn unref(&self) {
|
||||||
let previous = self.ref_count.fetch_sub(1, Ordering::Release);
|
let previous = self.ref_count.fetch_sub(1, Ordering::Release);
|
||||||
if previous == 0 {
|
if previous == 0 {
|
||||||
inc_new_counter_info!("accounts_index-deref_from_0", 1);
|
inc_new_counter_info!("accounts_index-deref_from_0", 1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
self.set_dirty(true);
|
self.set_dirty(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,11 +359,11 @@ impl<T: IndexValue> ReadAccountMapEntry<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unref(&self) {
|
pub fn unref(&self) {
|
||||||
self.borrow_owned_entry().add_un_ref(false);
|
self.borrow_owned_entry().unref();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addref(&self) {
|
pub fn addref(&self) {
|
||||||
self.borrow_owned_entry().add_un_ref(true);
|
self.borrow_owned_entry().addref();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1386,7 +1387,7 @@ impl<T: IndexValue> AccountsIndex<T> {
|
||||||
};
|
};
|
||||||
cache = match result {
|
cache = match result {
|
||||||
AccountsIndexScanResult::Unref => {
|
AccountsIndexScanResult::Unref => {
|
||||||
locked_entry.add_un_ref(false);
|
locked_entry.unref();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
AccountsIndexScanResult::KeepInMemory => true,
|
AccountsIndexScanResult::KeepInMemory => true,
|
||||||
|
|
|
@ -437,7 +437,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
|
||||||
pub fn unref(&self, pubkey: &Pubkey) {
|
pub fn unref(&self, pubkey: &Pubkey) {
|
||||||
self.get_internal(pubkey, |entry| {
|
self.get_internal(pubkey, |entry| {
|
||||||
if let Some(entry) = entry {
|
if let Some(entry) = entry {
|
||||||
entry.add_un_ref(false)
|
entry.unref();
|
||||||
}
|
}
|
||||||
(true, ())
|
(true, ())
|
||||||
})
|
})
|
||||||
|
@ -557,7 +557,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
|
||||||
reclaim,
|
reclaim,
|
||||||
);
|
);
|
||||||
if addref {
|
if addref {
|
||||||
current.add_un_ref(true);
|
current.addref();
|
||||||
}
|
}
|
||||||
current.set_dirty(true);
|
current.set_dirty(true);
|
||||||
slot_list.len()
|
slot_list.len()
|
||||||
|
|
Loading…
Reference in New Issue