From: Alex Elder <elder@ieee.org>
To: Ilya Dryomov <ilya.dryomov@inktank.com>, ceph-devel@vger.kernel.org
Subject: Re: [PATCH 32/33] libceph: redo ceph_calc_pg_primary() in terms of ceph_calc_pg_acting()
Date: Thu, 27 Mar 2014 16:04:22 -0500 [thread overview]
Message-ID: <53349256.9090804@ieee.org> (raw)
In-Reply-To: <1395944299-21970-33-git-send-email-ilya.dryomov@inktank.com>
On 03/27/2014 01:18 PM, Ilya Dryomov wrote:
> Reimplement ceph_calc_pg_primary() in terms of ceph_calc_pg_acting()
> and get rid of the now unused calc_pg_raw().
I'll be honest, my review of this one isn't very
solid but it looks OK to me.
Reviewed-by: Alex Elder <elder@linaro.org>
> Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
> ---
> net/ceph/osdmap.c | 79 +++--------------------------------------------------
> 1 file changed, 4 insertions(+), 75 deletions(-)
>
> diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
> index 8c596a13c60f..f0567d8ca683 100644
> --- a/net/ceph/osdmap.c
> +++ b/net/ceph/osdmap.c
> @@ -1449,71 +1449,6 @@ static int do_crush(struct ceph_osdmap *map, int ruleno, int x,
> }
>
> /*
> - * Calculate raw osd vector for the given pgid. Return pointer to osd
> - * array, or NULL on failure.
> - */
> -static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
> - int *osds, int *num)
> -{
> - struct ceph_pg_mapping *pg;
> - struct ceph_pg_pool_info *pool;
> - int ruleno;
> - int r;
> - u32 pps;
> -
> - pool = __lookup_pg_pool(&osdmap->pg_pools, pgid.pool);
> - if (!pool)
> - return NULL;
> -
> - /* pg_temp? */
> - pgid.seed = ceph_stable_mod(pgid.seed, pool->pg_num,
> - pool->pg_num_mask);
> - pg = __lookup_pg_mapping(&osdmap->pg_temp, pgid);
> - if (pg) {
> - *num = pg->pg_temp.len;
> - return pg->pg_temp.osds;
> - }
> -
> - /* crush */
> - ruleno = crush_find_rule(osdmap->crush, pool->crush_ruleset,
> - pool->type, pool->size);
> - if (ruleno < 0) {
> - pr_err("no crush rule pool %lld ruleset %d type %d size %d\n",
> - pgid.pool, pool->crush_ruleset, pool->type,
> - pool->size);
> - return NULL;
> - }
> -
> - if (pool->flags & CEPH_POOL_FLAG_HASHPSPOOL) {
> - /* hash pool id and seed sothat pool PGs do not overlap */
> - pps = crush_hash32_2(CRUSH_HASH_RJENKINS1,
> - ceph_stable_mod(pgid.seed, pool->pgp_num,
> - pool->pgp_num_mask),
> - pgid.pool);
> - } else {
> - /*
> - * legacy ehavior: add ps and pool together. this is
> - * not a great approach because the PGs from each pool
> - * will overlap on top of each other: 0.5 == 1.4 ==
> - * 2.3 == ...
> - */
> - pps = ceph_stable_mod(pgid.seed, pool->pgp_num,
> - pool->pgp_num_mask) +
> - (unsigned)pgid.pool;
> - }
> - r = do_crush(osdmap, ruleno, pps, osds, min_t(int, pool->size, *num),
> - osdmap->osd_weight, osdmap->max_osd);
> - if (r < 0) {
> - pr_err("error %d from crush rule: pool %lld ruleset %d type %d"
> - " size %d\n", r, pgid.pool, pool->crush_ruleset,
> - pool->type, pool->size);
> - return NULL;
> - }
> - *num = r;
> - return osds;
> -}
> -
> -/*
> * Calculate raw (crush) set for given pgid.
> *
> * Return raw set length, or error.
> @@ -1769,17 +1704,11 @@ int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
> */
> int ceph_calc_pg_primary(struct ceph_osdmap *osdmap, struct ceph_pg pgid)
> {
> - int rawosds[CEPH_PG_MAX_SIZE], *osds;
> - int i, num = CEPH_PG_MAX_SIZE;
> + int osds[CEPH_PG_MAX_SIZE];
> + int primary;
>
> - osds = calc_pg_raw(osdmap, pgid, rawosds, &num);
> - if (!osds)
> - return -1;
> + ceph_calc_pg_acting(osdmap, pgid, osds, &primary);
>
> - /* primary is first up osd */
> - for (i = 0; i < num; i++)
> - if (ceph_osd_is_up(osdmap, osds[i]))
> - return osds[i];
> - return -1;
> + return primary;
> }
> EXPORT_SYMBOL(ceph_calc_pg_primary);
>
next prev parent reply other threads:[~2014-03-27 21:04 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-27 18:17 [PATCH 00/33] OSDMAP_ENC, primary_temp, PRIMARY_AFFINITY Ilya Dryomov
2014-03-27 18:17 ` [PATCH 01/33] libceph: refer to osdmap directly in osdmap_show() Ilya Dryomov
2014-03-27 19:09 ` Alex Elder
2014-03-27 18:17 ` [PATCH 02/33] libceph: do not prefix osd lines with \t in debugfs output Ilya Dryomov
2014-03-27 19:10 ` Alex Elder
2014-03-27 18:17 ` [PATCH 03/33] libceph: dump pg_temp mappings to debugfs Ilya Dryomov
2014-03-27 19:11 ` Alex Elder
2014-03-27 18:17 ` [PATCH 04/33] libceph: dump osdmap and enhance output on decode errors Ilya Dryomov
2014-03-27 19:15 ` Alex Elder
2014-03-27 18:17 ` [PATCH 05/33] libceph: split osdmap allocation and decode steps Ilya Dryomov
2014-03-27 19:18 ` Alex Elder
2014-03-27 18:17 ` [PATCH 06/33] libceph: fixup error handling in osdmap_decode() Ilya Dryomov
2014-03-27 19:25 ` Alex Elder
2014-03-28 14:56 ` Ilya Dryomov
2014-03-28 16:22 ` Alex Elder
2014-03-27 18:17 ` [PATCH 07/33] libceph: safely decode max_osd value " Ilya Dryomov
2014-03-27 19:27 ` Alex Elder
2014-03-27 18:17 ` [PATCH 08/33] libceph: assert length of osdmap osd arrays Ilya Dryomov
2014-03-27 19:30 ` Alex Elder
2014-03-28 14:57 ` Ilya Dryomov
2014-03-27 18:17 ` [PATCH 09/33] libceph: fix crush_decode() call site in osdmap_decode() Ilya Dryomov
2014-03-27 19:45 ` Alex Elder
2014-03-28 14:57 ` Ilya Dryomov
2014-03-27 18:17 ` [PATCH 10/33] libceph: fixup error handling in osdmap_apply_incremental() Ilya Dryomov
2014-03-27 19:49 ` Alex Elder
2014-03-28 14:58 ` Ilya Dryomov
2014-03-27 18:17 ` [PATCH 11/33] libceph: nuke bogus encoding version check " Ilya Dryomov
2014-03-27 19:50 ` Alex Elder
2014-03-27 18:17 ` [PATCH 12/33] libceph: fix and clarify ceph_decode_need() sizes Ilya Dryomov
2014-03-27 19:53 ` Alex Elder
2014-03-27 18:17 ` [PATCH 13/33] libceph: rename __decode_pool{,_names}() to decode_pool{,_names}() Ilya Dryomov
2014-03-27 19:54 ` Alex Elder
2014-03-27 18:18 ` [PATCH 14/33] libceph: introduce decode{,_new}_pools() and switch to them Ilya Dryomov
2014-03-27 19:56 ` Alex Elder
2014-03-27 18:18 ` [PATCH 15/33] libceph: switch osdmap_set_max_osd() to krealloc() Ilya Dryomov
2014-03-27 19:59 ` Alex Elder
2014-03-27 18:18 ` [PATCH 16/33] libceph: introduce decode{,_new}_pg_temp() and switch to them Ilya Dryomov
2014-03-27 20:05 ` Alex Elder
2014-03-27 18:18 ` [PATCH 17/33] libceph: introduce get_osdmap_client_data_v() Ilya Dryomov
2014-03-27 20:17 ` Alex Elder
2014-03-28 14:59 ` Ilya Dryomov
2014-03-27 18:18 ` [PATCH 18/33] libceph: generalize ceph_pg_mapping Ilya Dryomov
2014-03-27 18:18 ` [PATCH 19/33] libceph: primary_temp infrastructure Ilya Dryomov
2014-03-27 20:21 ` Alex Elder
2014-03-27 18:18 ` [PATCH 20/33] libceph: primary_temp decode bits Ilya Dryomov
2014-03-27 20:23 ` Alex Elder
2014-03-27 18:18 ` [PATCH 21/33] libceph: primary_affinity infrastructure Ilya Dryomov
2014-03-27 20:26 ` Alex Elder
2014-03-28 15:01 ` Ilya Dryomov
2014-03-27 18:18 ` [PATCH 22/33] libceph: primary_affinity decode bits Ilya Dryomov
2014-03-27 20:31 ` Alex Elder
2014-03-28 15:01 ` Ilya Dryomov
2014-03-27 18:18 ` [PATCH 23/33] libceph: enable OSDMAP_ENC feature bit Ilya Dryomov
2014-03-27 20:32 ` Alex Elder
2014-03-28 15:01 ` Ilya Dryomov
2014-03-27 18:18 ` [PATCH 24/33] libceph: ceph_osd_{exists,is_up,is_down}(osd) definitions Ilya Dryomov
2014-03-27 20:33 ` Alex Elder
2014-03-27 18:18 ` [PATCH 25/33] libceph: ceph_can_shift_osds(pool) and pool type defines Ilya Dryomov
2014-03-27 20:34 ` Alex Elder
2014-03-27 18:18 ` [PATCH 26/33] libceph: introduce pg_to_raw_osds() and raw_to_up_osds() helpers Ilya Dryomov
2014-03-27 20:36 ` Alex Elder
2014-03-27 18:18 ` [PATCH 27/33] libceph: introduce apply_temps() helper Ilya Dryomov
2014-03-27 20:41 ` Alex Elder
2014-03-27 18:18 ` [PATCH 28/33] libceph: switch ceph_calc_pg_acting() to new helpers Ilya Dryomov
2014-03-27 20:49 ` Alex Elder
2014-03-28 15:02 ` Ilya Dryomov
2014-03-27 18:18 ` [PATCH 29/33] libceph: return primary from ceph_calc_pg_acting() Ilya Dryomov
2014-03-27 20:50 ` Alex Elder
2014-03-27 18:18 ` [PATCH 30/33] libceph: add support for primary_temp mappings Ilya Dryomov
2014-03-27 20:51 ` Alex Elder
2014-03-27 18:18 ` [PATCH 31/33] libceph: add support for osd primary affinity Ilya Dryomov
2014-03-27 20:59 ` Alex Elder
2014-03-28 15:03 ` Ilya Dryomov
2014-03-27 18:18 ` [PATCH 32/33] libceph: redo ceph_calc_pg_primary() in terms of ceph_calc_pg_acting() Ilya Dryomov
2014-03-27 21:04 ` Alex Elder [this message]
2014-03-27 18:18 ` [PATCH 33/33] libceph: enable PRIMARY_AFFINITY feature bit Ilya Dryomov
2014-03-27 21:04 ` Alex Elder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53349256.9090804@ieee.org \
--to=elder@ieee.org \
--cc=ceph-devel@vger.kernel.org \
--cc=ilya.dryomov@inktank.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox