From patchwork Mon Jan 27 15:58:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 3542911 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 CBD0BC02DC for ; Mon, 27 Jan 2014 16:00:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2A21520123 for ; Mon, 27 Jan 2014 16:00:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ADBD720117 for ; Mon, 27 Jan 2014 16:00:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753516AbaA0P77 (ORCPT ); Mon, 27 Jan 2014 10:59:59 -0500 Received: from mail-lb0-f171.google.com ([209.85.217.171]:42364 "EHLO mail-lb0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752937AbaA0P76 (ORCPT ); Mon, 27 Jan 2014 10:59:58 -0500 Received: by mail-lb0-f171.google.com with SMTP id c11so4559883lbj.2 for ; Mon, 27 Jan 2014 07:59:57 -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=f1MeiYByEuIgz09X4p59W7TkNCNJ8SD5XKQKg5pEtoU=; b=UN3SURDuSfrFyn1NTMoM3G+Re1UnIT5IaD0JWW7ald+dpWwhJjg69T5uAlnApex9GN L8cX5DzanCyOGWGzwXwTej74di6RsulLeA2u3eY5FI/+/BLcusQahhrbenWuArT61sNg p5zuGWbPz6cMp4x3RooEK3FZm3TpdgGDn4zMeP3yCgiehYbSOD/G+xQW7VQVp9tQvjfX UAZHWGQfiQZUtdU4pX7p2WZh+TLSDr3Pg3jqrylKHCDXH4qdaS8dcZVAFZKLNomR9adz 0kjSSHqm1n73QoPd4WCrd3kXgV9BTuAhDcLfPEbT2EHzx6lQzXyBUYO+kSQd1TScuik6 h9Bw== X-Gm-Message-State: ALoCoQk21DZmBiLjkj9RWn8b0xbfQFYSC+OOqTQLiiDYgjlnvWpescTHLQO+YFZNa8uYSx2TitAR X-Received: by 10.153.7.137 with SMTP id dc9mr18255245lad.25.1390838396881; Mon, 27 Jan 2014 07:59:56 -0800 (PST) Received: from localhost ([109.110.66.110]) by mx.google.com with ESMTPSA id g8sm17847379lae.1.2014.01.27.07.59.55 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 27 Jan 2014 07:59:56 -0800 (PST) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: ilya.dryomov@inktank.com Subject: [PATCH 02/11] libceph: move ceph_file_layout helpers to ceph_fs.h Date: Mon, 27 Jan 2014 17:58:44 +0200 Message-Id: <1390838333-32266-3-git-send-email-ilya.dryomov@inktank.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1390838333-32266-1-git-send-email-ilya.dryomov@inktank.com> References: <1390838333-32266-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 Move ceph_file_layout helper macros and inline functions to ceph_fs.h. Signed-off-by: Ilya Dryomov --- include/linux/ceph/ceph_fs.h | 23 +++++++++++++++++++++++ include/linux/ceph/osdmap.h | 27 --------------------------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h index 0a37b989b52f..2623cffc73a1 100644 --- a/include/linux/ceph/ceph_fs.h +++ b/include/linux/ceph/ceph_fs.h @@ -53,6 +53,29 @@ struct ceph_file_layout { __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */ } __attribute__ ((packed)); +#define ceph_file_layout_su(l) ((__s32)le32_to_cpu((l).fl_stripe_unit)) +#define ceph_file_layout_stripe_count(l) \ + ((__s32)le32_to_cpu((l).fl_stripe_count)) +#define ceph_file_layout_object_size(l) ((__s32)le32_to_cpu((l).fl_object_size)) +#define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash)) +#define ceph_file_layout_object_su(l) \ + ((__s32)le32_to_cpu((l).fl_object_stripe_unit)) +#define ceph_file_layout_pg_pool(l) \ + ((__s32)le32_to_cpu((l).fl_pg_pool)) + +static inline unsigned ceph_file_layout_stripe_width(struct ceph_file_layout *l) +{ + return le32_to_cpu(l->fl_stripe_unit) * + le32_to_cpu(l->fl_stripe_count); +} + +/* "period" == bytes before i start on a new set of objects */ +static inline unsigned ceph_file_layout_period(struct ceph_file_layout *l) +{ + return le32_to_cpu(l->fl_object_size) * + le32_to_cpu(l->fl_stripe_count); +} + #define CEPH_MIN_STRIPE_UNIT 65536 int ceph_file_layout_is_valid(const struct ceph_file_layout *layout); diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h index 256134af4ad4..f2679c384625 100644 --- a/include/linux/ceph/osdmap.h +++ b/include/linux/ceph/osdmap.h @@ -72,33 +72,6 @@ struct ceph_osdmap { struct crush_map *crush; }; -/* - * file layout helpers - */ -#define ceph_file_layout_su(l) ((__s32)le32_to_cpu((l).fl_stripe_unit)) -#define ceph_file_layout_stripe_count(l) \ - ((__s32)le32_to_cpu((l).fl_stripe_count)) -#define ceph_file_layout_object_size(l) ((__s32)le32_to_cpu((l).fl_object_size)) -#define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash)) -#define ceph_file_layout_object_su(l) \ - ((__s32)le32_to_cpu((l).fl_object_stripe_unit)) -#define ceph_file_layout_pg_pool(l) \ - ((__s32)le32_to_cpu((l).fl_pg_pool)) - -static inline unsigned ceph_file_layout_stripe_width(struct ceph_file_layout *l) -{ - return le32_to_cpu(l->fl_stripe_unit) * - le32_to_cpu(l->fl_stripe_count); -} - -/* "period" == bytes before i start on a new set of objects */ -static inline unsigned ceph_file_layout_period(struct ceph_file_layout *l) -{ - return le32_to_cpu(l->fl_object_size) * - le32_to_cpu(l->fl_stripe_count); -} - - 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);