summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-07-03 16:01:18 -0500
committerSage Weil <sage@inktank.com>2012-07-30 09:30:06 -0700
commit0bed54dc9af4ab75547739a27b64f0fe0aa98756 (patch)
tree37cbf57e1866c5651b02ea539acfe0cd579b18e2
parent0ce1a7941341cc63c8352b7df50020e5485bc43a (diff)
downloadop-kernel-dev-0bed54dc9af4ab75547739a27b64f0fe0aa98756.zip
op-kernel-dev-0bed54dc9af4ab75547739a27b64f0fe0aa98756.tar.gz
rbd: rename some fields in struct rbd_dev
An rbd image is not a single object, but a logical construct made up of an aggregation of objects. Rename some fields in struct rbd_dev, in hopes of reinforcing this. obj --> image_name obj_len --> image_name_len obj_md_name --> header_name Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
-rw-r--r--drivers/block/rbd.c55
1 files changed, 28 insertions, 27 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 0343956..7a87a8c 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -161,9 +161,9 @@ struct rbd_device {
spinlock_t lock; /* queue lock */
struct rbd_image_header header;
- char *obj; /* rbd image name */
- size_t obj_len;
- char *obj_md_name; /* hdr nm. */
+ char *image_name;
+ size_t image_name_len;
+ char *header_name;
char *pool_name;
int pool_id;
@@ -1225,8 +1225,8 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data)
if (!rbd_dev)
return;
- dout("rbd_watch_cb %s notify_id=%lld opcode=%d\n", rbd_dev->obj_md_name,
- notify_id, (int)opcode);
+ dout("rbd_watch_cb %s notify_id=%lld opcode=%d\n",
+ rbd_dev->header_name, notify_id, (int) opcode);
mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
rc = __rbd_refresh_header(rbd_dev);
mutex_unlock(&ctl_mutex);
@@ -1234,7 +1234,7 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data)
pr_warning(RBD_DRV_NAME "%d got notification but failed to "
" update snaps: %d\n", rbd_dev->major, rc);
- rbd_req_sync_notify_ack(rbd_dev, ver, notify_id, rbd_dev->obj_md_name);
+ rbd_req_sync_notify_ack(rbd_dev, ver, notify_id, rbd_dev->header_name);
}
/*
@@ -1322,7 +1322,7 @@ static void rbd_notify_cb(u64 ver, u64 notify_id, u8 opcode, void *data)
return;
dout("rbd_notify_cb %s notify_id=%lld opcode=%d\n",
- rbd_dev->obj_md_name,
+ rbd_dev->header_name,
notify_id, (int)opcode);
}
@@ -1600,7 +1600,7 @@ static int rbd_read_header(struct rbd_device *rbd_dev,
rc = rbd_req_sync_read(rbd_dev,
NULL, CEPH_NOSNAP,
- rbd_dev->obj_md_name,
+ rbd_dev->header_name,
0, len,
(char *)dh, &ver);
if (rc < 0)
@@ -1610,7 +1610,8 @@ static int rbd_read_header(struct rbd_device *rbd_dev,
if (rc < 0) {
if (rc == -ENXIO)
pr_warning("unrecognized header format"
- " for image %s", rbd_dev->obj);
+ " for image %s\n",
+ rbd_dev->image_name);
goto out_dh;
}
@@ -1666,7 +1667,7 @@ static int rbd_header_add_snap(struct rbd_device *rbd_dev,
ceph_encode_string_safe(&p, e, snap_name, name_len, bad);
ceph_encode_64_safe(&p, e, new_snapid, bad);
- ret = rbd_req_sync_exec(rbd_dev, rbd_dev->obj_md_name,
+ ret = rbd_req_sync_exec(rbd_dev, rbd_dev->header_name,
"rbd", "snap_add",
data, p - data, &ver);
@@ -1874,7 +1875,7 @@ static ssize_t rbd_name_show(struct device *dev,
{
struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
- return sprintf(buf, "%s\n", rbd_dev->obj);
+ return sprintf(buf, "%s\n", rbd_dev->image_name);
}
static ssize_t rbd_snap_show(struct device *dev,
@@ -2178,7 +2179,7 @@ static int rbd_init_watch_dev(struct rbd_device *rbd_dev)
int ret, rc;
do {
- ret = rbd_req_sync_watch(rbd_dev, rbd_dev->obj_md_name,
+ ret = rbd_req_sync_watch(rbd_dev, rbd_dev->header_name,
rbd_dev->header.obj_version);
if (ret == -ERANGE) {
mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
@@ -2341,7 +2342,7 @@ static inline char *dup_token(const char **buf, size_t *lenp)
}
/*
- * This fills in the pool_name, obj, obj_len, snap_name, obj_len,
+ * This fills in the pool_name, image_name, image_name_len, snap_name,
* rbd_dev, rbd_md_name, and name fields of the given rbd_dev, based
* on the list of monitor addresses and other options provided via
* /sys/bus/rbd/add.
@@ -2353,7 +2354,7 @@ static int rbd_add_parse_args(struct rbd_device *rbd_dev,
const char **mon_addrs,
size_t *mon_addrs_size,
char *options,
- size_t options_size)
+ size_t options_size)
{
size_t len;
int ret;
@@ -2377,18 +2378,18 @@ static int rbd_add_parse_args(struct rbd_device *rbd_dev,
if (!rbd_dev->pool_name)
goto out_err;
- rbd_dev->obj = dup_token(&buf, &rbd_dev->obj_len);
- if (!rbd_dev->obj)
+ rbd_dev->image_name = dup_token(&buf, &rbd_dev->image_name_len);
+ if (!rbd_dev->image_name)
goto out_err;
/* Create the name of the header object */
- rbd_dev->obj_md_name = kmalloc(rbd_dev->obj_len
+ rbd_dev->header_name = kmalloc(rbd_dev->image_name_len
+ sizeof (RBD_SUFFIX),
GFP_KERNEL);
- if (!rbd_dev->obj_md_name)
+ if (!rbd_dev->header_name)
goto out_err;
- sprintf(rbd_dev->obj_md_name, "%s%s", rbd_dev->obj, RBD_SUFFIX);
+ sprintf(rbd_dev->header_name, "%s%s", rbd_dev->image_name, RBD_SUFFIX);
/*
* The snapshot name is optional. If none is is supplied,
@@ -2412,8 +2413,8 @@ static int rbd_add_parse_args(struct rbd_device *rbd_dev,
return 0;
out_err:
- kfree(rbd_dev->obj_md_name);
- kfree(rbd_dev->obj);
+ kfree(rbd_dev->header_name);
+ kfree(rbd_dev->image_name);
kfree(rbd_dev->pool_name);
rbd_dev->pool_name = NULL;
@@ -2517,8 +2518,8 @@ err_out_client:
err_put_id:
if (rbd_dev->pool_name) {
kfree(rbd_dev->snap_name);
- kfree(rbd_dev->obj_md_name);
- kfree(rbd_dev->obj);
+ kfree(rbd_dev->header_name);
+ kfree(rbd_dev->image_name);
kfree(rbd_dev->pool_name);
}
rbd_id_put(rbd_dev);
@@ -2560,7 +2561,7 @@ static void rbd_dev_release(struct device *dev)
rbd_dev->watch_request);
}
if (rbd_dev->watch_event)
- rbd_req_sync_unwatch(rbd_dev, rbd_dev->obj_md_name);
+ rbd_req_sync_unwatch(rbd_dev, rbd_dev->header_name);
rbd_put_client(rbd_dev);
@@ -2570,9 +2571,9 @@ static void rbd_dev_release(struct device *dev)
/* done with the id, and with the rbd_dev */
kfree(rbd_dev->snap_name);
- kfree(rbd_dev->obj_md_name);
+ kfree(rbd_dev->header_name);
kfree(rbd_dev->pool_name);
- kfree(rbd_dev->obj);
+ kfree(rbd_dev->image_name);
rbd_id_put(rbd_dev);
kfree(rbd_dev);
@@ -2643,7 +2644,7 @@ static ssize_t rbd_snap_add(struct device *dev,
mutex_unlock(&ctl_mutex);
/* make a best effort, don't error if failed */
- rbd_req_sync_notify(rbd_dev, rbd_dev->obj_md_name);
+ rbd_req_sync_notify(rbd_dev, rbd_dev->header_name);
ret = count;
kfree(name);
OpenPOWER on IntegriCloud