list -> slot_list (#23355)

This commit is contained in:
Jeff Washington (jwash) 2022-02-27 23:08:58 -06:00 committed by GitHub
parent 186bb19965
commit 30dafc7135
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -469,7 +469,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
/// or, 'account_info' is appended to the slot list if the slot did not exist previously. /// or, 'account_info' is appended to the slot list if the slot did not exist previously.
/// returns true if caller should addref /// returns true if caller should addref
fn update_slot_list( fn update_slot_list(
list: &mut SlotList<T>, slot_list: &mut SlotList<T>,
slot: Slot, slot: Slot,
account_info: T, account_info: T,
_other_slot: Option<Slot>, _other_slot: Option<Slot>,
@ -479,20 +479,20 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
let mut addref = !account_info.is_cached(); let mut addref = !account_info.is_cached();
// find other dirty entries from the same slot // find other dirty entries from the same slot
for list_index in 0..list.len() { for list_index in 0..slot_list.len() {
let (s, previous_update_value) = &list[list_index]; let (s, previous_update_value) = &slot_list[list_index];
if *s == slot { if *s == slot {
let previous_was_cached = previous_update_value.is_cached(); let previous_was_cached = previous_update_value.is_cached();
addref = addref && previous_was_cached; addref = addref && previous_was_cached;
let mut new_item = (slot, account_info); let mut new_item = (slot, account_info);
std::mem::swap(&mut new_item, &mut list[list_index]); std::mem::swap(&mut new_item, &mut slot_list[list_index]);
if previous_slot_entry_was_cached { if previous_slot_entry_was_cached {
assert!(previous_was_cached); assert!(previous_was_cached);
} else { } else {
reclaims.push(new_item); reclaims.push(new_item);
} }
list[(list_index + 1)..] slot_list[(list_index + 1)..]
.iter() .iter()
.for_each(|item| assert!(item.0 != slot)); .for_each(|item| assert!(item.0 != slot));
return addref; return addref;
@ -500,7 +500,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
} }
// if we make it here, we did not find the slot in the list // if we make it here, we did not find the slot in the list
list.push((slot, account_info)); slot_list.push((slot, account_info));
addref addref
} }