From patchwork Wed Mar 13 01:09:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2260621 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 A8EB93FCF6 for ; Wed, 13 Mar 2013 01:10:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932554Ab3CMBKD (ORCPT ); Tue, 12 Mar 2013 21:10:03 -0400 Received: from mail-ob0-f180.google.com ([209.85.214.180]:44143 "EHLO mail-ob0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932394Ab3CMBKB (ORCPT ); Tue, 12 Mar 2013 21:10:01 -0400 Received: by mail-ob0-f180.google.com with SMTP id ef5so508036obb.11 for ; Tue, 12 Mar 2013 18:10:01 -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=LqWTtredfWPmZbmjmYD+fEt/cCDj+3Ge8nX2Q/woEsE=; b=fA/NbIhCgdI2HIpXfPP9JBLTs4gPFAzME+t3eYpLRlhD3wTVN6ldt/5CmSjZhjZTc9 O7jd2r15S+0fyqJcNBlVqqDfI88uOesmCcBN41ixerh4MIZyvxW+5d+kSI51EyUMxbfd NXFLvTK/BR1JJ7eEbv6GMwMSw+ZFODV+DjXCm8u/fsKBmN9YEsp8J3a/BEgksD14mf4l vvyAmM4sJr1sS/JO9XvF/9BUAn5Tx89TUaoLYpES1OFruHvkNlod0b5eB9PFaJ9ZRudT fTmSykd1Ar78XpJalHWLsM6DMQBZ7rf+6HnJIlW88hlOJjYgsLdOdkInoaZMqfGnJEl7 qhMg== X-Received: by 10.60.26.72 with SMTP id j8mr13986817oeg.2.1363137001237; Tue, 12 Mar 2013 18:10:01 -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 h9sm23701285obg.14.2013.03.12.18.09.59 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Mar 2013 18:10:00 -0700 (PDT) Message-ID: <513FD1E6.2090104@inktank.com> Date: Tue, 12 Mar 2013 20:09:58 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 4/4] libceph: use only ceph_msg_data_advance() References: <513FD178.60207@inktank.com> In-Reply-To: <513FD178.60207@inktank.com> X-Gm-Message-State: ALoCoQlfDWa7il32ZCiHFAKg7F/0lHop2bce22eW8UfNCW1YZtaCCcZhqNCLseAOGxLCe19rPJGS Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org The *_msg_pos_next() functions do little more than call ceph_msg_data_advance(). Replace those wrapper functions with a simple call to ceph_msg_data_advance(). This cleanup is related to: http://tracker.ceph.com/issues/4428 Signed-off-by: Alex Elder --- net/ceph/messenger.c | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) unsigned int length) @@ -1445,6 +1411,7 @@ static int write_partial_message_data(struct ceph_connection *con) size_t page_offset; size_t length; bool last_piece; + bool need_crc; int ret; page = ceph_msg_data_next(&msg->data, &page_offset, &length, @@ -1458,7 +1425,7 @@ static int write_partial_message_data(struct ceph_connection *con) return ret; } - out_msg_pos_next(con, page, length, (size_t) ret); + need_crc = ceph_msg_data_advance(&msg->data, (size_t) ret); } msg->footer.data_crc = cpu_to_le32(crc); @@ -2133,7 +2100,7 @@ static int read_partial_msg_data(struct ceph_connection *con) if (do_datacrc) crc = ceph_crc32c_page(crc, page, page_offset, ret); - in_msg_pos_next(con, length, ret); + (void) ceph_msg_data_advance(&msg->data, (size_t) ret); } con->in_data_crc = crc; diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 3180f82..8e07ac4 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -1365,40 +1365,6 @@ out: return ret; /* done! */ } -static void out_msg_pos_next(struct ceph_connection *con, struct page *page, - size_t len, size_t sent) -{ - struct ceph_msg *msg = con->out_msg; - bool need_crc = false; - - BUG_ON(!msg); - BUG_ON(!sent); - - need_crc = ceph_msg_data_advance(&msg->data, sent); - BUG_ON(need_crc && sent != len); - - if (sent < len) - return; - - BUG_ON(sent != len); -} - -static void in_msg_pos_next(struct ceph_connection *con, size_t len, - size_t received) -{ - struct ceph_msg *msg = con->in_msg; - - BUG_ON(!msg); - BUG_ON(!received); - - (void) ceph_msg_data_advance(&msg->data, received); - - if (received < len) - return; - - BUG_ON(received != len); -} - static u32 ceph_crc32c_page(u32 crc, struct page *page, unsigned int page_offset,