From df040c05daa6e8cf8490087b9523bcbf4183c167 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" <75863576+jeffwashington@users.noreply.github.com> Date: Fri, 3 Sep 2021 10:45:37 -0500 Subject: [PATCH] get rid of unneeded mut and refactor addref (#19594) --- runtime/src/accounts_index.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index 2c18b49881..0d71999ba8 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -190,7 +190,7 @@ impl WriteAccountMapEntry { .build() } - pub fn slot_list(&mut self) -> &SlotList { + pub fn slot_list(&self) -> &SlotList { &*self.borrow_slot_list_guard() } @@ -201,10 +201,6 @@ impl WriteAccountMapEntry { self.with_slot_list_guard_mut(user) } - pub fn ref_count(&self) -> &AtomicU64 { - &self.borrow_owned_entry().ref_count - } - // create an entry that is equivalent to this process: // 1. new empty (refcount=0, slot_list={}) // 2. update(slot, account_info) @@ -329,7 +325,7 @@ impl WriteAccountMapEntry { }); if addref { // If it's the first non-cache insert, also bump the stored ref count - self.ref_count().fetch_add(1, Ordering::Relaxed); + self.borrow_owned_entry().add_un_ref(true); } } }