From patchwork Mon Dec 23 17:09:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 3397441 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 51F559F375 for ; Mon, 23 Dec 2013 17:11:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30C1620634 for ; Mon, 23 Dec 2013 17:11:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 850B720568 for ; Mon, 23 Dec 2013 17:11:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757602Ab3LWRKx (ORCPT ); Mon, 23 Dec 2013 12:10:53 -0500 Received: from mail-ea0-f182.google.com ([209.85.215.182]:33197 "EHLO mail-ea0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752635Ab3LWRKw (ORCPT ); Mon, 23 Dec 2013 12:10:52 -0500 Received: by mail-ea0-f182.google.com with SMTP id a15so2485026eae.13 for ; Mon, 23 Dec 2013 09:10:51 -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=8CnhoGs8uL3VC9iEE0DY7Q+csPV4gjgiQMCqiH6yck8=; b=EHmCMSyapxFpjXun7C6uLMpoQJmdhOH+BLer3BOPlCq4YALzJbHfw6JOVF21iM4hE/ yhi81+IDEqsr1sMweus7Z8/DGQJtXDWE9Bo1SlKD11HvLZdQ2vyJdX6bp10Qorm1Lx1b TZ8QTAFE4FXghpMrQ3AgnfuQAR3m8SBQzWqWlhDWBVvvrm8jVHha+yyu4tskEBQLcZpN QcQd3EL5T6QPaUeMptmT3HhlCHTqMh6K+hfzI8I+FPHFC4TXVv2y7DD6Dp/SX5fW0qap jCpNKCflu/BQ7R5UU/tPitisWncGIH503uK29JPu2FKxDCniJOoWfw4RjWr1SwsPFSkN /fQw== X-Gm-Message-State: ALoCoQkFn2HdG+eyiciOJmzFzOIBbbnR8fwtK1/L1O979n96dxP9N/Esx/Elvs2Esii2Ckc2hw5+ X-Received: by 10.15.91.3 with SMTP id r3mr23158567eez.18.1387818651325; Mon, 23 Dec 2013 09:10:51 -0800 (PST) Received: from localhost ([109.110.66.29]) by mx.google.com with ESMTPSA id a45sm47334488eem.6.2013.12.23.09.10.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 23 Dec 2013 09:10:50 -0800 (PST) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Sage Weil , ilya.dryomov@inktank.com Subject: [PATCH 06/19] crush: return CRUSH_ITEM_UNDEF for failed placements with indep Date: Mon, 23 Dec 2013 19:09:37 +0200 Message-Id: <1387818590-30483-7-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 For firstn mode, if we fail to make a valid placement choice, we just continue and return a short result to the caller. For indep mode, however, we need to make the position stable, and return an undefined value on failed placements to avoid shifting later results to the left. Reflects ceph.git commit b1d4dd4eb044875874a1d01c01c7d766db5d0a80. Signed-off-by: Ilya Dryomov --- include/linux/crush/crush.h | 3 ++- net/ceph/crush/mapper.c | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/linux/crush/crush.h b/include/linux/crush/crush.h index 83543c504b5a..3d6a12928560 100644 --- a/include/linux/crush/crush.h +++ b/include/linux/crush/crush.h @@ -19,10 +19,11 @@ #define CRUSH_MAGIC 0x00010000ul /* for detecting algorithm revisions */ - #define CRUSH_MAX_DEPTH 10 /* max crush hierarchy depth */ +#define CRUSH_ITEM_UNDEF 0x7fffffff /* undefined result */ + /* * CRUSH uses user-defined "rules" to describe how inputs should be * mapped to devices. A rule consists of sequence of steps to perform diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c index dcf48bc504ea..a8605245d190 100644 --- a/net/ceph/crush/mapper.c +++ b/net/ceph/crush/mapper.c @@ -455,8 +455,12 @@ reject: } while (retry_descent); if (skip_rep) { - dprintk("skip rep\n"); - continue; + if (firstn) { + dprintk("skip rep\n"); + continue; + } + dprintk("undef rep, continuing\n"); + item = CRUSH_ITEM_UNDEF; } dprintk("CHOOSE got %d\n", item);