Skip to content

Commit 3c5e13c

Browse files
author
Zygo Blaxell
committed
context: log when LOGICAL_INO returns 0 refs
There was a bug in kernel 6.3 where LOGICAL_INO with IGNORE_OFFSET sometimes fails to ignore the offset. That bug is now fixed, but LOGICAL_INO still returns 0 refs much more often than seems appropriate. This is most likely because bees frequently deletes extents while there is still work waiting for them in Task queues. In this case, LOGICAL_INO correctly returns an empty list, because every reference to some extent is deleted, but the new extent tree with that extent removed is not yet committed in btrfs. Add a DEBUG-level log message and an event counter to track these events. In the absence of a kernel bug, the debug message may indicate CPU time was wasted performing a search whose outcome could have been predicted. Signed-off-by: Zygo Blaxell <[email protected]>
1 parent a6ca2fa commit 3c5e13c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

docs/event-counters.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ resolve
296296

297297
The `resolve` event group consists of operations related to translating a btrfs virtual block address (i.e. physical block address) to a `(root, inode, offset)` tuple (i.e. locating and opening the file containing a matching block). `resolve` is the top level, `chase` and `adjust` are the lower two levels.
298298

299+
* `resolve_empty`: The `LOGICAL_INO` ioctl returned successfully with an empty reference list (0 items).
299300
* `resolve_fail`: The `LOGICAL_INO` ioctl returned an error.
300301
* `resolve_large`: The `LOGICAL_INO` ioctl returned more than 2730 results (the limit of the v1 ioctl).
301302
* `resolve_ms`: Total time spent in the `LOGICAL_INO` ioctl (i.e. wallclock time, not kernel CPU time).

src/bees-context.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,10 @@ BeesContext::resolve_addr_uncached(BeesAddress addr)
821821

822822
// Avoid performance problems - pretend resolve failed if there are too many refs
823823
const size_t rv_count = log_ino.m_iors.size();
824+
if (!rv_count) {
825+
BEESLOGDEBUG("LOGICAL_INO returned 0 refs at " << to_hex(addr));
826+
BEESCOUNT(resolve_empty);
827+
}
824828
if (rv_count < BEES_MAX_EXTENT_REF_COUNT) {
825829
rv.m_biors = vector<BtrfsInodeOffsetRoot>(log_ino.m_iors.begin(), log_ino.m_iors.end());
826830
} else {

0 commit comments

Comments
 (0)