浏览代码

block: cache the partition index in struct block_device

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Christoph Hellwig 8 年之前
父节点
当前提交
c2ee070fb0
共有 2 个文件被更改,包括 2 次插入0 次删除
  1. 1 0
      fs/block_dev.c
  2. 1 0
      include/linux/fs.h

+ 1 - 0
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;

+ 1 - 0
include/linux/fs.h

@@ -427,6 +427,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;