From: Christoph Hellwig <hch@lst.de>
Date: Wed, 23 Aug 2017 19:10:31 +0200
Subject: [PATCH] block: cache the partition index in struct block_device
Git-commit: c2ee070fb00365d7841f6661dcdc7fbe6620bdf8
Patch-Mainline: v4.14-rc1
References: FATE#323952, FATE#322506
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Acked-by: Hannes Reinecke <hare@suse.de>
---
fs/block_dev.c | 1 +
include/linux/fs.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 01e45eb..ab07bb1d5 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1451,6 +1451,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
bdev->bd_disk = disk;
bdev->bd_queue = disk->queue;
bdev->bd_contains = bdev;
+ bdev->bd_partno = partno;
if (!partno) {
ret = -ENXIO;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 834d5a1..cb42fd6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -424,6 +424,7 @@ struct block_device {
#endif
struct block_device * bd_contains;
unsigned bd_block_size;
+ u8 bd_partno;
struct hd_struct * bd_part;
/* number of times partitions within this device have been opened. */
unsigned bd_part_count;
--
1.8.5.6