summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-01-24 13:02:34 +0300
committerJens Axboe <axboe@kernel.dk>2021-01-25 04:17:20 +0300
commit309dca309fc39a9e3c31b916393b74bd174fd74e (patch)
tree2d4687a800a52cfd96482c7c01224236da796102 /include
parentcf9a978f9781fb30b778ee61ef6bd164c655d9ff (diff)
downloadlinux-309dca309fc39a9e3c31b916393b74bd174fd74e.tar.xz
block: store a block_device pointer in struct bio
Replace the gendisk pointer in struct bio with a pointer to the newly improved struct block device. From that the gendisk can be trivially accessed with an extra indirection, but it also allows to directly look up all information related to partition remapping. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include')
-rw-r--r--include/linux/bio.h18
-rw-r--r--include/linux/blk-mq.h4
-rw-r--r--include/linux/blk_types.h3
-rw-r--r--include/linux/blkdev.h5
4 files changed, 14 insertions, 16 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 1edda614f7ce..12af7aa5db37 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -483,24 +483,22 @@ extern void bvec_free(mempool_t *, struct bio_vec *, unsigned int);
extern unsigned int bvec_nr_vecs(unsigned short idx);
extern const char *bio_devname(struct bio *bio, char *buffer);
-#define bio_set_dev(bio, bdev) \
-do { \
- if ((bio)->bi_disk != (bdev)->bd_disk) \
- bio_clear_flag(bio, BIO_THROTTLED);\
- (bio)->bi_disk = (bdev)->bd_disk; \
- (bio)->bi_partno = (bdev)->bd_partno; \
- bio_associate_blkg(bio); \
+#define bio_set_dev(bio, bdev) \
+do { \
+ if ((bio)->bi_bdev != (bdev)) \
+ bio_clear_flag(bio, BIO_THROTTLED); \
+ (bio)->bi_bdev = (bdev); \
+ bio_associate_blkg(bio); \
} while (0)
#define bio_copy_dev(dst, src) \
do { \
- (dst)->bi_disk = (src)->bi_disk; \
- (dst)->bi_partno = (src)->bi_partno; \
+ (dst)->bi_bdev = (src)->bi_bdev; \
bio_clone_blkg_association(dst, src); \
} while (0)
#define bio_dev(bio) \
- disk_devt((bio)->bi_disk)
+ disk_devt((bio)->bi_bdev->bd_disk)
#ifdef CONFIG_BLK_CGROUP
void bio_associate_blkg(struct bio *bio);
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index d705b174d346..6b410dab48ee 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -602,8 +602,8 @@ static inline void blk_rq_bio_prep(struct request *rq, struct bio *bio,
rq->bio = rq->biotail = bio;
rq->ioprio = bio_prio(bio);
- if (bio->bi_disk)
- rq->rq_disk = bio->bi_disk;
+ if (bio->bi_bdev)
+ rq->rq_disk = bio->bi_bdev->bd_disk;
}
blk_qc_t blk_mq_submit_bio(struct bio *bio);
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 866f74261b3b..8ebd8be3e050 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -222,7 +222,7 @@ static inline void bio_issue_init(struct bio_issue *issue,
*/
struct bio {
struct bio *bi_next; /* request queue link */
- struct gendisk *bi_disk;
+ struct block_device *bi_bdev;
unsigned int bi_opf; /* bottom bits req flags,
* top bits REQ_OP. Use
* accessors.
@@ -231,7 +231,6 @@ struct bio {
unsigned short bi_ioprio;
unsigned short bi_write_hint;
blk_status_t bi_status;
- u8 bi_partno;
atomic_t __bi_remaining;
struct bvec_iter bi_iter;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f94ee3089e01..b55bd534b2e1 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1967,7 +1967,8 @@ void part_end_io_acct(struct block_device *part, struct bio *bio,
*/
static inline unsigned long bio_start_io_acct(struct bio *bio)
{
- return disk_start_io_acct(bio->bi_disk, bio_sectors(bio), bio_op(bio));
+ return disk_start_io_acct(bio->bi_bdev->bd_disk, bio_sectors(bio),
+ bio_op(bio));
}
/**
@@ -1977,7 +1978,7 @@ static inline unsigned long bio_start_io_acct(struct bio *bio)
*/
static inline void bio_end_io_acct(struct bio *bio, unsigned long start_time)
{
- return disk_end_io_acct(bio->bi_disk, bio_op(bio), start_time);
+ return disk_end_io_acct(bio->bi_bdev->bd_disk, bio_op(bio), start_time);
}
int bdev_read_only(struct block_device *bdev);