From: Guang Yang Date: Wed, 2 Dec 2015 17:54:58 +0000 (+0000) Subject: osd: prioritize recovery based on pool's customized priority X-Git-Tag: v10.0.2~110^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=745589763660771993016af04e4cdf9cdebc447e;p=ceph.git osd: prioritize recovery based on pool's customized priority Fixes: 13121 Signed-off-by: Guang Yang --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 263c88bed5f..9329b5de829 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2078,26 +2078,33 @@ void PG::mark_clean() unsigned PG::get_recovery_priority() { // a higher value -> a higher priority - return OSD_RECOVERY_PRIORITY_MAX; + + int pool_recovery_priority = 0; + pool.info.opts.get(pool_opts_t::RECOVERY_PRIORITY, &pool_recovery_priority); + + unsigned ret = OSD_RECOVERY_PRIORITY_BASE + pool_recovery_priority; + if (ret > OSD_RECOVERY_PRIORITY_MAX) + ret = OSD_RECOVERY_PRIORITY_MAX; + return ret; } unsigned PG::get_backfill_priority() { // a higher value -> a higher priority - // undersized: 200 + num missing replicas + unsigned ret = OSD_BACKFILL_PRIORITY_BASE; if (is_undersized()) { + // undersized: OSD_BACKFILL_DEGRADED_PRIORITY_BASE + num missing replicas assert(pool.info.size > actingset.size()); - return 200 + (pool.info.size - actingset.size()); - } + ret = OSD_BACKFILL_DEGRADED_PRIORITY_BASE + (pool.info.size - actingset.size()); - // degraded: baseline degraded - if (is_degraded()) { - return 200; + } else if (is_degraded()) { + // degraded: baseline degraded + ret = OSD_BACKFILL_DEGRADED_PRIORITY_BASE; } + assert (ret < OSD_RECOVERY_PRIORITY_MAX); - // baseline - return 1; + return ret; } void PG::finish_recovery(list& tfin) diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 98ae300eb79..832321e3da6 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -63,6 +63,14 @@ /// max recovery priority for MBackfillReserve #define OSD_RECOVERY_PRIORITY_MAX 255u +/// base recovery priority for MBackfillReserve +#define OSD_RECOVERY_PRIORITY_BASE 230u + +/// base backfill priority for MBackfillReserve (degraded PG) +#define OSD_BACKFILL_DEGRADED_PRIORITY_BASE 200u + +/// base backfill priority for MBackfillReserve +#define OSD_BACKFILL_PRIORITY_BASE 1u typedef hobject_t collection_list_handle_t;