]> git.hungrycats.org Git - bees/commitdiff
bees: drop the balance/logical workaround that has been disabled for two years
authorZygo Blaxell <bees@furryterror.org>
Sat, 19 Nov 2022 07:00:17 +0000 (02:00 -0500)
committerZygo Blaxell <bees@furryterror.org>
Wed, 21 Dec 2022 01:50:58 +0000 (20:50 -0500)
Kernels that needed the balance workaround frankly are too buggy
to run bees at all.  The workaround also makes the locking stories
around logical_ino calls and process exit complicated, so get rid of
it completely.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
docs/btrfs-kernel.md
src/bees-context.cc
src/bees.h

index 29cdae52f324ad97a3a115833a3bb6b542e899d7..eb46cbdd9a06e4eb1eee9aa8a20f269336df14f6 100644 (file)
@@ -96,16 +96,6 @@ Workarounds for known kernel bugs
   at the same time can lead to a kernel hang.  The workaround is
   to reduce the thread count to 1 with `-c1`.
 
-* **Tree mod log issues**:  bees will detect that a btrfs balance is
-  running, and pause bees activity until the balance is done.  This avoids
-  running both the `LOGICAL_INO` ioctl and btrfs balance at the same time,
-  which avoids kernel crashes on old kernel versions.
-
-  The numbers for "tree mod log issue #" in the above table are arbitrary.
-  There are a lot of them, and they all behave fairly similarly.
-
-  This workaround is less necessary for kernels 5.4.19 and later.
-
 * **Slow backrefs** (aka toxic extents):  Under certain conditions,
   if the number of references to a single shared extent grows too
   high, the kernel consumes more and more CPU while also holding locks
index 04fadff291bcba622e70a01da2f8941284c8e6f1..c49a903703e25cdfc810b11889ec06872365966e 100644 (file)
@@ -752,33 +752,6 @@ BeesResolveAddrResult::BeesResolveAddrResult()
 {
 }
 
-void
-BeesContext::wait_for_balance()
-{
-       if (!BEES_SERIALIZE_BALANCE) {
-               return;
-       }
-
-       Timer balance_timer;
-       BEESNOTE("WORKAROUND: waiting for balance to stop");
-       while (true) {
-               btrfs_ioctl_balance_args args {};
-               const int ret = ioctl(root_fd(), BTRFS_IOC_BALANCE_PROGRESS, &args);
-               if (ret < 0) {
-                       // Either can't get balance status or not running, exit either way
-                       break;
-               }
-
-               if (!(args.state & BTRFS_BALANCE_STATE_RUNNING)) {
-                       // Balance not running, doesn't matter if paused or cancelled
-                       break;
-               }
-
-               BEESLOGDEBUG("WORKAROUND: Waiting " << balance_timer << "s for balance to stop");
-               nanosleep(BEES_BALANCE_POLL_INTERVAL);
-       }
-}
-
 BeesResolveAddrResult
 BeesContext::resolve_addr_uncached(BeesAddress addr)
 {
@@ -790,9 +763,6 @@ BeesContext::resolve_addr_uncached(BeesAddress addr)
        // transaction latency, competing threads, and freeze/SIGSTOP
        // pausing the bees process.
 
-       // Wait for the balance to finish before we run LOGICAL_INO
-       wait_for_balance();
-
         BtrfsIoctlLogicalInoArgs log_ino(addr.get_physical_or_zero());
 
        // Time how long this takes
index b300621d291e6cf283832188081e3cff29433bc8..e411c8d0e83bcc24a97ce567b27cb3f98d9c843d 100644 (file)
@@ -108,12 +108,6 @@ const size_t BEES_MAX_CRAWL_BATCH = 128;
 // Wait this many transids between crawls
 const size_t BEES_TRANSID_FACTOR = 10;
 
-// Wait this long for a balance to stop
-const double BEES_BALANCE_POLL_INTERVAL = 60.0;
-
-// Workaround for tree mod log bugs
-const bool BEES_SERIALIZE_BALANCE = false;
-
 // Workaround for silly dedupe / ineffective readahead behavior
 const size_t BEES_READAHEAD_SIZE = 1024 * 1024;
 
@@ -753,7 +747,6 @@ class BeesContext : public enable_shared_from_this<BeesContext> {
        void set_root_fd(Fd fd);
 
        BeesResolveAddrResult resolve_addr_uncached(BeesAddress addr);
-       void wait_for_balance();
 
        BeesFileRange scan_one_extent(const BeesFileRange &bfr, const Extent &e);
        void rewrite_file_range(const BeesFileRange &bfr);