Watch
1
0
Fork
You've already forked bees
0
mirror of https://github.com/Zygo/bees.git synced 2026-07-22 17:16:43 +00:00
Best-Effort Extent-Same, a btrfs dedupe agent
  • C++ 96.9%
  • C 1.7%
  • Makefile 0.8%
  • Shell 0.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Zygo Blaxell 2d53565c74 progress: work around GCC-16 -Warray-bounds bug
`make_shared<ProgressTrackerState>()` keeps triggering GCC bugs.
The latest failure on GCC-16.0 and GCC-16.1:

	/usr/include/c++/16.1.1/bits/stl_tree.h:1383:19: error: array subscript 1 is outside array bounds of ‘std::_Sp_counted_ptr_inplace<crucible::ProgressTracker<long unsigned int>::ProgressHolderState, std::allocator<void>, __gnu_cxx::_S_atomic> [1]’ [-Werror=array-bounds=]
	../include/crucible/progress.h:46:24: error: array subscript ‘crucible::ProgressTracker<long unsigned int>::ProgressTrackerState[0]’ is partly outside array bounds of ‘unsigned char [40]’ [-Werror=array-bounds=]

The regression is already reported to the GCC project:

	https://www.mail-archive.com/gcc-bugs%40gcc.gnu.org/msg895281.html
	https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123912
	(and its duplicates)

The problem is that GCC's static analyzer forgets that make_shared
intentionally allocated a control block and an object in the same
allocation, and thinks that accesses beyond the end of the control block
are out-of-bounds array accesses.

This workaround is the shortest:  start with a unique_ptr (which has no
control block but does have an exception-safe allocator), then convert
to shared_ptr.  This breaks the allocation into two parts so that GCC
is no longer confused.  As there are typically fewer than 10k progress
tracking items, the separate control blocks will only add a few hundred
KiB of RAM usage.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
2026-05-03 18:18:18 -04:00
bin bees: remove local cruft, throw at github 2016-11-17 12:12:13 -05:00
docs docs: add scan_one extent matching explainer 2026-05-01 23:48:40 -04:00
include/crucible progress: work around GCC-16 -Warray-bounds bug 2026-05-03 18:18:18 -04:00
lib openat2: remove throw() specifier 2026-05-01 23:48:58 -04:00
scripts scripts: don't try to find bees in $DESTDIR at runtime 2026-02-14 00:23:07 -05:00
src bees: handle --version and --help/-h before bees initialisation 2026-05-01 23:48:58 -04:00
test Makefile: armv6l does not have builtin atomics, needs -latomic 2025-09-13 04:43:52 -04:00
.gitignore gitignore: clang creates a lot of *.tmp files 2021-11-29 21:27:48 -05:00
COPYING GPL-3: license it 2016-11-17 12:12:15 -05:00
Defines.mk Add configurable bindir for distros without sbin 2025-07-04 19:44:35 -04:00
Makefile Add configurable bindir for distros without sbin 2025-07-04 19:44:35 -04:00
makeflags makeflags: bump C++ standard to C++17 2026-05-03 18:09:51 -04:00
README.md docs: add scan_one extent matching explainer 2026-05-01 23:48:40 -04:00

BEES

Best-Effort Extent-Same, a btrfs deduplication agent.

About bees

bees is a block-oriented userspace deduplication agent designed to scale up to large btrfs filesystems. It is an offline dedupe combined with an incremental data scan capability to minimize time data spends on disk from write to dedupe.

Strengths

  • Space-efficient hash table - can use as little as 1 GB hash table per 10 TB unique data (0.1GB/TB)
  • Daemon mode - incrementally dedupes new data as it appears
  • Largest extents first - recover more free space during fixed maintenance windows
  • Works with btrfs compression - dedupe any combination of compressed and uncompressed files
  • Whole-filesystem dedupe - scans data only once, even with snapshots and reflinks
  • Persistent hash table for rapid restart after shutdown
  • Constant hash table size - no increased RAM usage if data set becomes larger
  • Works on live data - no scheduled downtime required
  • Automatic self-throttling - reduces system load
  • btrfs support - recovers more free space from btrfs than naive dedupers

Weaknesses

Installation and Usage

More Information

Bug Reports and Contributions

Email bug reports and patches to Zygo Blaxell bees@furryterror.org.

You can also use Github:

    https://github.com/Zygo/bees

Copyright 2015-2025 Zygo Blaxell bees@furryterror.org.

GPL (version 3 or later).