aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-07-03 17:01:19 -0400
committerSage Weil <sage@inktank.com>2012-07-30 21:15:49 -0400
commitde71a2970d57463d3d965025e33ec3adcf391248 (patch)
treec1f2c05961798650d5cefeea54277033bb2990a6 /drivers/block/rbd.c
parent8e94af8e2b582e5915abc171a28130881d1c26e4 (diff)
rbd: rename rbd_device->id
The "id" field of an rbd device structure represents the unique client-local device id mapped to the underlying rbd image. Each rbd image will have another id--the image id--and each snapshot has its own id as well. The simple name "id" no longer conveys the information one might like to have. Rename the device "id" field in struct rbd_dev to be "dev_id" to make it a little more obvious what we're dealing with without having to think more about context. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r--drivers/block/rbd.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index ae65fac2c42b..fe7a9e15b6f2 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -147,7 +147,7 @@ struct rbd_snap {
147 * a single device 147 * a single device
148 */ 148 */
149struct rbd_device { 149struct rbd_device {
150 int id; /* blkdev unique id */ 150 int dev_id; /* blkdev unique id */
151 151
152 int major; /* blkdev assigned major */ 152 int major; /* blkdev assigned major */
153 struct gendisk *disk; /* blkdev's gendisk and rq */ 153 struct gendisk *disk; /* blkdev's gendisk and rq */
@@ -1782,7 +1782,7 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
1782 goto out; 1782 goto out;
1783 1783
1784 snprintf(disk->disk_name, sizeof(disk->disk_name), RBD_DRV_NAME "%d", 1784 snprintf(disk->disk_name, sizeof(disk->disk_name), RBD_DRV_NAME "%d",
1785 rbd_dev->id); 1785 rbd_dev->dev_id);
1786 disk->major = rbd_dev->major; 1786 disk->major = rbd_dev->major;
1787 disk->first_minor = 0; 1787 disk->first_minor = 0;
1788 disk->fops = &rbd_bd_ops; 1788 disk->fops = &rbd_bd_ops;
@@ -2171,7 +2171,7 @@ static int rbd_bus_add_dev(struct rbd_device *rbd_dev)
2171 dev->type = &rbd_device_type; 2171 dev->type = &rbd_device_type;
2172 dev->parent = &rbd_root_dev; 2172 dev->parent = &rbd_root_dev;
2173 dev->release = rbd_dev_release; 2173 dev->release = rbd_dev_release;
2174 dev_set_name(dev, "%d", rbd_dev->id); 2174 dev_set_name(dev, "%d", rbd_dev->dev_id);
2175 ret = device_register(dev); 2175 ret = device_register(dev);
2176 if (ret < 0) 2176 if (ret < 0)
2177 goto out; 2177 goto out;
@@ -2219,7 +2219,7 @@ static atomic64_t rbd_id_max = ATOMIC64_INIT(0);
2219 */ 2219 */
2220static void rbd_id_get(struct rbd_device *rbd_dev) 2220static void rbd_id_get(struct rbd_device *rbd_dev)
2221{ 2221{
2222 rbd_dev->id = atomic64_inc_return(&rbd_id_max); 2222 rbd_dev->dev_id = atomic64_inc_return(&rbd_id_max);
2223 2223
2224 spin_lock(&rbd_dev_list_lock); 2224 spin_lock(&rbd_dev_list_lock);
2225 list_add_tail(&rbd_dev->node, &rbd_dev_list); 2225 list_add_tail(&rbd_dev->node, &rbd_dev_list);
@@ -2233,7 +2233,7 @@ static void rbd_id_get(struct rbd_device *rbd_dev)
2233static void rbd_id_put(struct rbd_device *rbd_dev) 2233static void rbd_id_put(struct rbd_device *rbd_dev)
2234{ 2234{
2235 struct list_head *tmp; 2235 struct list_head *tmp;
2236 int rbd_id = rbd_dev->id; 2236 int rbd_id = rbd_dev->dev_id;
2237 int max_id; 2237 int max_id;
2238 2238
2239 BUG_ON(rbd_id < 1); 2239 BUG_ON(rbd_id < 1);
@@ -2472,7 +2472,7 @@ static ssize_t rbd_add(struct bus_type *bus,
2472 /* Fill in the device name, now that we have its id. */ 2472 /* Fill in the device name, now that we have its id. */
2473 BUILD_BUG_ON(DEV_NAME_LEN 2473 BUILD_BUG_ON(DEV_NAME_LEN
2474 < sizeof (RBD_DRV_NAME) + MAX_INT_FORMAT_WIDTH); 2474 < sizeof (RBD_DRV_NAME) + MAX_INT_FORMAT_WIDTH);
2475 sprintf(rbd_dev->name, "%s%d", RBD_DRV_NAME, rbd_dev->id); 2475 sprintf(rbd_dev->name, "%s%d", RBD_DRV_NAME, rbd_dev->dev_id);
2476 2476
2477 /* parse add command */ 2477 /* parse add command */
2478 rc = rbd_add_parse_args(rbd_dev, buf, &mon_addrs, &mon_addrs_size, 2478 rc = rbd_add_parse_args(rbd_dev, buf, &mon_addrs, &mon_addrs_size,
@@ -2549,7 +2549,7 @@ err_nomem:
2549 return (ssize_t) rc; 2549 return (ssize_t) rc;
2550} 2550}
2551 2551
2552static struct rbd_device *__rbd_get_dev(unsigned long id) 2552static struct rbd_device *__rbd_get_dev(unsigned long dev_id)
2553{ 2553{
2554 struct list_head *tmp; 2554 struct list_head *tmp;
2555 struct rbd_device *rbd_dev; 2555 struct rbd_device *rbd_dev;
@@ -2557,7 +2557,7 @@ static struct rbd_device *__rbd_get_dev(unsigned long id)
2557 spin_lock(&rbd_dev_list_lock); 2557 spin_lock(&rbd_dev_list_lock);
2558 list_for_each(tmp, &rbd_dev_list) { 2558 list_for_each(tmp, &rbd_dev_list) {
2559 rbd_dev = list_entry(tmp, struct rbd_device, node); 2559 rbd_dev = list_entry(tmp, struct rbd_device, node);
2560 if (rbd_dev->id == id) { 2560 if (rbd_dev->dev_id == dev_id) {
2561 spin_unlock(&rbd_dev_list_lock); 2561 spin_unlock(&rbd_dev_list_lock);
2562 return rbd_dev; 2562 return rbd_dev;
2563 } 2563 }