Commit ca1e49a6 authored by Alex Elder's avatar Alex Elder Committed by Sage Weil

rbd: rename rbd_dev->block_name

Each rbd image has a name that forms the basis of all data objects
backing the device.  Old (format 1) images refer to this name as the
"block name," while new (format 2) images use the term "object
prefix" for this.

Change the field name in the in-core rbd image header structure to
reflect the more modern usage.  We intentionally keep the the name
"block_name" in the on-disk definition for format 1 image headers.
Signed-off-by: default avatarAlex Elder <elder@inktank.com>
Reviewed-by: default avatarYehuda Sadeh <yehuda@inktank.com>
Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
parent ea3352f4
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
*/ */
struct rbd_image_header { struct rbd_image_header {
u64 image_size; u64 image_size;
char block_name[32]; char object_prefix[32];
__u8 obj_order; __u8 obj_order;
__u8 crypt_type; __u8 crypt_type;
__u8 comp_type; __u8 comp_type;
...@@ -518,7 +518,7 @@ static int rbd_header_from_disk(struct rbd_image_header *header, ...@@ -518,7 +518,7 @@ static int rbd_header_from_disk(struct rbd_image_header *header,
header->snap_names = NULL; header->snap_names = NULL;
header->snap_sizes = NULL; header->snap_sizes = NULL;
} }
memcpy(header->block_name, ondisk->block_name, memcpy(header->object_prefix, ondisk->block_name,
sizeof(ondisk->block_name)); sizeof(ondisk->block_name));
header->image_size = le64_to_cpu(ondisk->image_size); header->image_size = le64_to_cpu(ondisk->image_size);
...@@ -620,7 +620,7 @@ static void rbd_header_free(struct rbd_image_header *header) ...@@ -620,7 +620,7 @@ static void rbd_header_free(struct rbd_image_header *header)
* get the actual striped segment name, offset and length * get the actual striped segment name, offset and length
*/ */
static u64 rbd_get_segment(struct rbd_image_header *header, static u64 rbd_get_segment(struct rbd_image_header *header,
const char *block_name, const char *object_prefix,
u64 ofs, u64 len, u64 ofs, u64 len,
char *seg_name, u64 *segofs) char *seg_name, u64 *segofs)
{ {
...@@ -628,7 +628,7 @@ static u64 rbd_get_segment(struct rbd_image_header *header, ...@@ -628,7 +628,7 @@ static u64 rbd_get_segment(struct rbd_image_header *header,
if (seg_name) if (seg_name)
snprintf(seg_name, RBD_MAX_SEG_NAME_LEN, snprintf(seg_name, RBD_MAX_SEG_NAME_LEN,
"%s.%012llx", block_name, seg); "%s.%012llx", object_prefix, seg);
ofs = ofs & ((1 << header->obj_order) - 1); ofs = ofs & ((1 << header->obj_order) - 1);
len = min_t(u64, len, (1 << header->obj_order) - ofs); len = min_t(u64, len, (1 << header->obj_order) - ofs);
...@@ -1091,7 +1091,7 @@ static int rbd_do_op(struct request *rq, ...@@ -1091,7 +1091,7 @@ static int rbd_do_op(struct request *rq,
return -ENOMEM; return -ENOMEM;
seg_len = rbd_get_segment(&rbd_dev->header, seg_len = rbd_get_segment(&rbd_dev->header,
rbd_dev->header.block_name, rbd_dev->header.object_prefix,
ofs, len, ofs, len,
seg_name, &seg_ofs); seg_name, &seg_ofs);
...@@ -1482,7 +1482,7 @@ static void rbd_rq_fn(struct request_queue *q) ...@@ -1482,7 +1482,7 @@ static void rbd_rq_fn(struct request_queue *q)
/* a bio clone to be passed down to OSD req */ /* a bio clone to be passed down to OSD req */
dout("rq->bio->bi_vcnt=%d\n", rq->bio->bi_vcnt); dout("rq->bio->bi_vcnt=%d\n", rq->bio->bi_vcnt);
op_size = rbd_get_segment(&rbd_dev->header, op_size = rbd_get_segment(&rbd_dev->header,
rbd_dev->header.block_name, rbd_dev->header.object_prefix,
ofs, size, ofs, size,
NULL, NULL); NULL, NULL);
kref_get(&coll->kref); kref_get(&coll->kref);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment