From patchwork Mon Dec 23 17:09:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 3397541 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 4FCECC0D4A for ; Mon, 23 Dec 2013 17:11:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A7B82069D for ; Mon, 23 Dec 2013 17:11:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC881205F1 for ; Mon, 23 Dec 2013 17:11:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757716Ab3LWRLM (ORCPT ); Mon, 23 Dec 2013 12:11:12 -0500 Received: from mail-ea0-f179.google.com ([209.85.215.179]:38374 "EHLO mail-ea0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757705Ab3LWRLK (ORCPT ); Mon, 23 Dec 2013 12:11:10 -0500 Received: by mail-ea0-f179.google.com with SMTP id r15so2465855ead.38 for ; Mon, 23 Dec 2013 09:11:10 -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=0lwrx1WcXfRbHmeXf1kx6/j2giBwG5OLzAYvKnhSDNA=; b=FsRqBNai1uc+OtczkeGrdWfUe/jvi1VUqiRZ9TnnxBAPCOEsvGEn9Ebv0OS5MrFVWu gL3KH1PsyJlfsXneAS5r7PFq7ZwoOBACMyKB6NRmh2Yg7pF6wGDYqH1hWtobSUxVpi1s mbohHDqEymYAdhHE5hmeWZoEMdBSiRTqQiiDPRWslZvpga9j8T7zoEiQd21zN7H+WO6I RVCwSEzY9fqDlQe/ZHm0hsMsMlPe0s0bk/kdEAPI5n5O40dX2bYPE6M2NitBPz3h+5kA lH/vGzJe0ZFBr7+jFCmpBx6R45MBD2ZfYHsPm8HYUtznp9vIn47PTyXjekK3BnRIl1oq gyIg== X-Gm-Message-State: ALoCoQle/2a7K5j9w1WYJcFt2TZzKMQTaoRJJ1MqzR93BjIcUbIA4Datx747FHjCu8dYpYfrbjQ9 X-Received: by 10.15.41.140 with SMTP id s12mr21761368eev.50.1387818669665; Mon, 23 Dec 2013 09:11:09 -0800 (PST) Received: from localhost ([109.110.66.29]) by mx.google.com with ESMTPSA id 4sm47311137eed.14.2013.12.23.09.11.08 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 23 Dec 2013 09:11:09 -0800 (PST) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Sage Weil , ilya.dryomov@inktank.com Subject: [PATCH 16/19] crush: generalize descend_once Date: Mon, 23 Dec 2013 19:09:47 +0200 Message-Id: <1387818590-30483-17-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 The legacy behavior is to make the normal number of tries for the recursive chooseleaf call. The descend_once tunable changed this to making a single try and bail if we get a reject (note that it is impossible to collide in the recursive case). The new set_chooseleaf_tries lets you select the number of recursive chooseleaf attempts for indep mode, or default to 1. Use the same behavior for firstn, except default to total_tries when the legacy tunables are set (for compatibility). This makes the rule step override the (new) default of 1 recursive attempt, keeping behavior consistent with indep mode. Reflects ceph.git commit 685c6950ef3df325ef04ce7c986e36ca2514c5f1. Signed-off-by: Ilya Dryomov --- net/ceph/crush/mapper.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c index e9256a30e60d..0613dd2d5fa3 100644 --- a/net/ceph/crush/mapper.c +++ b/net/ceph/crush/mapper.c @@ -291,7 +291,6 @@ static int is_out(const struct crush_map *map, * @out: pointer to output vector * @outpos: our position in that vector * @recurse_to_leaf: true if we want one device under each item of given type - * @descend_once: true if we should only try one descent before giving up * @out2: second output vector for leaf items (if @recurse_to_leaf) */ static int crush_choose_firstn(const struct crush_map *map, @@ -302,7 +301,7 @@ static int crush_choose_firstn(const struct crush_map *map, unsigned int attempts, unsigned int recurse_attempts, int recurse_to_leaf, - int descend_once, int *out2) + int *out2) { int rep; unsigned int ftotal, flocal; @@ -389,7 +388,6 @@ static int crush_choose_firstn(const struct crush_map *map, out2, outpos, recurse_attempts, 0, 0, - map->chooseleaf_descend_once, NULL) <= outpos) /* didn't get leaf */ reject = 1; @@ -414,10 +412,7 @@ reject: ftotal++; flocal++; - if (reject && descend_once) - /* let outer call try again */ - skip_rep = 1; - else if (collide && flocal <= map->choose_local_tries) + if (collide && flocal <= map->choose_local_tries) /* retry locally a few times */ retry_bucket = 1; else if (map->choose_local_fallback_tries > 0 && @@ -639,7 +634,6 @@ int crush_do_rule(const struct crush_map *map, int numrep; int choose_tries = map->choose_total_tries; int choose_leaf_tries = 0; - const int descend_once = 0; if ((__u32)ruleno >= map->max_rules) { dprintk(" bad ruleno %d\n", ruleno); @@ -703,6 +697,14 @@ int crush_do_rule(const struct crush_map *map, } j = 0; if (firstn) { + int recurse_tries; + if (choose_leaf_tries) + recurse_tries = + choose_leaf_tries; + else if (map->chooseleaf_descend_once) + recurse_tries = 1; + else + recurse_tries = choose_tries; osize += crush_choose_firstn( map, map->buckets[-1-w[i]], @@ -711,9 +713,9 @@ int crush_do_rule(const struct crush_map *map, curstep->arg2, o+osize, j, choose_tries, - choose_leaf_tries ? choose_leaf_tries : choose_tries, + recurse_tries, recurse_to_leaf, - descend_once, c+osize); + c+osize); } else { crush_choose_indep( map, @@ -723,7 +725,8 @@ int crush_do_rule(const struct crush_map *map, curstep->arg2, o+osize, j, choose_tries, - choose_leaf_tries ? choose_leaf_tries : 1, + choose_leaf_tries ? + choose_leaf_tries : 1, recurse_to_leaf, c+osize, 0);