From patchwork Thu May 19 14:06:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 9127691 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 46B2460221 for ; Thu, 19 May 2016 14:07:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A9902808F for ; Thu, 19 May 2016 14:07:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FA36281C6; Thu, 19 May 2016 14:07:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9F592808F for ; Thu, 19 May 2016 14:07:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755094AbcESOH2 (ORCPT ); Thu, 19 May 2016 10:07:28 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36459 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754988AbcESOHL (ORCPT ); Thu, 19 May 2016 10:07:11 -0400 Received: by mail-wm0-f66.google.com with SMTP id w143so21258926wmw.3 for ; Thu, 19 May 2016 07:07:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=XgiPrDLkMf2GR45dEB2UHk0ot17ButDXPTh70IXMUao=; b=MjkTrfeZ/NeMsvahC5PqoNW2aOwEU/Usi0uZfKe+UD1Wb/1f4/M8XcGLzOwgfS+UDy vau+hk1B6OnWBkbvQq2DreD/H2c6uAEaxjacrd1kEKT9QL3rFtFaAwFtqdg2Gn+I0Mmw FVh/xvAtTUfOsgvwhFwpQGJ7Qau2naeDiBDtuJuKuc5LQOXRvoYFI2hsdva6QYoPyfEV nBsHHiICYRw7PqZc2wGRdMgh0SWmqL+2Io7M8f5OMDZX+SgOXj10eKFqD40ZH/w9OgZr vPzwx9ilDXPUEpZt3Q5hBCNj76PACsRHO/yAGZ4hmv90BkfKGv+UF8iZW/qGIPO+Po94 Ft6A== 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=XgiPrDLkMf2GR45dEB2UHk0ot17ButDXPTh70IXMUao=; b=QswN34MzgZVqkR/gzP1YYDoJ7HOZV+Js7U86JaXXzlBWd8y7I5+9S/CCFvtGtoj5pH 3XjkT+F+eYLcMUHD6X4cw5E/G66iIFIp/dpOMdaN8ZkvoNGgCjJH7BQTcHheLL3ZPhBP B85et7TX8F9hA98D/6J2v5wo9SiEC2Gxp1S6x4dwpxS5XMxMSzAlEa2VKBdS+qkFfLIQ ec2htHC0PpnF7jCpIm5p4GNB+nJvl4s28/Ko9QZt2+bZjbv8PTyp8J5VXCQ4bdRD+2F1 Tw00xh2ESnxpox1y//rTQnOZ5aO2ww1eMlGq1k0hDTjo02R2e8cLojlz3duQb35SDX4N 5dkQ== X-Gm-Message-State: AOPr4FVe0jOOAPXXPYl7HSdS+T8gD8/U29C5jH8UBdnuCkpYtMklTwVpFVzK6OTJ+zoG5w== X-Received: by 10.194.184.44 with SMTP id er12mr14541383wjc.83.1463666829715; Thu, 19 May 2016 07:07:09 -0700 (PDT) Received: from localhost.localdomain (ip-94-112-165-81.net.upcbroadband.cz. [94.112.165.81]) by smtp.gmail.com with ESMTPSA id b124sm3586833wmb.1.2016.05.19.07.07.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 07:07:09 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 4/6] libceph: change how osd_op_reply message size is calculated Date: Thu, 19 May 2016 16:06:40 +0200 Message-Id: <1463666802-25140-5-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1463666802-25140-1-git-send-email-idryomov@gmail.com> References: <1463666802-25140-1-git-send-email-idryomov@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For a message pool message, preallocate a page, just like we do for osd_op. For a normal message, take ceph_object_id into account and don't bother subtracting CEPH_OSD_SLAB_OPS ceph_osd_ops. Signed-off-by: Ilya Dryomov --- net/ceph/osd_client.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index d66dacc9d0d4..75e27bd3d372 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -19,7 +19,6 @@ #include #include -#define OSD_OP_FRONT_LEN 4096 #define OSD_OPREPLY_FRONT_LEN 512 static struct kmem_cache *ceph_osd_request_cache; @@ -440,11 +439,8 @@ int ceph_osdc_alloc_messages(struct ceph_osd_request *req, gfp_t gfp) /* create reply message */ msg_size = OSD_OPREPLY_FRONT_LEN; - if (req->r_num_ops > CEPH_OSD_SLAB_OPS) { - /* ceph_osd_op and rval */ - msg_size += (req->r_num_ops - CEPH_OSD_SLAB_OPS) * - (sizeof(struct ceph_osd_op) + 4); - } + msg_size += req->r_base_oid.name_len; + msg_size += req->r_num_ops * sizeof(struct ceph_osd_op); if (req->r_mempool) msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0); @@ -2702,13 +2698,11 @@ int ceph_osdc_init(struct ceph_osd_client *osdc, struct ceph_client *client) goto out; err = ceph_msgpool_init(&osdc->msgpool_op, CEPH_MSG_OSD_OP, - OSD_OP_FRONT_LEN, 10, true, - "osd_op"); + PAGE_SIZE, 10, true, "osd_op"); if (err < 0) goto out_mempool; err = ceph_msgpool_init(&osdc->msgpool_op_reply, CEPH_MSG_OSD_OPREPLY, - OSD_OPREPLY_FRONT_LEN, 10, true, - "osd_op_reply"); + PAGE_SIZE, 10, true, "osd_op_reply"); if (err < 0) goto out_msgpool;