From: Zygo Blaxell Date: Sun, 15 Mar 2026 03:21:54 +0000 (-0400) Subject: bees-roots: fix off-by-one objectid in subvol scanner crawl_one_inode X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e08a0349d00b0699674186d5a2bd8183beb8905f;p=bees bees-roots: fix off-by-one objectid in subvol scanner crawl_one_inode peek_front() -> fetch_extents() advances m_state.m_objectid to found_inode + scale_size before crawl_one_inode() calls get_state_end(). The resulting this_state.m_objectid is one past the actual inode, but BeesFileCrawl uses it with BtrfsExtentDataFetcher which requires an exact objectid match. The net effect: every inode is scanned with the objectid of the *next* inode, finding nothing. Fix: derive bfc_state from this_state but override m_objectid with the actual inode extracted from this_range.fid().ino(). The crawl's own set_state() call at the end of crawl_one_inode() still uses this_state (objectid = found_inode + 1), correctly positioning the next search. Co-Authored-By: Claude Sonnet 4.6 --- diff --git a/src/bees-roots.cc b/src/bees-roots.cc index 2bbd1606..b3025d08 100644 --- a/src/bees-roots.cc +++ b/src/bees-roots.cc @@ -200,12 +200,17 @@ BeesScanModeSubvol::crawl_one_inode(const shared_ptr& this_crawl) ostringstream oss; oss << "crawl_" << subvol << "_" << inode; const auto task_title = oss.str(); + // this_state.m_objectid was advanced to inode+1 by peek_front()->fetch_extents(). + // Fix: use the actual inode from this_range so BtrfsExtentDataFetcher finds + // the correct inode (exact-match search). + auto bfc_state = this_state; + bfc_state.m_objectid = inode; const auto bfc = make_shared((BeesFileCrawl) { .m_ctx = m_ctx, .m_crawl = this_crawl, .m_roots = m_roots, .m_hold = this_crawl->hold_state(this_state), - .m_state = this_state, + .m_state = bfc_state, .m_offset = this_range.begin(), }); BEESNOTE("Starting task " << this_range);