aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorIlya Dryomov <ilya.dryomov@inktank.com>2014-01-27 10:40:18 -0500
committerIlya Dryomov <ilya.dryomov@inktank.com>2014-01-27 16:57:03 -0500
commit22116525baec1d63f4878eaa92f0b57946a78819 (patch)
tree8630a9fdeec976e58fea4f0c131dabbf193a82f3 /net
parent0b4af2e8c9f3fc9c31d2f9374b79af2c890ef897 (diff)
libceph: start using oloc abstraction
Instead of relying on pool fields in ceph_file_layout (for mapping) and ceph_pg (for enconding), start using ceph_object_locator (oloc) abstraction. Note that userspace oloc currently consists of pool, key, nspace and hash fields, while this one contains only a pool. This is OK, because at this point we only send (i.e. encode) olocs and never have to receive (i.e. decode) them. This makes keeping a copy of ceph_file_layout in every osd request unnecessary, so ceph_osd_request::r_file_layout field is nuked. Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/osd_client.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 959d332ed534..7130c5c83d79 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -368,6 +368,8 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
368 INIT_LIST_HEAD(&req->r_req_lru_item); 368 INIT_LIST_HEAD(&req->r_req_lru_item);
369 INIT_LIST_HEAD(&req->r_osd_item); 369 INIT_LIST_HEAD(&req->r_osd_item);
370 370
371 req->r_oloc.pool = -1;
372
371 /* create reply message */ 373 /* create reply message */
372 if (use_mempool) 374 if (use_mempool)
373 msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0); 375 msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0);
@@ -761,7 +763,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
761 if (num_ops > 1) 763 if (num_ops > 1)
762 osd_req_op_init(req, 1, CEPH_OSD_OP_STARTSYNC); 764 osd_req_op_init(req, 1, CEPH_OSD_OP_STARTSYNC);
763 765
764 req->r_file_layout = *layout; /* keep a copy */ 766 req->r_oloc.pool = ceph_file_layout_pg_pool(*layout);
765 767
766 snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", 768 snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx",
767 vino.ino, objnum); 769 vino.ino, objnum);
@@ -1268,7 +1270,7 @@ static int __map_request(struct ceph_osd_client *osdc,
1268 1270
1269 dout("map_request %p tid %lld\n", req, req->r_tid); 1271 dout("map_request %p tid %lld\n", req, req->r_tid);
1270 err = ceph_calc_ceph_pg(&pgid, req->r_oid, osdc->osdmap, 1272 err = ceph_calc_ceph_pg(&pgid, req->r_oid, osdc->osdmap,
1271 ceph_file_layout_pg_pool(req->r_file_layout)); 1273 req->r_oloc.pool);
1272 if (err) { 1274 if (err) {
1273 list_move(&req->r_req_lru_item, &osdc->req_notarget); 1275 list_move(&req->r_req_lru_item, &osdc->req_notarget);
1274 return err; 1276 return err;
@@ -1354,7 +1356,7 @@ static void __send_request(struct ceph_osd_client *osdc,
1354 /* fill in message content that changes each time we send it */ 1356 /* fill in message content that changes each time we send it */
1355 put_unaligned_le32(osdc->osdmap->epoch, req->r_request_osdmap_epoch); 1357 put_unaligned_le32(osdc->osdmap->epoch, req->r_request_osdmap_epoch);
1356 put_unaligned_le32(req->r_flags, req->r_request_flags); 1358 put_unaligned_le32(req->r_flags, req->r_request_flags);
1357 put_unaligned_le64(req->r_pgid.pool, req->r_request_pool); 1359 put_unaligned_le64(req->r_oloc.pool, req->r_request_pool);
1358 p = req->r_request_pgid; 1360 p = req->r_request_pgid;
1359 ceph_encode_64(&p, req->r_pgid.pool); 1361 ceph_encode_64(&p, req->r_pgid.pool);
1360 ceph_encode_32(&p, req->r_pgid.seed); 1362 ceph_encode_32(&p, req->r_pgid.seed);