]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/io.c
Update bcachefs sources to 2f4e24d856 bcachefs: Split out dev_buckets_free()
[bcachefs-tools-debian] / libbcachefs / io.c
index 223344e1ad74c303802fd1858c913ead1f8de038..82171996638c962e6aeb334bb0983153d91c795d 100644 (file)
@@ -470,8 +470,8 @@ void bch2_submit_wbio_replicas(struct bch_write_bio *wbio, struct bch_fs *c,
                ca = bch_dev_bkey_exists(c, ptr->dev);
 
                if (to_entry(ptr + 1) < ptrs.end) {
-                       n = to_wbio(bio_clone_fast(&wbio->bio, GFP_NOIO,
-                                                  &ca->replica_set));
+                       n = to_wbio(bio_alloc_clone(NULL, &wbio->bio,
+                                               GFP_NOIO, &ca->replica_set));
 
                        n->bio.bi_end_io        = wbio->bio.bi_end_io;
                        n->bio.bi_private       = wbio->bio.bi_private;
@@ -701,7 +701,8 @@ static struct bio *bch2_write_bio_alloc(struct bch_fs *c,
 
        pages = min(pages, BIO_MAX_VECS);
 
-       bio = bio_alloc_bioset(GFP_NOIO, pages, &c->bio_write);
+       bio = bio_alloc_bioset(NULL, pages, 0,
+                              GFP_NOIO, &c->bio_write);
        wbio                    = wbio_init(bio);
        wbio->put_bio           = true;
        /* copy WRITE_SYNC flag */
@@ -1288,6 +1289,7 @@ void bch2_write(struct closure *cl)
                goto err;
        }
 
+       this_cpu_add(c->counters[BCH_COUNTER_io_write], bio_sectors(bio));
        bch2_increment_clock(c, bio_sectors(bio), WRITE);
 
        data_len = min_t(u64, bio->bi_iter.bi_size,
@@ -1441,7 +1443,7 @@ static struct promote_op *__promote_alloc(struct bch_fs *c,
                goto err;
 
        rbio_init(&(*rbio)->bio, opts);
-       bio_init(&(*rbio)->bio, (*rbio)->bio.bi_inline_vecs, pages);
+       bio_init(&(*rbio)->bio, NULL, (*rbio)->bio.bi_inline_vecs, pages, 0);
 
        if (bch2_bio_alloc_pages(&(*rbio)->bio, sectors << 9,
                                 GFP_NOIO))
@@ -1456,7 +1458,7 @@ static struct promote_op *__promote_alloc(struct bch_fs *c,
                goto err;
 
        bio = &op->write.op.wbio.bio;
-       bio_init(bio, bio->bi_inline_vecs, pages);
+       bio_init(bio, NULL, bio->bi_inline_vecs, pages, 0);
 
        ret = bch2_migrate_write_init(c, &op->write,
                        writepoint_hashed((unsigned long) current),
@@ -1985,18 +1987,18 @@ static noinline void read_from_stale_dirty_pointer(struct btree_trans *trans,
                             PTR_BUCKET_POS(c, &ptr),
                             BTREE_ITER_CACHED);
 
-       pr_buf(&buf, "Attempting to read from stale dirty pointer:");
-       pr_indent_push(&buf, 2);
-       pr_newline(&buf);
+       prt_printf(&buf, "Attempting to read from stale dirty pointer:");
+       printbuf_indent_add(&buf, 2);
+       prt_newline(&buf);
 
        bch2_bkey_val_to_text(&buf, c, k);
-       pr_newline(&buf);
+       prt_newline(&buf);
 
-       pr_buf(&buf, "memory gen: %u", *bucket_gen(ca, iter.pos.offset));
+       prt_printf(&buf, "memory gen: %u", *bucket_gen(ca, iter.pos.offset));
 
        ret = lockrestart_do(trans, bkey_err(k = bch2_btree_iter_peek_slot(&iter)));
        if (!ret) {
-               pr_newline(&buf);
+               prt_newline(&buf);
                bch2_bkey_val_to_text(&buf, c, k);
        }
 
@@ -2138,8 +2140,10 @@ get_bio:
        } else if (bounce) {
                unsigned sectors = pick.crc.compressed_size;
 
-               rbio = rbio_init(bio_alloc_bioset(GFP_NOIO,
+               rbio = rbio_init(bio_alloc_bioset(NULL,
                                                  DIV_ROUND_UP(sectors, PAGE_SECTORS),
+                                                 0,
+                                                 GFP_NOIO,
                                                  &c->bio_read_split),
                                 orig->opts);
 
@@ -2155,8 +2159,8 @@ get_bio:
                 * from the whole bio, in which case we don't want to retry and
                 * lose the error)
                 */
-               rbio = rbio_init(bio_clone_fast(&orig->bio, GFP_NOIO,
-                                               &c->bio_read_split),
+               rbio = rbio_init(bio_alloc_clone(NULL, &orig->bio, GFP_NOIO,
+                                                &c->bio_read_split),
                                 orig->opts);
                rbio->bio.bi_iter = iter;
                rbio->split     = true;
@@ -2200,6 +2204,7 @@ get_bio:
        if (rbio->bounce)
                trace_read_bounce(&rbio->bio);
 
+       this_cpu_add(c->counters[BCH_COUNTER_io_read], bio_sectors(&rbio->bio));
        bch2_increment_clock(c, bio_sectors(&rbio->bio), READ);
 
        /*