From patchwork Wed Nov 14 16:10:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1742401 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B19BC3FC64 for ; Wed, 14 Nov 2012 16:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422742Ab2KNQKE (ORCPT ); Wed, 14 Nov 2012 11:10:04 -0500 Received: from mail-ia0-f174.google.com ([209.85.210.174]:51136 "EHLO mail-ia0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422730Ab2KNQKD (ORCPT ); Wed, 14 Nov 2012 11:10:03 -0500 Received: by mail-ia0-f174.google.com with SMTP id y25so375206iay.19 for ; Wed, 14 Nov 2012 08:10:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=PUdEbv+BxZoXo59qMZf0ZtgYRPEy3ceED72N2kMae5o=; b=PsG4Jj50VYNPbZCEqJESVqDodJpaNlh0vlbP1or+yJOGtdK4lWUGXGhD0T59Ov9tLP ajFK7ei5zcT2iusIZ+taVumtgZkky/MNlD77YEtWgVVz38/7yey1V14qdmF/d11HUNb+ thf84XNc/jXIWBYh2PyaQxHyeb34FUwjfRBFXvRGlvd9NZVYatPcBTBPZr18nHYShsAg Y+LaDfi2VeSwDU70noXi605piJ3lSjNUoy5X+kv/3It7YTLfQVqOPS8/DNV/Vi6D4bOl gEoXtaUbOzUKC+0ACUNV420hO2d+7nCWobHue/jS7WIydd0X9TUbEzaPul64QLahAp4z bS8A== Received: by 10.50.217.195 with SMTP id pa3mr2323043igc.19.1352909403433; Wed, 14 Nov 2012 08:10:03 -0800 (PST) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id az6sm1429319igb.11.2012.11.14.08.10.01 (version=SSLv3 cipher=OTHER); Wed, 14 Nov 2012 08:10:02 -0800 (PST) Message-ID: <50A3C259.6010405@inktank.com> Date: Wed, 14 Nov 2012 10:10:01 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 To: "ceph-devel@vger.kernel.org" Subject: [PATCH 2/2] libceph: kill op_needs_trail() References: <50A3C1F7.6070107@inktank.com> In-Reply-To: <50A3C1F7.6070107@inktank.com> X-Gm-Message-State: ALoCoQk+5GOiWIJOEwQQLYB2ZllswkiDAEh96h8SaHNgCqLxAahBLZg+JwFp7EOfP5soUgqyJTnE Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Since every osd message is now prepared to include trailing data, there's no need to check ahead of time whether any operations will make use of the trail portion of the message. We can drop the second argument ot get_num_ops(), and as a result we can also get rid of op_needs_trail() which is no longer used. Signed-off-by: Alex Elder --- net/ceph/osd_client.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) return (op == CEPH_OSD_OP_READ || @@ -171,17 +157,12 @@ void ceph_osdc_release_request(struct kref *kref) } EXPORT_SYMBOL(ceph_osdc_release_request); -static int get_num_ops(struct ceph_osd_req_op *ops, int *needs_trail) +static int get_num_ops(struct ceph_osd_req_op *ops) { int i = 0; - if (needs_trail) - *needs_trail = 0; - while (ops[i].op) { - if (needs_trail && op_needs_trail(ops[i].op)) - *needs_trail = 1; + while (ops[i].op) i++; - } return i; } @@ -197,7 +178,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, { struct ceph_osd_request *req; struct ceph_msg *msg; - int num_op = get_num_ops(ops, NULL); + int num_op = get_num_ops(ops); size_t msg_size = sizeof(struct ceph_osd_request_head); msg_size += num_op*sizeof(struct ceph_osd_op); @@ -357,7 +338,7 @@ void ceph_osdc_build_request(struct ceph_osd_request *req, struct ceph_osd_req_op *src_op; struct ceph_osd_op *op; void *p; - int num_op = get_num_ops(src_ops, NULL); + int num_op = get_num_ops(src_ops); size_t msg_size = sizeof(*head) + num_op*sizeof(*op); int flags = req->r_flags; u64 data_len = 0; diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 15984d2..20b7921 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -32,20 +32,6 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc, static void __send_request(struct ceph_osd_client *osdc, struct ceph_osd_request *req); -static int op_needs_trail(int op) -{ - switch (op) { - case CEPH_OSD_OP_GETXATTR: - case CEPH_OSD_OP_SETXATTR: - case CEPH_OSD_OP_CMPXATTR: - case CEPH_OSD_OP_CALL: - case CEPH_OSD_OP_NOTIFY: - return 1; - default: - return 0; - } -} - static int op_has_extent(int op) {