From patchwork Tue Nov 4 14:34:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Spray X-Patchwork-Id: 5228151 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 AF5E7C11AD for ; Tue, 4 Nov 2014 14:35:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D24B0200F0 for ; Tue, 4 Nov 2014 14:35:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D68AD201C0 for ; Tue, 4 Nov 2014 14:35:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754066AbaKDOfV (ORCPT ); Tue, 4 Nov 2014 09:35:21 -0500 Received: from mail-wg0-f47.google.com ([74.125.82.47]:34704 "EHLO mail-wg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753153AbaKDOfR (ORCPT ); Tue, 4 Nov 2014 09:35:17 -0500 Received: by mail-wg0-f47.google.com with SMTP id a1so13679421wgh.20 for ; Tue, 04 Nov 2014 06:35:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=AzAWkWdxSW7czFqdE+BdAshUfY1qeSO10DaMTzRIUFg=; b=UVZbP2yRuot5geNwyr2Z+9MTmmwExhaG9ljn5R3O+tFjizTmrvidJIcNwCNX08Nvb7 fycAKdRcyTmSEVWZRZr5PHlbY/9e58E0kjTIPPNqpS3QdwBTqlUgZDdi0UC7Te9tWCNd 4t32HPzC+/oQPSoba1qN08CDPfIxW5Gi2xy38LFWLPjfHjbuHOQ45ikb2/ANGPJpgwle 36H9kAC2F901TDbxwPY6ZF4YgHbdMONxCcxTCBnfXhTeoGoJhksV+HObjeQw5efA0iHz ZJsqtdIMUt9+69rBQSYAURTfDf/BHPnS4Mph/FvdN3JoyP5+9WA3naHhmtiBEEK++BpG E63w== X-Gm-Message-State: ALoCoQmkqSbX0Yr/xHnltmvG42SvkucUDKOaWc3eR68VY6ir1YSBtqsrzEMqteYc8s9ZdBuvxjLw X-Received: by 10.194.172.234 with SMTP id bf10mr57100226wjc.81.1415111715122; Tue, 04 Nov 2014 06:35:15 -0800 (PST) Received: from anthracite.localdomain (82-71-55-202.dsl.in-addr.zen.co.uk. [82.71.55.202]) by mx.google.com with ESMTPSA id w5sm1229004wif.18.2014.11.04.06.35.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Nov 2014 06:35:14 -0800 (PST) From: John Spray To: ceph-devel@vger.kernel.org Cc: John Spray Subject: [PATCH 5/7] ceph: update CAPRELEASE message format Date: Tue, 4 Nov 2014 14:34:27 +0000 Message-Id: <1415111669-26246-6-git-send-email-john.spray@redhat.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1415111669-26246-1-git-send-email-john.spray@redhat.com> References: <1415111669-26246-1-git-send-email-john.spray@redhat.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.5 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 Version 2 includes the new osd epoch barrier field. This allows clients to inform servers that their released caps may not be used until a particular OSD map epoch. Signed-off-by: John Spray --- fs/ceph/mds_client.c | 13 +++++++++++++ fs/ceph/mds_client.h | 8 ++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index dce7977..3f5bc23 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -1508,12 +1508,25 @@ void ceph_send_cap_releases(struct ceph_mds_client *mdsc, struct ceph_mds_session *session) { struct ceph_msg *msg; + u32 *cap_barrier; dout("send_cap_releases mds%d\n", session->s_mds); spin_lock(&session->s_cap_lock); while (!list_empty(&session->s_cap_releases_done)) { msg = list_first_entry(&session->s_cap_releases_done, struct ceph_msg, list_head); + + BUG_ON(msg->front.iov_len + sizeof(*cap_barrier) > \ + PAGE_CACHE_SIZE); + + // Append cap_barrier field + cap_barrier = msg->front.iov_base + msg->front.iov_len; + *cap_barrier = cpu_to_le32(mdsc->cap_epoch_barrier); + msg->front.iov_len += sizeof(*cap_barrier); + + msg->hdr.version = cpu_to_le16(2); + msg->hdr.compat_version = cpu_to_le16(1); + list_del_init(&msg->list_head); spin_unlock(&session->s_cap_lock); msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h index 7b40568..b9412a8 100644 --- a/fs/ceph/mds_client.h +++ b/fs/ceph/mds_client.h @@ -92,10 +92,14 @@ struct ceph_mds_reply_info_parsed { /* * cap releases are batched and sent to the MDS en masse. + * + * Account for per-message overhead of mds_cap_release header + * and u32 for osd epoch barrier trailing field. */ #define CEPH_CAPS_PER_RELEASE ((PAGE_CACHE_SIZE - \ - sizeof(struct ceph_mds_cap_release)) / \ - sizeof(struct ceph_mds_cap_item)) + sizeof(struct ceph_mds_cap_release) - \ + sizeof(u32)) / \ + sizeof(struct ceph_mds_cap_item)) /*