From patchwork Mon Feb 25 23:42:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2183231 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 2EBEC3FD4E for ; Mon, 25 Feb 2013 23:42:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759847Ab3BYXmJ (ORCPT ); Mon, 25 Feb 2013 18:42:09 -0500 Received: from mail-ie0-f174.google.com ([209.85.223.174]:52970 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759817Ab3BYXmH (ORCPT ); Mon, 25 Feb 2013 18:42:07 -0500 Received: by mail-ie0-f174.google.com with SMTP id k10so3745422iea.5 for ; Mon, 25 Feb 2013 15:42:06 -0800 (PST) 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=aPPK7tvZuYnFKCWu5Xh9roUINrwWlfURO8UucyC9xB4=; b=dvGxsvTd+61CasvDkQ2ZfyHZnVQGo9pZbKqG39zp2rlcPpLUw+5EF5M3Lp4lVofXgn N5pY2OM4gJDY7RotXQy1wE5lX92GWNHBaU88sTLwEAFetiOnkaxSrmUBsrYxez7eZlj+ h+H8EexRZgZ+WeqcIVEPUT5m5DF60p+nnZAOfuZsyxtXQNFkW8Goyh9KzAtahCpu9yXq 16tiyNm/R6Pmn2SkJSOwj+Zt6xioRY5+5slFyKsYkSjKx6iB0rXflBpXnMtkRk1zPLGi yVS5coMJKoKPnmKLOHEjTl8SSWqUIZQJaBKu2bnh+12BIuDms5ijIY4L+3Hzbsklvtmz OJjA== X-Received: by 10.50.185.137 with SMTP id fc9mr4370057igc.109.1361835726084; Mon, 25 Feb 2013 15:42:06 -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 ur12sm6366693igb.8.2013.02.25.15.42.04 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Feb 2013 15:42:04 -0800 (PST) Message-ID: <512BF6CB.7040600@inktank.com> Date: Mon, 25 Feb 2013 17:42:03 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: "ceph-devel@vger.kernel.org" Subject: [PATCH 1/4] libceph: distinguish page array and pagelist count References: <512BF683.5050905@inktank.com> In-Reply-To: <512BF683.5050905@inktank.com> X-Gm-Message-State: ALoCoQmCeZ7E3zGUr2/iANNyXK2kUk/W3JqdO0lOwIhEkiAHg3wYv2NWBNtApxF62e0sGiFTZ+QY Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Use distinct fields for tracking the number of pages in a message's page array and in a message's page list. Currently only one or the other is used at a time, but that will be changing soon. Signed-off-by: Alex Elder --- fs/ceph/mds_client.c | 4 ++-- include/linux/ceph/messenger.h | 3 ++- net/ceph/messenger.c | 14 ++++++++------ net/ceph/osd_client.c | 4 ++-- 4 files changed, 14 insertions(+), 11 deletions(-) #endif @@ -1982,7 +1982,7 @@ static struct ceph_msg *get_reply(struct ceph_connection *con, goto out; } m->pages = req->r_pages; - m->nr_pages = req->r_num_pages; + m->page_count = req->r_num_pages; m->page_alignment = req->r_page_alignment; #ifdef CONFIG_BLOCK m->bio = req->r_bio; diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index d958420..44435c2 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -1719,7 +1719,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); msg->pages = req->r_pages; - msg->nr_pages = req->r_num_pages; + msg->page_count = req->r_num_pages; msg->hdr.data_len = cpu_to_le32(req->r_data_len); msg->hdr.data_off = cpu_to_le16(0); @@ -2600,10 +2600,10 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, } reply->pagelist = pagelist; + reply->pagelist_count = calc_pages_for(0, pagelist->length); if (recon_state.flock) reply->hdr.version = cpu_to_le16(2); reply->hdr.data_len = cpu_to_le32(pagelist->length); - reply->nr_pages = calc_pages_for(0, pagelist->length); ceph_con_send(&session->s_con, reply); mutex_unlock(&session->s_mutex); diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index 8297288..1b08349 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h @@ -75,9 +75,10 @@ struct ceph_msg { struct kvec front; /* unaligned blobs of message */ struct ceph_buffer *middle; struct page **pages; /* data payload. NOT OWNER. */ - unsigned nr_pages; /* size of page array */ + unsigned page_count; /* size of page array */ unsigned page_alignment; /* io offset in first page */ struct ceph_pagelist *pagelist; /* instead of pages */ + unsigned int pagelist_count; /* number of pages in pagelist */ struct ceph_connection *con; struct list_head list_head; diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index c06f940..9d8abb0 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -813,7 +813,7 @@ static void prepare_write_message(struct ceph_connection *con) m, con->out_seq, le16_to_cpu(m->hdr.type), le32_to_cpu(m->hdr.front_len), le32_to_cpu(m->hdr.middle_len), le32_to_cpu(m->hdr.data_len), - m->nr_pages); + m->page_count); BUG_ON(le32_to_cpu(m->hdr.front_len) != m->front.iov_len); /* tag + hdr + front + middle */ @@ -1072,7 +1072,7 @@ static int write_partial_msg_pages(struct ceph_connection *con) const size_t trail_off = data_len - trail_len; dout("write_partial_msg_pages %p msg %p page %d/%d offset %d\n", - con, msg, con->out_msg_pos.page, msg->nr_pages, + con, msg, con->out_msg_pos.page, msg->page_count, con->out_msg_pos.page_pos); /* @@ -2715,9 +2715,10 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, m->middle = NULL; /* data */ - m->nr_pages = 0; + m->page_count = 0; m->page_alignment = 0; m->pages = NULL; + m->pagelist_count = 0; m->pagelist = NULL; #ifdef CONFIG_BLOCK m->bio = NULL; @@ -2890,13 +2891,14 @@ void ceph_msg_last_put(struct kref *kref) ceph_buffer_put(m->middle); m->middle = NULL; } - m->nr_pages = 0; + m->page_count = 0; m->pages = NULL; if (m->pagelist) { ceph_pagelist_release(m->pagelist); kfree(m->pagelist); m->pagelist = NULL; + m->pagelist_count = 0; } m->trail = NULL; @@ -2910,8 +2912,8 @@ EXPORT_SYMBOL(ceph_msg_last_put); void ceph_msg_dump(struct ceph_msg *msg) { - pr_debug("msg_dump %p (front_max %d nr_pages %d)\n", msg, - msg->front_max, msg->nr_pages); + pr_debug("msg_dump %p (front_max %d page_count %d)\n", msg, + msg->front_max, msg->page_count); print_hex_dump(KERN_DEBUG, "header: ", DUMP_PREFIX_OFFSET, 16, 1, &msg->hdr, sizeof(msg->hdr), true); diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 980911e..0a4d4a0 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -1631,7 +1631,7 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc, int rc = 0; req->r_request->pages = req->r_pages; - req->r_request->nr_pages = req->r_num_pages; + req->r_request->page_count = req->r_num_pages; #ifdef CONFIG_BLOCK req->r_request->bio = req->r_bio;