This works around a btree locking issue - we can't be holding read locks
while taking write locks, which currently means we can't have live
iterators holding read locks at commit time.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
        bch_verbose(c, "checking extents");
 
        iter = bch2_trans_get_iter(&trans, BTREE_ID_EXTENTS,
-                                  POS(BCACHEFS_ROOT_INO, 0), 0);
+                                  POS(BCACHEFS_ROOT_INO, 0),
+                                  BTREE_ITER_INTENT);
 retry:
        for_each_btree_key_continue(iter, 0, k, ret) {
                if (bkey_cmp(prev.p, bkey_start_pos(k.k)) > 0) {