From patchwork Thu Jan 7 14:05:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 7977621 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 96062BEEE5 for ; Thu, 7 Jan 2016 14:06:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B066D2017E for ; Thu, 7 Jan 2016 14:06:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BDDB520172 for ; Thu, 7 Jan 2016 14:05:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752569AbcAGOF6 (ORCPT ); Thu, 7 Jan 2016 09:05:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46093 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752300AbcAGOF5 (ORCPT ); Thu, 7 Jan 2016 09:05:57 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 1FEDE373F48; Thu, 7 Jan 2016 14:05:57 +0000 (UTC) Received: from localhost.localdomain (vpn1-4-93.pek2.redhat.com [10.72.4.93]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u07E5cWk003807; Thu, 7 Jan 2016 09:05:53 -0500 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: idryomov@gmail.com, "Yan, Zheng" Subject: [PATCH 3/6] libceph: allow reserving operations in OSD request Date: Thu, 7 Jan 2016 22:05:25 +0800 Message-Id: <1452175528-20751-4-git-send-email-zyan@redhat.com> In-Reply-To: <1452175528-20751-1-git-send-email-zyan@redhat.com> References: <1452175528-20751-1-git-send-email-zyan@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 This allows us to reserve some operations for furture use. we do not need to use all reserved operations. Signed-off-by: Yan, Zheng --- include/linux/ceph/osd_client.h | 1 + net/ceph/osd_client.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index fda3a05..9802df1 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h @@ -139,6 +139,7 @@ struct ceph_osd_request { u32 r_sent; /* >0 if r_request is sending/sent */ /* request osd ops array */ + unsigned int r_max_ops; unsigned int r_num_ops; struct ceph_osd_req_op *r_ops; struct ceph_osd_req_op r_inline_ops[CEPH_OSD_INITIAL_OP]; diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index c76cbe1..4a9d4e5 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -385,7 +385,8 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, req->r_osdc = osdc; req->r_mempool = use_mempool; - req->r_num_ops = num_ops; + req->r_num_ops = 0; + req->r_max_ops = num_ops; if (num_ops <= CEPH_OSD_INITIAL_OP) { req->r_ops = req->r_inline_ops; @@ -479,8 +480,10 @@ _osd_req_op_init(struct ceph_osd_request *osd_req, unsigned int which, { struct ceph_osd_req_op *op; - BUG_ON(which >= osd_req->r_num_ops); + BUG_ON(which >= osd_req->r_max_ops); BUG_ON(!osd_req_opcode_valid(opcode)); + if (which >= osd_req->r_num_ops) + osd_req->r_num_ops = which + 1; op = &osd_req->r_ops[which]; memset(op, 0, sizeof (*op));