From patchwork Fri Apr 5 14:01:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2398651 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 330843FD8C for ; Fri, 5 Apr 2013 14:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161713Ab3DEOB3 (ORCPT ); Fri, 5 Apr 2013 10:01:29 -0400 Received: from mail-ie0-f181.google.com ([209.85.223.181]:60336 "EHLO mail-ie0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161756Ab3DEOB3 (ORCPT ); Fri, 5 Apr 2013 10:01:29 -0400 Received: by mail-ie0-f181.google.com with SMTP id 17so4252496iea.40 for ; Fri, 05 Apr 2013 07:01:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=0JTt9LA/+ttXsJ4NyhBu+RwApSD/+dhs2ke6aX7pW2E=; b=oyDQzevOEUmNuYhVLhv/lG2e/hR83OlBNbg5IIxmEqCENhI3tGBEH+gK+DU8ZyIM6n 9AwYS83yhs9f8Vz5eKdtssMfyRgVTz3fV1xm2F7BittBHMyoFJye1iwRXJBq1BA/2/4b g7NHhoIoWs+TM/OjNaQVYog7f+2+lyWueNlcJIjRGEXWn4nAJNGbhaWmuzPAp7wCy8Rv VmOqPkv3ZSHgALzzMqARuvz3fjM8O7Sj2zhunboisnlfh3ZrcOcrDWuPV6cTLSwofLmI ngWKCXoGA5mju1YioaYuYc0Lv+E4YZ999qlU0taI7VG1MALETDzl9zFUWbRpsBiEEYjd ifMQ== X-Received: by 10.50.25.102 with SMTP id b6mr1650411igg.27.1365170488476; Fri, 05 Apr 2013 07:01:28 -0700 (PDT) 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 in10sm6216441igc.1.2013.04.05.07.01.27 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Apr 2013 07:01:27 -0700 (PDT) Message-ID: <515ED937.5080509@inktank.com> Date: Fri, 05 Apr 2013 09:01:27 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: "ceph-devel@vger.kernel.org" Subject: [PATCH 02/20] libceph: compute incoming bytes once References: <515ED849.9060901@inktank.com> In-Reply-To: <515ED849.9060901@inktank.com> X-Gm-Message-State: ALoCoQmgDjwhzZPyFEwwhSGKS1KdfEEIWQpY7txLVjS09tlNDeBDCdprNttN2Z8mpeGAdTbVRSeG Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org This is a simple change, extracting the number of incoming data bytes just once in handle_reply(). Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- net/ceph/osd_client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) tid = le64_to_cpu(msg->hdr.tid); @@ -1347,9 +1348,10 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg, payload_len += len; p += sizeof(*op); } - if (payload_len != le32_to_cpu(msg->hdr.data_len)) { + bytes = le32_to_cpu(msg->hdr.data_len); + if (payload_len != bytes) { pr_warning("sum of op payload lens %d != data_len %d", - payload_len, le32_to_cpu(msg->hdr.data_len)); + payload_len, bytes); goto bad_put; } @@ -1359,10 +1361,8 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg, req->r_reply_op_result[i] = ceph_decode_32(&p); if (!req->r_got_reply) { - unsigned int bytes; req->r_result = result; - bytes = le32_to_cpu(msg->hdr.data_len); dout("handle_reply result %d bytes %d\n", req->r_result, bytes); if (req->r_result == 0) diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 426ca1f..1379b33 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -1293,6 +1293,7 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg, u64 reassert_version; u32 osdmap_epoch; int already_completed; + u32 bytes; int i;