]> www.infradead.org Git - users/hch/block.git/commitdiff
bcache: set bi_bdev near bio allocation
authorChristoph Hellwig <hch@lst.de>
Mon, 25 Jan 2021 17:09:22 +0000 (18:09 +0100)
committerChristoph Hellwig <hch@lst.de>
Tue, 2 Feb 2021 09:39:30 +0000 (10:39 +0100)
Shuffle the code around a bit to set bi_bdev early, in preparation
for upcoming bio_alloc changes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/md/bcache/debug.c
drivers/md/bcache/io.c
drivers/md/bcache/movinggc.c
drivers/md/bcache/request.c

index 589a052efeb1abedea83685173f1a8767c3e6966..1b54534973b03a11b9c2a2484a6a9e48e56b26f6 100644 (file)
@@ -50,7 +50,6 @@ void bch_btree_verify(struct btree *b)
        v->keys.ops = b->keys.ops;
 
        bio = bch_bbio_alloc(b->c);
-       bio_set_dev(bio, c->cache->bdev);
        bio->bi_iter.bi_sector  = PTR_OFFSET(&b->key, 0);
        bio->bi_iter.bi_size    = KEY_SIZE(&v->key) << 9;
        bio->bi_opf             = REQ_OP_READ | REQ_META;
index e4388fe3ab7ef96ead612d775ce64270ec9ea318..3ee85758f5f8a16641ebdcac6dadcf688bc38977 100644 (file)
@@ -27,6 +27,7 @@ struct bio *bch_bbio_alloc(struct cache_set *c)
        struct bio *bio = &b->bio;
 
        bio_init(bio, bio->bi_inline_vecs, meta_bucket_pages(&c->cache->sb));
+       bio_set_dev(bio, c->cache->bdev);
 
        return bio;
 }
@@ -36,8 +37,6 @@ void __bch_submit_bbio(struct bio *bio, struct cache_set *c)
        struct bbio *b = container_of(bio, struct bbio, bio);
 
        bio->bi_iter.bi_sector  = PTR_OFFSET(&b->key, 0);
-       bio_set_dev(bio, c->cache->bdev);
-
        b->submit_time_us = local_clock_us();
        closure_bio_submit(c, bio, bio->bi_private);
 }
index b9c3d27ec093a1ba1ab30e6949bbbb8888625b49..a22f4bbb79e6029ec0efd2eb66fd03d7dc280cd0 100644 (file)
@@ -81,6 +81,7 @@ static void moving_init(struct moving_io *io)
 
        bio_init(bio, bio->bi_inline_vecs,
                 DIV_ROUND_UP(KEY_SIZE(&io->w->key), PAGE_SECTORS));
+       bio_set_dev(bio, io->op.c->cache->bdev);
        bio_get(bio);
        bio_set_prio(bio, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0));
 
index 29c231758293e2bb99bbc2026b076813a06dbf27..6303d9708c0c5a584e6c836d6a01fe70db49f5a4 100644 (file)
@@ -570,7 +570,7 @@ static int cache_lookup_fn(struct btree_op *op, struct btree *b, struct bkey *k)
         * and reread from the backing device (but we don't pass that
         * error up anywhere).
         */
-
+       bio_set_dev(n, b->c->cache->bdev);
        __bch_submit_bbio(n, b->c);
        return n == bio ? MAP_DONE : MAP_CONTINUE;
 }