From patchwork Wed Nov 14 16:23:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1742551 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 E3D3F3FC64 for ; Wed, 14 Nov 2012 16:23:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932929Ab2KNQXU (ORCPT ); Wed, 14 Nov 2012 11:23:20 -0500 Received: from mail-ie0-f174.google.com ([209.85.223.174]:37325 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932909Ab2KNQXU (ORCPT ); Wed, 14 Nov 2012 11:23:20 -0500 Received: by mail-ie0-f174.google.com with SMTP id k13so861743iea.19 for ; Wed, 14 Nov 2012 08:23:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=HYzpVu1snHQ52wtbyipb+JqCczGKlaNfjbRFHI3Kp9E=; b=j1P0cIm1Gg+vNlOOjjZn5GkXISEPvI7zmmcGoONfFsxcHXPo2aukoRc4eTx4C93p7P zuDkOkxh+FMyvLIZgTx53Gzp6mpUKbI3JqiC3Fyyu5kzyzyhi0bkJSHZQ5dOHMWSa3r1 MVzY6hB07WEeFrv/595GBCOgHlbtAzWFB4Lvhz8Uvu+ocX5MJq3Geo7qIsCbBSpjXmGl LrtwhgzYIwfISgG7AJnrYIQ474F7UEfT0YbBMtnX6Od2xqYhwlIP/4jqJLzh6WMM3eCq V/lsVts4wGuh/3IdxgshFZMTssKBKvEgV01qG2jrfIAAg7B+wG51DymOIjUH2JKxtmUI 9d8A== Received: by 10.50.194.196 with SMTP id hy4mr2310829igc.52.1352910199931; Wed, 14 Nov 2012 08:23:19 -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 wh5sm1441595igb.17.2012.11.14.08.23.16 (version=SSLv3 cipher=OTHER); Wed, 14 Nov 2012 08:23:17 -0800 (PST) Message-ID: <50A3C574.1030807@inktank.com> Date: Wed, 14 Nov 2012 10:23:16 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 To: "ceph-devel@vger.kernel.org" Subject: [PATCH 2/2] libceph: don't set pages or bio in ceph_osdc_alloc_request() References: <50A3C524.8070303@inktank.com> In-Reply-To: <50A3C524.8070303@inktank.com> X-Gm-Message-State: ALoCoQlHjUcOgmT1+L8YvwsxTxgsDMVl7KhhH0uPVvSwt0f+XRu2eQ1Tpjq6aremvNFScqQUmp73 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Only one of the two callers of ceph_osdc_alloc_request() provides page or bio data for its payload. And essentially all that function was doing with those arguments was assigning them to fields in the osd request structure. Simplify ceph_osdc_alloc_request() by having the caller take care of making those assignments Signed-off-by: Alex Elder --- drivers/block/rbd.c | 8 ++++++-- include/linux/ceph/osd_client.h | 4 +--- net/ceph/osd_client.c | 15 ++------------- 3 files changed, 9 insertions(+), 18 deletions(-) struct ceph_msg *msg; @@ -229,13 +227,6 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, memset(msg->front.iov_base, 0, msg->front.iov_len); req->r_request = msg; - req->r_pages = pages; -#ifdef CONFIG_BLOCK - if (bio) { - req->r_bio = bio; - bio_get(req->r_bio); - } -#endif return req; } @@ -431,9 +422,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, } else ops[1].op = 0; - req = ceph_osdc_alloc_request(osdc, snapc, ops, - use_mempool, - GFP_NOFS, NULL, NULL); + req = ceph_osdc_alloc_request(osdc, snapc, ops, use_mempool, GFP_NOFS); if (!req) return ERR_PTR(-ENOMEM); req->r_flags = flags; diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index b6b1522..bdb099c 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1150,14 +1150,18 @@ static int rbd_do_request(struct request *rq, (unsigned long long) len, coll, coll_index); osdc = &rbd_dev->rbd_client->client->osdc; - osd_req = ceph_osdc_alloc_request(osdc, snapc, ops, - false, GFP_NOIO, pages, bio); + osd_req = ceph_osdc_alloc_request(osdc, snapc, ops, false, GFP_NOIO); if (!osd_req) { ret = -ENOMEM; goto done_pages; } osd_req->r_flags = flags; + osd_req->r_pages = pages; + if (bio) { + osd_req->r_bio = bio; + bio_get(osd_req->r_bio); + } osd_req->r_callback = rbd_cb; rbd_req->rq = rq; diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index 6ddda5b..75f56d3 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h @@ -216,9 +216,7 @@ extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client * struct ceph_snap_context *snapc, struct ceph_osd_req_op *ops, bool use_mempool, - gfp_t gfp_flags, - struct page **pages, - struct bio *bio); + gfp_t gfp_flags); extern void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off, u64 len, diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 3e82e61..5ed9c92 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -166,9 +166,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, struct ceph_snap_context *snapc, struct ceph_osd_req_op *ops, bool use_mempool, - gfp_t gfp_flags, - struct page **pages, - struct bio *bio) + gfp_t gfp_flags) { struct ceph_osd_request *req;