aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r--drivers/block/rbd.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index d250549d27a4..01ed7672a076 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -323,6 +323,7 @@ struct rbd_device {
323 int dev_id; /* blkdev unique id */ 323 int dev_id; /* blkdev unique id */
324 324
325 int major; /* blkdev assigned major */ 325 int major; /* blkdev assigned major */
326 int minor;
326 struct gendisk *disk; /* blkdev's gendisk and rq */ 327 struct gendisk *disk; /* blkdev's gendisk and rq */
327 328
328 u32 image_format; /* Either 1 or 2 */ 329 u32 image_format; /* Either 1 or 2 */
@@ -3397,7 +3398,7 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
3397 snprintf(disk->disk_name, sizeof(disk->disk_name), RBD_DRV_NAME "%d", 3398 snprintf(disk->disk_name, sizeof(disk->disk_name), RBD_DRV_NAME "%d",
3398 rbd_dev->dev_id); 3399 rbd_dev->dev_id);
3399 disk->major = rbd_dev->major; 3400 disk->major = rbd_dev->major;
3400 disk->first_minor = 0; 3401 disk->first_minor = rbd_dev->minor;
3401 disk->fops = &rbd_bd_ops; 3402 disk->fops = &rbd_bd_ops;
3402 disk->private_data = rbd_dev; 3403 disk->private_data = rbd_dev;
3403 3404
@@ -3469,7 +3470,14 @@ static ssize_t rbd_major_show(struct device *dev,
3469 return sprintf(buf, "%d\n", rbd_dev->major); 3470 return sprintf(buf, "%d\n", rbd_dev->major);
3470 3471
3471 return sprintf(buf, "(none)\n"); 3472 return sprintf(buf, "(none)\n");
3473}
3474
3475static ssize_t rbd_minor_show(struct device *dev,
3476 struct device_attribute *attr, char *buf)
3477{
3478 struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
3472 3479
3480 return sprintf(buf, "%d\n", rbd_dev->minor);
3473} 3481}
3474 3482
3475static ssize_t rbd_client_id_show(struct device *dev, 3483static ssize_t rbd_client_id_show(struct device *dev,
@@ -3591,6 +3599,7 @@ static ssize_t rbd_image_refresh(struct device *dev,
3591static DEVICE_ATTR(size, S_IRUGO, rbd_size_show, NULL); 3599static DEVICE_ATTR(size, S_IRUGO, rbd_size_show, NULL);
3592static DEVICE_ATTR(features, S_IRUGO, rbd_features_show, NULL); 3600static DEVICE_ATTR(features, S_IRUGO, rbd_features_show, NULL);
3593static DEVICE_ATTR(major, S_IRUGO, rbd_major_show, NULL); 3601static DEVICE_ATTR(major, S_IRUGO, rbd_major_show, NULL);
3602static DEVICE_ATTR(minor, S_IRUGO, rbd_minor_show, NULL);
3594static DEVICE_ATTR(client_id, S_IRUGO, rbd_client_id_show, NULL); 3603static DEVICE_ATTR(client_id, S_IRUGO, rbd_client_id_show, NULL);
3595static DEVICE_ATTR(pool, S_IRUGO, rbd_pool_show, NULL); 3604static DEVICE_ATTR(pool, S_IRUGO, rbd_pool_show, NULL);
3596static DEVICE_ATTR(pool_id, S_IRUGO, rbd_pool_id_show, NULL); 3605static DEVICE_ATTR(pool_id, S_IRUGO, rbd_pool_id_show, NULL);
@@ -3604,6 +3613,7 @@ static struct attribute *rbd_attrs[] = {
3604 &dev_attr_size.attr, 3613 &dev_attr_size.attr,
3605 &dev_attr_features.attr, 3614 &dev_attr_features.attr,
3606 &dev_attr_major.attr, 3615 &dev_attr_major.attr,
3616 &dev_attr_minor.attr,
3607 &dev_attr_client_id.attr, 3617 &dev_attr_client_id.attr,
3608 &dev_attr_pool.attr, 3618 &dev_attr_pool.attr,
3609 &dev_attr_pool_id.attr, 3619 &dev_attr_pool_id.attr,
@@ -4848,6 +4858,7 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev)
4848 if (ret < 0) 4858 if (ret < 0)
4849 goto err_out_id; 4859 goto err_out_id;
4850 rbd_dev->major = ret; 4860 rbd_dev->major = ret;
4861 rbd_dev->minor = 0;
4851 4862
4852 /* Set up the blkdev mapping. */ 4863 /* Set up the blkdev mapping. */
4853 4864