aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2017-06-21 11:27:17 -0400
committerIlya Dryomov <idryomov@gmail.com>2017-07-07 11:25:17 -0400
commit33333d107112be4d822234deb8820ec6eeb0831d (patch)
treec9504ecedf8274faf2003466c319351b7e76aa02
parenta02a946dfe9633d7e0202359836f6b5217a62824 (diff)
libceph: don't pass pgid by value
Make __{lookup,remove}_pg_mapping() look like their ceph_spg_mapping counterparts: take const struct ceph_pg *. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--net/ceph/osdmap.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index 1d87a736221b..06baf6bd40e4 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -465,7 +465,7 @@ static int __insert_pg_mapping(struct ceph_pg_mapping *new,
465} 465}
466 466
467static struct ceph_pg_mapping *__lookup_pg_mapping(struct rb_root *root, 467static struct ceph_pg_mapping *__lookup_pg_mapping(struct rb_root *root,
468 struct ceph_pg pgid) 468 const struct ceph_pg *pgid)
469{ 469{
470 struct rb_node *n = root->rb_node; 470 struct rb_node *n = root->rb_node;
471 struct ceph_pg_mapping *pg; 471 struct ceph_pg_mapping *pg;
@@ -473,32 +473,32 @@ static struct ceph_pg_mapping *__lookup_pg_mapping(struct rb_root *root,
473 473
474 while (n) { 474 while (n) {
475 pg = rb_entry(n, struct ceph_pg_mapping, node); 475 pg = rb_entry(n, struct ceph_pg_mapping, node);
476 c = ceph_pg_compare(&pgid, &pg->pgid); 476 c = ceph_pg_compare(pgid, &pg->pgid);
477 if (c < 0) { 477 if (c < 0) {
478 n = n->rb_left; 478 n = n->rb_left;
479 } else if (c > 0) { 479 } else if (c > 0) {
480 n = n->rb_right; 480 n = n->rb_right;
481 } else { 481 } else {
482 dout("__lookup_pg_mapping %lld.%x got %p\n", 482 dout("__lookup_pg_mapping %lld.%x got %p\n",
483 pgid.pool, pgid.seed, pg); 483 pgid->pool, pgid->seed, pg);
484 return pg; 484 return pg;
485 } 485 }
486 } 486 }
487 return NULL; 487 return NULL;
488} 488}
489 489
490static int __remove_pg_mapping(struct rb_root *root, struct ceph_pg pgid) 490static int __remove_pg_mapping(struct rb_root *root, const struct ceph_pg *pgid)
491{ 491{
492 struct ceph_pg_mapping *pg = __lookup_pg_mapping(root, pgid); 492 struct ceph_pg_mapping *pg = __lookup_pg_mapping(root, pgid);
493 493
494 if (pg) { 494 if (pg) {
495 dout("__remove_pg_mapping %lld.%x %p\n", pgid.pool, pgid.seed, 495 dout("__remove_pg_mapping %lld.%x %p\n", pgid->pool, pgid->seed,
496 pg); 496 pg);
497 rb_erase(&pg->node, root); 497 rb_erase(&pg->node, root);
498 kfree(pg); 498 kfree(pg);
499 return 0; 499 return 0;
500 } 500 }
501 dout("__remove_pg_mapping %lld.%x dne\n", pgid.pool, pgid.seed); 501 dout("__remove_pg_mapping %lld.%x dne\n", pgid->pool, pgid->seed);
502 return -ENOENT; 502 return -ENOENT;
503} 503}
504 504
@@ -1034,7 +1034,7 @@ static int __decode_pg_temp(void **p, void *end, struct ceph_osdmap *map,
1034 1034
1035 ceph_decode_32_safe(p, end, len, e_inval); 1035 ceph_decode_32_safe(p, end, len, e_inval);
1036 1036
1037 ret = __remove_pg_mapping(&map->pg_temp, pgid); 1037 ret = __remove_pg_mapping(&map->pg_temp, &pgid);
1038 BUG_ON(!incremental && ret != -ENOENT); 1038 BUG_ON(!incremental && ret != -ENOENT);
1039 1039
1040 if (!incremental || len > 0) { 1040 if (!incremental || len > 0) {
@@ -1095,7 +1095,7 @@ static int __decode_primary_temp(void **p, void *end, struct ceph_osdmap *map,
1095 1095
1096 ceph_decode_32_safe(p, end, osd, e_inval); 1096 ceph_decode_32_safe(p, end, osd, e_inval);
1097 1097
1098 ret = __remove_pg_mapping(&map->primary_temp, pgid); 1098 ret = __remove_pg_mapping(&map->primary_temp, &pgid);
1099 BUG_ON(!incremental && ret != -ENOENT); 1099 BUG_ON(!incremental && ret != -ENOENT);
1100 1100
1101 if (!incremental || osd != (u32)-1) { 1101 if (!incremental || osd != (u32)-1) {
@@ -2226,7 +2226,7 @@ static void get_temp_osds(struct ceph_osdmap *osdmap,
2226 ceph_osds_init(temp); 2226 ceph_osds_init(temp);
2227 2227
2228 /* pg_temp? */ 2228 /* pg_temp? */
2229 pg = __lookup_pg_mapping(&osdmap->pg_temp, pgid); 2229 pg = __lookup_pg_mapping(&osdmap->pg_temp, &pgid);
2230 if (pg) { 2230 if (pg) {
2231 for (i = 0; i < pg->pg_temp.len; i++) { 2231 for (i = 0; i < pg->pg_temp.len; i++) {
2232 if (ceph_osd_is_down(osdmap, pg->pg_temp.osds[i])) { 2232 if (ceph_osd_is_down(osdmap, pg->pg_temp.osds[i])) {
@@ -2249,7 +2249,7 @@ static void get_temp_osds(struct ceph_osdmap *osdmap,
2249 } 2249 }
2250 2250
2251 /* primary_temp? */ 2251 /* primary_temp? */
2252 pg = __lookup_pg_mapping(&osdmap->primary_temp, pgid); 2252 pg = __lookup_pg_mapping(&osdmap->primary_temp, &pgid);
2253 if (pg) 2253 if (pg)
2254 temp->primary = pg->primary_temp.osd; 2254 temp->primary = pg->primary_temp.osd;
2255} 2255}