]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/io.c
Update bcachefs sources to 4837f82ee1 bcachefs: Use cached iterators for alloc btree
[bcachefs-tools-debian] / libbcachefs / io.c
index 4f39132d04abd461a3bea752f5b946d7df9ce0e0..c309080c9de0f530069652513fe40921f7b3b2f9 100644 (file)
@@ -500,6 +500,9 @@ static void bch2_write_done(struct closure *cl)
 
        bch2_time_stats_update(&c->times[BCH_TIME_data_write], op->start_time);
 
+       if (!(op->flags & BCH_WRITE_FROM_INTERNAL))
+               up(&c->io_in_flight);
+
        if (op->end_io) {
                EBUG_ON(cl->parent);
                closure_debug_destroy(cl);
@@ -1258,6 +1261,12 @@ void bch2_write(struct closure *cl)
                goto err;
        }
 
+       /*
+        * Can't ratelimit copygc - we'd deadlock:
+        */
+       if (!(op->flags & BCH_WRITE_FROM_INTERNAL))
+               down(&c->io_in_flight);
+
        bch2_increment_clock(c, bio_sectors(bio), WRITE);
 
        data_len = min_t(u64, bio->bi_iter.bi_size,