From patchwork Fri Apr 5 14:02:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2398691 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 67E443FD8C for ; Fri, 5 Apr 2013 14:02:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161793Ab3DEOCz (ORCPT ); Fri, 5 Apr 2013 10:02:55 -0400 Received: from mail-ie0-f178.google.com ([209.85.223.178]:44030 "EHLO mail-ie0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161757Ab3DEOCz (ORCPT ); Fri, 5 Apr 2013 10:02:55 -0400 Received: by mail-ie0-f178.google.com with SMTP id bn7so4426843ieb.9 for ; Fri, 05 Apr 2013 07:02:54 -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=3v56XeFfaCO5f49LbmWnfG7qyZzTIcX5NW35o9735aI=; b=NmZFGdCO/6cv7tEDcaPu5rAlcnhKD3PdK7W3Q4cJcIYJA56m5Yjd+DGPshr0DwSxVm QvkTyH6vD23j+2yY5GcHWR5NI/ewC2vD1Ekv3GoWZb7m7iLRLL/AMV5A0gXic2SUFxFC eOZsaFpdwnLmWIUiJQdhuoPjXKn3nVAMphrPkeamxoRBI6XHpHyVvxdzgbtvOLvnI5Tv BtDDQhXTlDKIC9IZoiuGexC9Cx51wPXZhQrptkfSmg2SrRMj3ca5AVvSie1J66fH8uKA jZAnEKZ6O0ua209/L4OUBb4wi7cL5jM677wL/qR4NRm8piv33TmzpUxiKdmYv7vz9Unw A6Fw== X-Received: by 10.43.125.199 with SMTP id gt7mr5444330icc.48.1365170574878; Fri, 05 Apr 2013 07:02:54 -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 in10sm6224269igc.1.2013.04.05.07.02.52 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Apr 2013 07:02:53 -0700 (PDT) Message-ID: <515ED98C.5010709@inktank.com> Date: Fri, 05 Apr 2013 09:02:52 -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 06/20] libceph: a few more osd data cleanups References: <515ED849.9060901@inktank.com> In-Reply-To: <515ED849.9060901@inktank.com> X-Gm-Message-State: ALoCoQnN8wK29nS2fFglqS1VW9tjxAWf9GJXvzA2w2JiM0x4+VDJlm35Jeq7osJ8m7HaRttCE3Yr Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org These are very small changes that make use osd_data local pointers as shorthands for structures being operated on. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- fs/ceph/addr.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) int num_pages; @@ -244,11 +245,12 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg) dout("finish_read %p req %p rc %d bytes %d\n", inode, req, rc, bytes); /* unlock all pages, zeroing any data we didn't read */ - BUG_ON(req->r_data_in.type != CEPH_OSD_DATA_TYPE_PAGES); - num_pages = calc_pages_for((u64)req->r_data_in.alignment, - (u64)req->r_data_in.length); + osd_data = &req->r_data_in; + BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES); + num_pages = calc_pages_for((u64)osd_data->alignment, + (u64)osd_data->length); for (i = 0; i < num_pages; i++) { - struct page *page = req->r_data_in.pages[i]; + struct page *page = osd_data->pages[i]; if (bytes < (int)PAGE_CACHE_SIZE) { /* zero (remainder of) page */ @@ -263,7 +265,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg) page_cache_release(page); bytes -= PAGE_CACHE_SIZE; } - kfree(req->r_data_in.pages); + kfree(osd_data->pages); } static void ceph_unlock_page_vector(struct page **pages, int num_pages) @@ -557,6 +559,7 @@ static void writepages_finish(struct ceph_osd_request *req, { struct inode *inode = req->r_inode; struct ceph_inode_info *ci = ceph_inode(inode); + struct ceph_osd_data *osd_data; unsigned wrote; struct page *page; int num_pages; @@ -569,9 +572,10 @@ static void writepages_finish(struct ceph_osd_request *req, long writeback_stat; unsigned issued = ceph_caps_issued(ci); - BUG_ON(req->r_data_out.type != CEPH_OSD_DATA_TYPE_PAGES); - num_pages = calc_pages_for((u64)req->r_data_out.alignment, - (u64)req->r_data_out.length); + osd_data = &req->r_data_out; + BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES); + num_pages = calc_pages_for((u64)osd_data->alignment, + (u64)osd_data->length); if (rc >= 0) { /* * Assume we wrote the pages we originally sent. The @@ -589,7 +593,7 @@ static void writepages_finish(struct ceph_osd_request *req, /* clean all pages */ for (i = 0; i < num_pages; i++) { - page = req->r_data_out.pages[i]; + page = osd_data->pages[i]; BUG_ON(!page); WARN_ON(!PageUptodate(page)); @@ -620,12 +624,12 @@ static void writepages_finish(struct ceph_osd_request *req, dout("%p wrote+cleaned %d pages\n", inode, wrote); ceph_put_wrbuffer_cap_refs(ci, num_pages, snapc); - ceph_release_pages(req->r_data_out.pages, num_pages); - if (req->r_data_out.pages_from_pool) - mempool_free(req->r_data_out.pages, + ceph_release_pages(osd_data->pages, num_pages); + if (osd_data->pages_from_pool) + mempool_free(osd_data->pages, ceph_sb_to_client(inode->i_sb)->wb_pagevec_pool); else - kfree(req->r_data_out.pages); + kfree(osd_data->pages); ceph_osdc_put_request(req); } diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 8507389..c46b9d3 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -236,6 +236,7 @@ static int ceph_readpage(struct file *filp, struct page *page) static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg) { struct inode *inode = req->r_inode; + struct ceph_osd_data *osd_data; int rc = req->r_result; int bytes = le32_to_cpu(msg->hdr.data_len);