aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/ceph/osdmap.h2
-rw-r--r--net/ceph/osd_client.c30
-rw-r--r--net/ceph/osdmap.c28
3 files changed, 55 insertions, 5 deletions
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 7f894a64c6c7..49ff69f0746b 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -35,6 +35,8 @@ struct ceph_pg_pool_info {
35 u8 object_hash; 35 u8 object_hash;
36 u32 pg_num, pgp_num; 36 u32 pg_num, pgp_num;
37 int pg_num_mask, pgp_num_mask; 37 int pg_num_mask, pgp_num_mask;
38 s64 read_tier;
39 s64 write_tier; /* wins for read+write ops */
38 u64 flags; 40 u64 flags;
39 char *name; 41 char *name;
40}; 42};
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