From patchwork Mon Dec 23 17:09:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 3397561 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0E1C2C0D4A for ; Mon, 23 Dec 2013 17:11:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 51EE9206A9 for ; Mon, 23 Dec 2013 17:11:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 99BE620688 for ; Mon, 23 Dec 2013 17:11:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757725Ab3LWRLQ (ORCPT ); Mon, 23 Dec 2013 12:11:16 -0500 Received: from mail-ee0-f41.google.com ([74.125.83.41]:47405 "EHLO mail-ee0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757713Ab3LWRLM (ORCPT ); Mon, 23 Dec 2013 12:11:12 -0500 Received: by mail-ee0-f41.google.com with SMTP id t10so2486005eei.0 for ; Mon, 23 Dec 2013 09:11:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=on44ebUE2SYVGzBIiDU1dPO6rj1Dt/4yfiflqL5kqH0=; b=GA/OdefK18FhWM29ZfhVTPTwxSteCk+hVE6pI8/45EeISD2RADE+H/qRZm+CUm5YQy faGiigY8HNCWql0z7z8Xt8Sv1V5v7+yp/FMd4PhgKYB75A1RldV5aTEMbpiQg8VoCf36 jZHD66S50J7uf9DpMep2XCIKRh/PiJwSlXsl0vYrA8Rq7Nbf1GAhlHT2d+43mzwASPOT QSKUjYCYldGe7XTnOGXAcB+pi9u9m6NO8heGk19N5dN27MCukTTSy/ZrdGlc1WcGiJly DJ+IKM/ycOaVIiWMIZX9b5NoQyJr53zjlG5toHr8BqEoCbRhJNlqe3EKw3hqv/LtzdEC I1rg== X-Gm-Message-State: ALoCoQlK0PrN/r/s17/fUJFE+HU8qKAo3U/ga1NEyCSaaT/Lpbj3AWl3p6xwlme+uKt8QHV15ovE X-Received: by 10.14.218.69 with SMTP id j45mr23041190eep.22.1387818671505; Mon, 23 Dec 2013 09:11:11 -0800 (PST) Received: from localhost ([109.110.66.29]) by mx.google.com with ESMTPSA id z42sm47308232eeo.17.2013.12.23.09.11.10 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 23 Dec 2013 09:11:11 -0800 (PST) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Sage Weil , ilya.dryomov@inktank.com Subject: [PATCH 17/19] crush: add set_choose_local_[fallback_]tries steps Date: Mon, 23 Dec 2013 19:09:48 +0200 Message-Id: <1387818590-30483-18-git-send-email-ilya.dryomov@inktank.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1387818590-30483-1-git-send-email-ilya.dryomov@inktank.com> References: <1387818590-30483-1-git-send-email-ilya.dryomov@inktank.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 This allows all of the tunables to be overridden by a specific rule. Reflects ceph.git commits d129e09e57fbc61cfd4f492e3ee77d0750c9d292, 0497db49e5973b50df26251ed0e3f4ac7578e66e. Signed-off-by: Ilya Dryomov --- include/linux/crush/crush.h | 2 ++ net/ceph/crush/mapper.c | 28 +++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/include/linux/crush/crush.h b/include/linux/crush/crush.h index 7b0fc4aba75b..acaa5615d634 100644 --- a/include/linux/crush/crush.h +++ b/include/linux/crush/crush.h @@ -49,6 +49,8 @@ enum { CRUSH_RULE_SET_CHOOSE_TRIES = 8, /* override choose_total_tries */ CRUSH_RULE_SET_CHOOSELEAF_TRIES = 9, /* override chooseleaf_descend_once */ + CRUSH_RULE_SET_CHOOSE_LOCAL_TRIES = 10, + CRUSH_RULE_SET_CHOOSE_LOCAL_FALLBACK_TRIES = 11, }; /* diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c index 0613dd2d5fa3..8cde4818e18b 100644 --- a/net/ceph/crush/mapper.c +++ b/net/ceph/crush/mapper.c @@ -300,6 +300,8 @@ static int crush_choose_firstn(const struct crush_map *map, int *out, int outpos, unsigned int attempts, unsigned int recurse_attempts, + unsigned int local_tries, + unsigned int local_fallback_tries, int recurse_to_leaf, int *out2) { @@ -338,9 +340,9 @@ static int crush_choose_firstn(const struct crush_map *map, reject = 1; goto reject; } - if (map->choose_local_fallback_tries > 0 && + if (local_fallback_tries > 0 && flocal >= (in->size>>1) && - flocal > map->choose_local_fallback_tries) + flocal > local_fallback_tries) item = bucket_perm_choose(in, x, r); else item = crush_bucket_choose(in, x, r); @@ -387,6 +389,8 @@ static int crush_choose_firstn(const struct crush_map *map, x, outpos+1, 0, out2, outpos, recurse_attempts, 0, + local_tries, + local_fallback_tries, 0, NULL) <= outpos) /* didn't get leaf */ @@ -412,11 +416,11 @@ reject: ftotal++; flocal++; - if (collide && flocal <= map->choose_local_tries) + if (collide && flocal <= local_tries) /* retry locally a few times */ retry_bucket = 1; - else if (map->choose_local_fallback_tries > 0 && - flocal <= in->size + map->choose_local_fallback_tries) + else if (local_fallback_tries > 0 && + flocal <= in->size + local_fallback_tries) /* exhaustive bucket search */ retry_bucket = 1; else if (ftotal <= attempts) @@ -633,6 +637,8 @@ int crush_do_rule(const struct crush_map *map, int i, j; int numrep; int choose_tries = map->choose_total_tries; + int choose_local_tries = map->choose_local_tries; + int choose_local_fallback_tries = map->choose_local_fallback_tries; int choose_leaf_tries = 0; if ((__u32)ruleno >= map->max_rules) { @@ -665,6 +671,16 @@ int crush_do_rule(const struct crush_map *map, choose_leaf_tries = curstep->arg1; break; + case CRUSH_RULE_SET_CHOOSE_LOCAL_TRIES: + if (curstep->arg1 > 0) + choose_local_tries = curstep->arg1; + break; + + case CRUSH_RULE_SET_CHOOSE_LOCAL_FALLBACK_TRIES: + if (curstep->arg1 > 0) + choose_local_fallback_tries = curstep->arg1; + break; + case CRUSH_RULE_CHOOSELEAF_FIRSTN: case CRUSH_RULE_CHOOSE_FIRSTN: firstn = 1; @@ -714,6 +730,8 @@ int crush_do_rule(const struct crush_map *map, o+osize, j, choose_tries, recurse_tries, + choose_local_tries, + choose_local_fallback_tries, recurse_to_leaf, c+osize); } else {