From patchwork Thu May 21 13:34:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Wang X-Patchwork-Id: 6455431 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 92AF0C0432 for ; Thu, 21 May 2015 13:39:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93D3F20454 for ; Thu, 21 May 2015 13:39:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7DDDE2044C for ; Thu, 21 May 2015 13:39:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756168AbbEUNjb (ORCPT ); Thu, 21 May 2015 09:39:31 -0400 Received: from m59-178.qiye.163.com ([123.58.178.59]:58926 "EHLO m59-178.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755830AbbEUNgB (ORCPT ); Thu, 21 May 2015 09:36:01 -0400 Received: from localhost.localdomain (unknown [113.240.220.93]) by m59-178.qiye.163.com (HMail) with ESMTPA id 827761481A53; Thu, 21 May 2015 21:35:44 +0800 (CST) From: Li Wang To: Sage Weil Cc: ceph-devel@vger.kernel.org, MingXin Liu Subject: [PATCH 4/5] Mon: add temperature support for existing cache related commands Date: Thu, 21 May 2015 21:34:09 +0800 Message-Id: <09ccb9b25477f32636a07878e6922fc8feb2445c.1432214851.git.liwang@ubuntukylin.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: X-HM-Spam-Status: e1koWUFPN1dZCBgUCR5ZQUpOVUNJQkJCQkJJSExLTUtOTldZCQ4XHghZQV koKz0kKDQ9Lz06MjckMjUkMz46Pz4pQUtVS0A2IyQiPigkMjUkMz46Pz4pQUtVS0ArLykkNTQkMj UkMz46Pz4pQUlVS0A*IjU6NjI4JDIrJDU0JDI1JDM#Oj8#KUFLVUtANi43LzIkKTgrLyQ*Mj09Pi k#NS8kMjUkMz46Pz4pQUlVS0AyKyQvND86IiQ4NS8kSyRKS0tBS1VLQDIrJEokMzQuKSQ4NS8kSy RKS0tBS1VLQDIrJEokNjI1Li8#JDg1LyRLJEpLQUtVS0AyKyRISyQ2MjUuLz4kODUvJEskTktBS1 VLQDIrJE4kNjI1Li8#JDg1LyRLJEpLQUtVS0AoLjkxPjgvJC80PzoiJDg1LyRLJEpLS0FLVUtAKC 45MT44LyROJDYyNS4vPiQ4NS8kSyRKS0FLVUtAKC45MT44LyRKJDM0LikkODUvJEskSktLQUtVS0 A1NC8kPTo2NC4oJD80NjoyNSQoKz0kPToyN0FKS1VLQCguOSQ#QUpVTk5APTUkKC45JD41LDQpPy gkMzcxJEpLS0lLSkFLVUlDWQY+ X-HM-Sender-Digest: e1kSHx4VD1lBWUc6PD46Qhw*Hjo4HgEdUSgLNDkOFjMwCz9VSlVKT0hJ SUpOSE9OTEtPVTMWGhIXVRcSDBoVHDsOGQ4VDw4QAhcSFVUYFBZFWVdZDB4ZWUEdGhcIHldZCAFZ QU9DQkw3V1kSC1lBWUpKSFVJT0tVSUlLVUJIWQY+ X-HM-Tid: 0a4d76afd5db649f827761481a53 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: MingXin Liu Signed-off-by: MingXin Liu Reviewed-by: Li Wang --- src/common/config_opts.h | 2 ++ src/mon/OSDMonitor.cc | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index e79eeaa..f661cbc 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -550,10 +550,12 @@ OPTION(osd_hit_set_max_size, OPT_INT, 100000) // max target size for a HitSet OPTION(osd_hit_set_namespace, OPT_STR, ".ceph-internal") // rados namespace for hit_set tracking OPTION(osd_tier_default_cache_mode, OPT_STR, "writeback") +OPTION(osd_tier_default_cache_measure, OPT_STR, "atime") OPTION(osd_tier_default_cache_hit_set_count, OPT_INT, 4) OPTION(osd_tier_default_cache_hit_set_period, OPT_INT, 1200) OPTION(osd_tier_default_cache_hit_set_type, OPT_STR, "bloom") OPTION(osd_tier_default_cache_min_read_recency_for_promote, OPT_INT, 1) // number of recent HitSets the object must appear in to be promoted (on read) +OPTION(osd_tier_default_cache_hit_set_grade_decay_rate, OPT_INT, 50) OPTION(osd_map_dedup, OPT_BOOL, true) OPTION(osd_map_max_advance, OPT_INT, 200) // make this < cache_size! diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 0374778..ac84b56 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2723,13 +2723,15 @@ void OSDMonitor::get_health(list >& summary, p != osdmap.pools.end(); ++p) { const pg_pool_t& info = p->second; - if (info.cache_mode_requires_hit_set() && + if ((info.cache_mode_requires_hit_set() || + info.cache_measure == pg_pool_t::CACHEMEASURE_TEMP) && info.hit_set_params.get_type() == HitSet::TYPE_NONE) { ++problem_cache_pools; if (detail) { ostringstream ss; ss << "pool '" << osdmap.get_pool_name(p->first) << "' with cache_mode " << info.get_cache_mode_name() + << " cache_measure " << info.get_cache_measure_name() << " needs hit_set_type to be set but it is not"; detail->push_back(make_pair(HEALTH_WARN, ss.str())); } @@ -6874,6 +6876,13 @@ done: err = -EINVAL; goto reply; } + string measurestr = g_conf->osd_tier_default_cache_measure; + pg_pool_t::cache_measure_t measure = pg_pool_t::get_cache_measure_from_str(measurestr); + if (measure < 0) { + ss << "osd tier cache default measure '" << measurestr << "' is not a valid cache measure"; + err = -EINVAL; + goto reply; + } HitSet::Params hsp; if (g_conf->osd_tier_default_cache_hit_set_type == "bloom") { BloomHitSet::Params *bsp = new BloomHitSet::Params; @@ -6902,11 +6911,14 @@ done: np->set_snap_epoch(pending_inc.epoch); // tier will update to our snap info ntp->tier_of = pool_id; ntp->cache_mode = mode; + ntp->cache_measure = measure; ntp->hit_set_count = g_conf->osd_tier_default_cache_hit_set_count; ntp->hit_set_period = g_conf->osd_tier_default_cache_hit_set_period; ntp->min_read_recency_for_promote = g_conf->osd_tier_default_cache_min_read_recency_for_promote; + ntp->hit_set_grade_decay_rate = g_conf->osd_tier_default_cache_hit_set_grade_decay_rate; ntp->hit_set_params = hsp; ntp->target_max_bytes = size; + ntp->set_grade(ntp->hit_set_grade_decay_rate, ntp->hit_set_count); ss << "pool '" << tierpoolstr << "' is now (or already was) a cache tier of '" << poolstr << "'"; wait_for_finished_proposal(new Monitor::C_Command(mon, m, 0, ss.str(), get_last_committed() + 1));