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%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
`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> |
||
| bin | ||
| docs | ||
| include/crucible | ||
| lib | ||
| scripts | ||
| src | ||
| test | ||
| .gitignore | ||
| COPYING | ||
| Defines.mk | ||
| Makefile | ||
| makeflags | ||
| README.md | ||
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
- Whole-filesystem dedupe - has no include/exclude filters, does not accept file lists
- Requires root privilege (
CAP_SYS_ADMINplus the usual filesystem read/modify caps) - First run may increase metadata space usage if many snapshots exist
- Constant hash table size - no decreased RAM usage if data set becomes smaller
- btrfs only
Installation and Usage
Recommended Reading
- bees Gotchas
- btrfs kernel bugs - especially DATA CORRUPTION WARNING for old kernels
- bees vs. other btrfs features
- What to do when something goes wrong
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 & License
Copyright 2015-2025 Zygo Blaxell bees@furryterror.org.
GPL (version 3 or later).