From patchwork Thu Mar 27 18:18:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 3899331 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 C1D7A9F2E8 for ; Thu, 27 Mar 2014 18:19:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D60B20253 for ; Thu, 27 Mar 2014 18:19:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3530220225 for ; Thu, 27 Mar 2014 18:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757159AbaC0STX (ORCPT ); Thu, 27 Mar 2014 14:19:23 -0400 Received: from mail-ee0-f44.google.com ([74.125.83.44]:62943 "EHLO mail-ee0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757144AbaC0STU (ORCPT ); Thu, 27 Mar 2014 14:19:20 -0400 Received: by mail-ee0-f44.google.com with SMTP id e49so3216173eek.31 for ; Thu, 27 Mar 2014 11:19:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=u9GWcAihosQKoXxfsp16QvAkKK8MszJN0TMIodgjgTs=; b=eDjV5dfhN2XfdavPiZwAppQV24rKz6yM61uw4bnF8vqMhbjwycJqcyMV7knSkfmHiX kvYSi/kv3ENrouS0prjEHIGS71h8jrggsDNjTF72Vq9u8DmNuvmi/svj45dY18W9Uenk paKH1D7224XeRMgENOGxe+TCLd8Ha0TLqt4lqGQjnebrV5EQBpVUgzael2OaUGY67yJ1 F/RTXxaZr1tWAcDFL/0zGGGe46hsn8uC00vsYl7mGIdbwcDh1tYlp3ZaJZuqpPn30rNB h2ZPGdEtSnJ7+1+OUmXSBf+/+u72MUjYorXzqoKDZHO+g70Scjid2NzuwzxmpXtO6h69 Yfjw== X-Gm-Message-State: ALoCoQkLDxFafouSiUy5kXEqhBr6xz0wajOQd4F2Lg7pEFUDPymZ6AbZzsCHU4TKqBBmUqjIblYl X-Received: by 10.15.42.138 with SMTP id u10mr3086244eev.7.1395944359510; Thu, 27 Mar 2014 11:19:19 -0700 (PDT) Received: from localhost ([109.110.66.7]) by mx.google.com with ESMTPSA id m8sm5982600eeg.11.2014.03.27.11.19.18 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 27 Mar 2014 11:19:18 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 24/33] libceph: ceph_osd_{exists, is_up, is_down}(osd) definitions Date: Thu, 27 Mar 2014 20:18:10 +0200 Message-Id: <1395944299-21970-25-git-send-email-ilya.dryomov@inktank.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395944299-21970-1-git-send-email-ilya.dryomov@inktank.com> References: <1395944299-21970-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.3 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 Sync up with ceph.git definitions. Bring in ceph_osd_is_down(). Signed-off-by: Ilya Dryomov Reviewed-by: Alex Elder --- include/linux/ceph/osdmap.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h index 6e030cb3c9ca..0895797b9e28 100644 --- a/include/linux/ceph/osdmap.h +++ b/include/linux/ceph/osdmap.h @@ -125,9 +125,21 @@ static inline void ceph_oid_copy(struct ceph_object_id *dest, dest->name_len = src->name_len; } +static inline int ceph_osd_exists(struct ceph_osdmap *map, int osd) +{ + return osd >= 0 && osd < map->max_osd && + (map->osd_state[osd] & CEPH_OSD_EXISTS); +} + static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd) { - return (osd < map->max_osd) && (map->osd_state[osd] & CEPH_OSD_UP); + return ceph_osd_exists(map, osd) && + (map->osd_state[osd] & CEPH_OSD_UP); +} + +static inline int ceph_osd_is_down(struct ceph_osdmap *map, int osd) +{ + return !ceph_osd_is_up(map, osd); } static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag)