]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
block: use bdev_get_queue() in bio.c
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 14 Oct 2021 14:03:28 +0000 (15:03 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Oct 2021 12:17:36 +0000 (06:17 -0600)
Convert bdev->bd_disk->queue to bdev_get_queue(), it's uses a cached
queue pointer and so is faster.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/85c36ea784d285a5075baa10049e6b59e15fb484.1634219547.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio.c

index a3c9ff23a036fb291d1eed80bb97fbeeb29043af..5fb8092577bf376a80d5bf68e5e9b11d176320d2 100644 (file)
@@ -965,7 +965,7 @@ EXPORT_SYMBOL(bio_add_pc_page);
 int bio_add_zone_append_page(struct bio *bio, struct page *page,
                             unsigned int len, unsigned int offset)
 {
-       struct request_queue *q = bio->bi_bdev->bd_disk->queue;
+       struct request_queue *q = bdev_get_queue(bio->bi_bdev);
        bool same_page = false;
 
        if (WARN_ON_ONCE(bio_op(bio) != REQ_OP_ZONE_APPEND))
@@ -1070,7 +1070,7 @@ static int bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter)
 
 static int bio_iov_bvec_set_append(struct bio *bio, struct iov_iter *iter)
 {
-       struct request_queue *q = bio->bi_bdev->bd_disk->queue;
+       struct request_queue *q = bdev_get_queue(bio->bi_bdev);
        struct iov_iter i = *iter;
 
        iov_iter_truncate(&i, queue_max_zone_append_sectors(q) << 9);
@@ -1148,7 +1148,7 @@ static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
 {
        unsigned short nr_pages = bio->bi_max_vecs - bio->bi_vcnt;
        unsigned short entries_left = bio->bi_max_vecs - bio->bi_vcnt;
-       struct request_queue *q = bio->bi_bdev->bd_disk->queue;
+       struct request_queue *q = bdev_get_queue(bio->bi_bdev);
        unsigned int max_append_sectors = queue_max_zone_append_sectors(q);
        struct bio_vec *bv = bio->bi_io_vec + bio->bi_vcnt;
        struct page **pages = (struct page **)bv;
@@ -1485,10 +1485,10 @@ again:
                return;
 
        if (bio->bi_bdev && bio_flagged(bio, BIO_TRACKED))
-               rq_qos_done_bio(bio->bi_bdev->bd_disk->queue, bio);
+               rq_qos_done_bio(bdev_get_queue(bio->bi_bdev), bio);
 
        if (bio->bi_bdev && bio_flagged(bio, BIO_TRACE_COMPLETION)) {
-               trace_block_bio_complete(bio->bi_bdev->bd_disk->queue, bio);
+               trace_block_bio_complete(bdev_get_queue(bio->bi_bdev), bio);
                bio_clear_flag(bio, BIO_TRACE_COMPLETION);
        }