aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorIlya Dryomov <ilya.dryomov@inktank.com>2014-01-27 10:40:19 -0500
committerIlya Dryomov <ilya.dryomov@inktank.com>2014-01-27 16:57:45 -0500
commit17a13e4028e6ad7ded079cf32370c47bd0e0fc07 (patch)
treeb09232ed5e1037f4ff9cfd3c60902dd0c0d61973 /net
parentce7f6a2790464047199f54b66420243d433142bd (diff)
libceph: follow {read,write}_tier fields on osd request submission
Overwrite ceph_osd_request::r_oloc.pool with read_tier for read ops and write_tier for write and read+write ops (aka basic tiering support). {read,write}_tier are part of pg_pool_t since v9. This commit bumps our pg_pool_t decode compat version from v7 to v9, all new fields except for {read,write}_tier are ignored. 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.c30
-rw-r--r--net/ceph/osdmap.c28
2 files changed, 53 insertions, 5 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 10360dedcdad..0eb009eaf4ff 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1250,6 +1250,32 @@ static bool __req_should_be_paused(struct ceph_osd_client *osdc,
1250} 1250}
1251 1251
1252/* 1252/*
1253 * Calculate mapping of a request to a PG. Takes tiering into account.
1254 */
1255static int __calc_request_pg(struct ceph_osdmap *osdmap,
1256 struct ceph_osd_request *req,
1257 struct ceph_pg *pg_out)
1258{
1259 if ((req->r_flags & CEPH_OSD_FLAG_IGNORE_OVERLAY) == 0) {
1260 struct ceph_pg_pool_info *pi;
1261
1262 pi = ceph_pg_pool_by_id(osdmap, req->r_oloc.pool);
1263 if (pi) {
1264 if ((req->r_flags & CEPH_OSD_FLAG_READ) &&
1265 pi->read_tier >= 0)
1266 req->r_oloc.pool = pi->read_tier;
1267 if ((req->r_flags & CEPH_OSD_FLAG_WRITE) &&
1268 pi->write_tier >= 0)
1269 req->r_oloc.pool = pi->write_tier;
1270 }
1271 /* !pi is caught in ceph_oloc_oid_to_pg() */
1272 }
1273
1274 return ceph_oloc_oid_to_pg(osdmap, &req->r_oloc,
1275 &req->r_oid, pg_out);
1276}
1277
1278/*
1253 * Pick an osd (the first 'up' osd in the pg), allocate the osd struct 1279 * Pick an osd (the first 'up' osd in the pg), allocate the osd struct
1254 * (as needed), and set the request r_osd appropriately. If there is 1280 * (as needed), and set the request r_osd appropriately. If there is
1255 * no up osd, set r_osd to NULL. Move the request to the appropriate list 1281 * no up osd, set r_osd to NULL. Move the request to the appropriate list
@@ -1269,8 +1295,8 @@ static int __map_request(struct ceph_osd_client *osdc,
1269 bool was_paused; 1295 bool was_paused;
1270 1296
1271 dout("map_request %p tid %lld\n", req, req->r_tid); 1297 dout("map_request %p tid %lld\n", req, req->r_tid);
1272 err = ceph_oloc_oid_to_pg(osdc->osdmap, &req->r_oloc, &req->r_oid, 1298
1273 &pgid); 1299 err = __calc_request_pg(osdc->osdmap, req, &pgid);
1274 if (err) { 1300 if (err) {
1275 list_move(&req->r_req_lru_item, &osdc->req_notarget); 1301 list_move(&req->r_req_lru_item, &osdc->req_notarget);
1276 return err; 1302 return err;
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index d69d23556f0c..aade4a5c1c07 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -519,8 +519,8 @@ static int __decode_pool(void **p, void *end, struct ceph_pg_pool_info *pi)
519 pr_warning("got v %d < 5 cv %d of ceph_pg_pool\n", ev, cv); 519 pr_warning("got v %d < 5 cv %d of ceph_pg_pool\n", ev, cv);
520 return -EINVAL; 520 return -EINVAL;
521 } 521 }
522 if (cv > 7) { 522 if (cv > 9) {
523 pr_warning("got v %d cv %d > 7 of ceph_pg_pool\n", ev, cv); 523 pr_warning("got v %d cv %d > 9 of ceph_pg_pool\n", ev, cv);
524 return -EINVAL; 524 return -EINVAL;
525 } 525 }
526 len = ceph_decode_32(p); 526 len = ceph_decode_32(p);
@@ -548,12 +548,34 @@ static int __decode_pool(void **p, void *end, struct ceph_pg_pool_info *pi)
548 *p += len; 548 *p += len;
549 } 549 }
550 550
551 /* skip removed snaps */ 551 /* skip removed_snaps */
552 num = ceph_decode_32(p); 552 num = ceph_decode_32(p);
553 *p += num * (8 + 8); 553 *p += num * (8 + 8);
554 554
555 *p += 8; /* skip auid */ 555 *p += 8; /* skip auid */
556 pi->flags = ceph_decode_64(p); 556 pi->flags = ceph_decode_64(p);
557 *p += 4; /* skip crash_replay_interval */
558
559 if (ev >= 7)
560 *p += 1; /* skip min_size */
561
562 if (ev >= 8)
563 *p += 8 + 8; /* skip quota_max_* */
564
565 if (ev >= 9) {
566 /* skip tiers */
567 num = ceph_decode_32(p);
568 *p += num * 8;
569
570 *p += 8; /* skip tier_of */
571 *p += 1; /* skip cache_mode */
572
573 pi->read_tier = ceph_decode_64(p);
574 pi->write_tier = ceph_decode_64(p);
575 } else {
576 pi->read_tier = -1;
577 pi->write_tier = -1;
578 }
557 579
558 /* ignore the rest */ 580 /* ignore the rest */
559 581