From patchwork Mon Dec 23 17:09:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 3397491 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 E033AC0D4B for ; Mon, 23 Dec 2013 17:11:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BEACA20634 for ; Mon, 23 Dec 2013 17:11:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F401520688 for ; Mon, 23 Dec 2013 17:11:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757652Ab3LWRLE (ORCPT ); Mon, 23 Dec 2013 12:11:04 -0500 Received: from mail-ee0-f50.google.com ([74.125.83.50]:58892 "EHLO mail-ee0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757633Ab3LWRLB (ORCPT ); Mon, 23 Dec 2013 12:11:01 -0500 Received: by mail-ee0-f50.google.com with SMTP id c41so2436157eek.37 for ; Mon, 23 Dec 2013 09:11:00 -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=GaWitjxtCN7ewzzoLZo9bsrr0FF19s+LTPWflbYxZlg=; b=mdP5xR9Ifp3OBmjec1zqG8iUPD0qrW90BGnBOddygiMG00RdSmSR6GSr0BVi29TzC3 vBqIBZgkj0IuVL4lo7y6tlqAE9LAtiuz5B2QjQx6oTkdeTUa5QVvO2VaPgnpYSMAIsKw oUi01h0bJxASDYpCBswUCLp/UfaPMi50PR3rB+WpyFG6s0SS+QIEcyl1Y3ZBDeJusBan io7IEOoKPNsbdXt0nM2h+SGaHH6wEqWJRKiT0UI9r87eUMUeVcgqKj7fxQHuD8Xa8+Qd oQjNqTbt6562unCGm9e0gcoTON6CZIe7Dp0K37uuMCCKT8wq+bUeJEDFon3pMsss3iIl +47w== X-Gm-Message-State: ALoCoQlaQRCveI6QGiWZ8ErfVUKtpj/56m6iIdxXei/bCxIOQb/wMlHSU4FykDZKalZ0XqJ6x4U+ X-Received: by 10.15.83.8 with SMTP id b8mr23064175eez.6.1387818660617; Mon, 23 Dec 2013 09:11:00 -0800 (PST) Received: from localhost ([109.110.66.29]) by mx.google.com with ESMTPSA id h48sm47339128eev.3.2013.12.23.09.10.59 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 23 Dec 2013 09:11:00 -0800 (PST) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Sage Weil , ilya.dryomov@inktank.com Subject: [PATCH 11/19] crush: pass parent r value for indep call Date: Mon, 23 Dec 2013 19:09:42 +0200 Message-Id: <1387818590-30483-12-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 Pass down the parent's 'r' value so that we will sample different values in the recursive call when the parent tries multiple times. This avoids doing useless work (calling multiple times and trying the same values). Reflects ceph.git commit 2731d3030d7a3e80922b7f1b7756f9a4a124bac5. Signed-off-by: Ilya Dryomov --- net/ceph/crush/mapper.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c index 125dbd04f2b6..c727836b5860 100644 --- a/net/ceph/crush/mapper.c +++ b/net/ceph/crush/mapper.c @@ -460,7 +460,8 @@ static void crush_choose_indep(const struct crush_map *map, int x, int left, int numrep, int type, int *out, int outpos, int recurse_to_leaf, - int *out2) + int *out2, + int parent_r) { struct crush_bucket *in = bucket; int endpos = outpos + left; @@ -499,7 +500,7 @@ static void crush_choose_indep(const struct crush_map *map, * this will involve more devices in data * movement and tend to distribute the load. */ - r = rep; + r = rep + parent_r; /* be careful */ if (in->alg == CRUSH_BUCKET_UNIFORM && @@ -567,7 +568,7 @@ static void crush_choose_indep(const struct crush_map *map, weight, weight_max, x, 1, numrep, 0, out2, rep, - 0, NULL); + 0, NULL, r); if (out2[rep] == CRUSH_ITEM_NONE) { /* placed nothing; no leaf */ break; @@ -702,7 +703,8 @@ int crush_do_rule(const struct crush_map *map, curstep->arg2, o+osize, j, recurse_to_leaf, - c+osize); + c+osize, + 0); osize += numrep; } }