mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
libceph: introduce and start using oid abstraction
In preparation for tiering support, which would require having two (base and target) object names for each osd request and also copying those names around, introduce struct ceph_object_id (oid) and a couple helpers to facilitate those copies and encapsulate the fact that object name is not necessarily a NUL-terminated string. Signed-off-by: Ilya Dryomov <[email protected]> Reviewed-by: Sage Weil <[email protected]>
This commit is contained in:
parent
2d0ebc5d59
commit
4295f2217a
5 changed files with 50 additions and 25 deletions
|
|
@ -132,7 +132,8 @@ static int osdc_show(struct seq_file *s, void *pp)
|
|||
req->r_osd ? req->r_osd->o_osd : -1,
|
||||
req->r_pgid.pool, req->r_pgid.seed);
|
||||
|
||||
seq_printf(s, "%.*s", req->r_oid_len, req->r_oid);
|
||||
seq_printf(s, "%.*s", req->r_oid.name_len,
|
||||
req->r_oid.name);
|
||||
|
||||
if (req->r_reassert_version.epoch)
|
||||
seq_printf(s, "\t%u'%llu",
|
||||
|
|
|
|||
|
|
@ -765,9 +765,9 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
|
|||
|
||||
req->r_oloc.pool = ceph_file_layout_pg_pool(*layout);
|
||||
|
||||
snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx",
|
||||
vino.ino, objnum);
|
||||
req->r_oid_len = strlen(req->r_oid);
|
||||
snprintf(req->r_oid.name, sizeof(req->r_oid.name),
|
||||
"%llx.%08llx", vino.ino, objnum);
|
||||
req->r_oid.name_len = strlen(req->r_oid.name);
|
||||
|
||||
return req;
|
||||
}
|
||||
|
|
@ -1269,7 +1269,7 @@ static int __map_request(struct ceph_osd_client *osdc,
|
|||
bool was_paused;
|
||||
|
||||
dout("map_request %p tid %lld\n", req, req->r_tid);
|
||||
err = ceph_calc_ceph_pg(&pgid, req->r_oid, osdc->osdmap,
|
||||
err = ceph_calc_ceph_pg(&pgid, req->r_oid.name, osdc->osdmap,
|
||||
req->r_oloc.pool);
|
||||
if (err) {
|
||||
list_move(&req->r_req_lru_item, &osdc->req_notarget);
|
||||
|
|
@ -2118,10 +2118,11 @@ void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off,
|
|||
ceph_encode_32(&p, -1); /* preferred */
|
||||
|
||||
/* oid */
|
||||
ceph_encode_32(&p, req->r_oid_len);
|
||||
memcpy(p, req->r_oid, req->r_oid_len);
|
||||
dout("oid '%.*s' len %d\n", req->r_oid_len, req->r_oid, req->r_oid_len);
|
||||
p += req->r_oid_len;
|
||||
ceph_encode_32(&p, req->r_oid.name_len);
|
||||
memcpy(p, req->r_oid.name, req->r_oid.name_len);
|
||||
dout("oid '%.*s' len %d\n", req->r_oid.name_len,
|
||||
req->r_oid.name, req->r_oid.name_len);
|
||||
p += req->r_oid.name_len;
|
||||
|
||||
/* ops--can imply data */
|
||||
ceph_encode_16(&p, (u16)req->r_num_ops);
|
||||
|
|
|
|||
Loading…
Reference in a new issue