]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/btree_iter.c
Update bcachefs sources to a8115093df bcachefs: Fix divide by zero in rebalance_work()
[bcachefs-tools-debian] / libbcachefs / btree_iter.c
index 06dbb61710a9b686e4c02ec86f9c12c73e3b40a4..5216d3391079d5b6f286b38ba27298569808f3ee 100644 (file)
@@ -14,7 +14,7 @@
 #include "extents.h"
 #include "journal.h"
 #include "replicas.h"
-#include "subvolume.h"
+#include "snapshot.h"
 #include "trace.h"
 
 #include <linux/random.h>
@@ -1008,7 +1008,7 @@ retry_all:
        /*
         * We used to assert that all paths had been traversed here
         * (path->uptodate < BTREE_ITER_NEED_TRAVERSE); however, since
-        * path->Should_be_locked is not set yet, we we might have unlocked and
+        * path->should_be_locked is not set yet, we might have unlocked and
         * then failed to relock a path - that's fine.
         */
 err:
@@ -2738,9 +2738,9 @@ void bch2_trans_node_iter_init(struct btree_trans *trans,
                               unsigned depth,
                               unsigned flags)
 {
-       flags |= BTREE_ITER_NOT_EXTENTS;
-       flags |= __BTREE_ITER_ALL_SNAPSHOTS;
-       flags |= BTREE_ITER_ALL_SNAPSHOTS;
+       flags |= BTREE_ITER_NOT_EXTENTS;
+       flags |= __BTREE_ITER_ALL_SNAPSHOTS;
+       flags |= BTREE_ITER_ALL_SNAPSHOTS;
 
        bch2_trans_iter_init_common(trans, iter, btree_id, pos, locks_want, depth,
                               __bch2_btree_iter_flags(trans, btree_id, flags),
@@ -2898,12 +2898,14 @@ static void bch2_trans_alloc_paths(struct btree_trans *trans, struct bch_fs *c)
 #ifdef __KERNEL__
        p = this_cpu_xchg(c->btree_paths_bufs->path, NULL);
 #endif
-       if (!p)
+       if (!p) {
                p = mempool_alloc(&trans->c->btree_paths_pool, GFP_NOFS);
-       /*
-        * paths need to be zeroed, bch2_check_for_deadlock looks at paths in
-        * other threads
-        */
+               /*
+                * paths need to be zeroed, bch2_check_for_deadlock looks at
+                * paths in other threads
+                */
+               memset(p, 0, paths_bytes);
+       }
 
        trans->paths            = p; p += paths_bytes;
        trans->updates          = p; p += updates_bytes;