From patchwork Wed Mar 13 01:05:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2260561 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 7287B3FCF6 for ; Wed, 13 Mar 2013 01:05:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932564Ab3CMBFv (ORCPT ); Tue, 12 Mar 2013 21:05:51 -0400 Received: from mail-oa0-f41.google.com ([209.85.219.41]:65394 "EHLO mail-oa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932103Ab3CMBFv (ORCPT ); Tue, 12 Mar 2013 21:05:51 -0400 Received: by mail-oa0-f41.google.com with SMTP id i10so538797oag.14 for ; Tue, 12 Mar 2013 18:05:50 -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=wVNmDk2nnt+r5GyPW25zRD+raXaK8urk8A4eYr7OeOs=; b=HeKrGBhWDiflKP7yGJ3n2Lsur2giDKkESK7mg7JwXd6l61fieo9TyjuqqaDl0ER4d8 gvn5YVKsW1oxZa7RT3pOu3m6wp+jQmbvQl+GrXbldVAPZnbyd1Zn1gwTM3jogA78geca Fc/eBYRCK6HPv/TeW5cnj+6HxbgYkHbJGcGqm3/3SerA26ndvadwISETEtutEB/TdhWR R82pKZdh5IIMr9n5FMr7NqNtyu3uzrXQl/Y26vY9WLgTq7NaJy/7PRp5GOgg6fPesiw/ A0CZ1mmJ3IGE30jKsLNpCrV41objUGasrzX0P23G2WK7HyE3CL/Tc1kuv+weY6MTDwQ5 8bfA== X-Received: by 10.182.202.73 with SMTP id kg9mr13903077obc.95.1363136750852; Tue, 12 Mar 2013 18:05:50 -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 i19sm23733761obf.0.2013.03.12.18.05.48 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Mar 2013 18:05:49 -0700 (PDT) Message-ID: <513FD0EB.60800@inktank.com> Date: Tue, 12 Mar 2013 20:05:47 -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 3/4] libceph: use cursor for inbound data pages References: <513FD092.2030106@inktank.com> In-Reply-To: <513FD092.2030106@inktank.com> X-Gm-Message-State: ALoCoQkvRVbTqP1/+hY5aOcsUSlcBxZKLD/aQ4KiI33hAUDBcANuc/nPTtKav2dqGhg0aFHAigS0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org The cursor code for a page array selects the right page, page offset, and length to use for a ceph_tcp_recvpage() call, so we can use it to replace a block in read_partial_message_pages(). This partially resolves: http://tracker.ceph.com/issues/4428 Signed-off-by: Alex Elder --- net/ceph/messenger.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) if (received < len) @@ -2162,23 +2164,12 @@ static int read_partial_message_pages(struct ceph_connection *con, unsigned int data_len, bool do_datacrc) { struct ceph_msg *msg = con->in_msg; - struct ceph_msg_pos *msg_pos = &con->in_msg_pos; - struct page **pages; struct page *page; size_t page_offset; size_t length; - unsigned int left; int ret; - /* (page) data */ - pages = msg->p.pages; - BUG_ON(pages == NULL); - page = pages[msg_pos->page]; - page_offset = msg_pos->page_pos; - BUG_ON(msg_pos->data_pos >= data_len); - left = data_len - msg_pos->data_pos; - BUG_ON(page_offset >= PAGE_SIZE); - length = min_t(unsigned int, PAGE_SIZE - page_offset, left); + page = ceph_msg_data_next(&msg->p, &page_offset, &length, NULL); ret = ceph_tcp_recvpage(con->sock, page, page_offset, length); if (ret <= 0) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 835447c..5507a12 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -1423,8 +1423,10 @@ static void in_msg_pos_next(struct ceph_connection *con, size_t len, msg_pos->data_pos += received; msg_pos->page_pos += received; + if (ceph_msg_has_pages(msg)) + (void) ceph_msg_data_advance(&msg->p, received); #ifdef CONFIG_BLOCK - if (ceph_msg_has_bio(msg)) + else if (ceph_msg_has_bio(msg)) (void) ceph_msg_data_advance(&msg->b, received); #endif /* CONFIG_BLOCK */