diff options
author | Ilya Dryomov <ilya.dryomov@inktank.com> | 2014-01-27 10:40:18 -0500 |
---|---|---|
committer | Ilya Dryomov <ilya.dryomov@inktank.com> | 2014-01-27 16:57:28 -0500 |
commit | 4295f2217a5aa8ef2738e3a368db3c1ceab41212 (patch) | |
tree | 557b4efd8558bfa71bae87413d0f4d6f0ba0511a /net/ceph | |
parent | 2d0ebc5d591f49131bf8f93b54c5424162c3fb7f (diff) |
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 <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/debugfs.c | 3 | ||||
-rw-r--r-- | net/ceph/osd_client.c | 17 |
2 files changed, 11 insertions, 9 deletions
diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c index 83661cdc0766..1f8562706393 100644 --- a/net/ceph/debugfs.c +++ b/net/ceph/debugfs.c | |||
@@ -132,7 +132,8 @@ static int osdc_show(struct seq_file *s, void *pp) | |||
132 | req->r_osd ? req->r_osd->o_osd : -1, | 132 | req->r_osd ? req->r_osd->o_osd : -1, |
133 | req->r_pgid.pool, req->r_pgid.seed); | 133 | req->r_pgid.pool, req->r_pgid.seed); |
134 | 134 | ||
135 | seq_printf(s, "%.*s", req->r_oid_len, req->r_oid); | 135 | seq_printf(s, "%.*s", req->r_oid.name_len, |
136 | req->r_oid.name); | ||
136 | 137 | ||
137 | if (req->r_reassert_version.epoch) | 138 | if (req->r_reassert_version.epoch) |
138 | seq_printf(s, "\t%u'%llu", | 139 | seq_printf(s, "\t%u'%llu", |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index a053e7e4a780..2988d68b24c6 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -765,9 +765,9 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, | |||
765 | 765 | ||
766 | req->r_oloc.pool = ceph_file_layout_pg_pool(*layout); | 766 | req->r_oloc.pool = ceph_file_layout_pg_pool(*layout); |
767 | 767 | ||
768 | snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", | 768 | snprintf(req->r_oid.name, sizeof(req->r_oid.name), |
769 | vino.ino, objnum); | 769 | "%llx.%08llx", vino.ino, objnum); |
770 | req->r_oid_len = strlen(req->r_oid); | 770 | req->r_oid.name_len = strlen(req->r_oid.name); |
771 | 771 | ||
772 | return req; | 772 | return req; |
773 | } | 773 | } |
@@ -1269,7 +1269,7 @@ static int __map_request(struct ceph_osd_client *osdc, | |||
1269 | bool was_paused; | 1269 | bool was_paused; |
1270 | 1270 | ||
1271 | dout("map_request %p tid %lld\n", req, req->r_tid); | 1271 | dout("map_request %p tid %lld\n", req, req->r_tid); |
1272 | err = ceph_calc_ceph_pg(&pgid, req->r_oid, osdc->osdmap, | 1272 | err = ceph_calc_ceph_pg(&pgid, req->r_oid.name, osdc->osdmap, |
1273 | req->r_oloc.pool); | 1273 | req->r_oloc.pool); |
1274 | if (err) { | 1274 | if (err) { |
1275 | list_move(&req->r_req_lru_item, &osdc->req_notarget); | 1275 | 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, | |||
2118 | ceph_encode_32(&p, -1); /* preferred */ | 2118 | ceph_encode_32(&p, -1); /* preferred */ |
2119 | 2119 | ||
2120 | /* oid */ | 2120 | /* oid */ |
2121 | ceph_encode_32(&p, req->r_oid_len); | 2121 | ceph_encode_32(&p, req->r_oid.name_len); |
2122 | memcpy(p, req->r_oid, req->r_oid_len); | 2122 | memcpy(p, req->r_oid.name, req->r_oid.name_len); |
2123 | dout("oid '%.*s' len %d\n", req->r_oid_len, req->r_oid, req->r_oid_len); | 2123 | dout("oid '%.*s' len %d\n", req->r_oid.name_len, |
2124 | p += req->r_oid_len; | 2124 | req->r_oid.name, req->r_oid.name_len); |
2125 | p += req->r_oid.name_len; | ||
2125 | 2126 | ||
2126 | /* ops--can imply data */ | 2127 | /* ops--can imply data */ |
2127 | ceph_encode_16(&p, (u16)req->r_num_ops); | 2128 | ceph_encode_16(&p, (u16)req->r_num_ops); |