Skip to content

Conversation

@ayurtsev
Copy link

RT-1000-788:

  • Implement helper functions for working with directory cache.

RT-1000-788:
 - Implement helper functions for working with directory cache.

Signed-off-by: Alexander Yurtsev <alex@emcraft.com>
@vladimirkhusainov-emcraft vladimirkhusainov-emcraft merged commit ff37fb7 into emcraft-v3.7.99-ncs1-branch Sep 18, 2025
8 checks passed
@vladimirkhusainov-emcraft vladimirkhusainov-emcraft deleted the rt-1000-788 branch September 18, 2025 17:34
Comment on lines +253 to +262
if (pn->bid >= item->bid) {
if ((next == item && (pn->bid > item->bid || pn->ts > item->ts)) ||
(pn->bid < next->bid && pn->bid > item->bid) ||
(pn->bid == next->bid && pn->bid > item->bid && pn->ts < next->ts) ||
(pn->bid == item->bid && pn->bid < next->bid && pn->ts > item->ts) ||
(pn->bid == item->bid && pn->bid == next->bid && pn->ts < next->ts &&
pn->ts > item->ts)) {
next = pn;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand this condition correctly, it can be simplified by checking if pn is newer than item and older than next:

if ((pn->bid > item->bid || (pn->bid == item->bid && pn->ts > item->ts)) &&
    (pn->bid < next->bid || (pn->bid == next->bid && pn->ts < next->ts)))

Regardless, I'd recommend make file_list ordered by bid/ts in file_list_add_item to speed up this search. This should also make implementation of log_backend_fs_flist_get_max_ts simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants