From patchwork Mon Feb 25 23:12:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2183141 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id B57D7DF230 for ; Mon, 25 Feb 2013 23:12:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758911Ab3BYXMi (ORCPT ); Mon, 25 Feb 2013 18:12:38 -0500 Received: from mail-ie0-f170.google.com ([209.85.223.170]:33709 "EHLO mail-ie0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758265Ab3BYXMh (ORCPT ); Mon, 25 Feb 2013 18:12:37 -0500 Received: by mail-ie0-f170.google.com with SMTP id c11so3873544ieb.29 for ; Mon, 25 Feb 2013 15:12:37 -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=rdgxjKtR04MNVkqfhdNxrBpb4sqvnI0Vw11T6lFsvEg=; b=pGT3MzcGbfI3OtgLd8L7o2AO6lxh/rR+ijlw6Ovmnhu4G74C3qA8iHEc8xY3KQVVmk qNHfXIvt7dppUauKXMbX98po40OMboC7ICj4R1k1qcTMLH1rNvZHXCaLx6VWJCiN0+qP +1sDtgmpcOUaZyCia1+Oq+PXifqbJ9TkQfaqvDcmcxLMAIYdk7XTPYGiNI6PXRxSl9sg NifV5e6PsRUXWeewp/8ZLSeztkrGcKGEL9ZHK3tNXdIhm7839cw+OEBMVojosYzjgGas 32OtqZXSR2uA4u6vCbNAwJcjn12kPC/mTU6OREKUVG+kvwlNRY1b8hpf1hleaFmz1Yld LHxg== X-Received: by 10.43.45.195 with SMTP id ul3mr2733481icb.14.1361833957291; Mon, 25 Feb 2013 15:12:37 -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 z1sm6199677igc.1.2013.02.25.15.12.35 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Feb 2013 15:12:36 -0800 (PST) Message-ID: <512BEFE2.1080409@inktank.com> Date: Mon, 25 Feb 2013 17:12:34 -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 3/3] libceph: don't pass request to calc_layout() References: <512BEF26.3030207@inktank.com> In-Reply-To: <512BEF26.3030207@inktank.com> X-Gm-Message-State: ALoCoQkwzBjvCc14uiFgKcPIUIfCwmDEw3g6a+1QfmeE5ZW+Giz0VY4TFiHX3HJriUqo4WSLvUTg Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org The only remaining reason to pass the osd request to calc_layout() is to fill in its r_num_pages and r_page_alignment fields. Once it fills those in, it doesn't do anything more with them. We can therefore move those assignments into the caller, and get rid of the "req" parameter entirely. Note, however, that the only caller is ceph_osdc_new_request(), and that immediately overwrites those fields with values based on its passed-in page offset. So the assignment inside calc_layout() was redundant anyway. This resolves: http://tracker.ceph.com/issues/4262 Signed-off-by: Alex Elder --- net/ceph/osd_client.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) } @@ -431,7 +427,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, req->r_flags = flags; /* calculate max write size */ - r = calc_layout(layout, off, plen, req, ops, &bno); + r = calc_layout(layout, off, plen, ops, &bno); if (r < 0) { ceph_osdc_put_request(req); return ERR_PTR(r); @@ -442,8 +438,8 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", vino.ino, bno); req->r_oid_len = strlen(req->r_oid); - /* in case it differs from natural (file) alignment that - calc_layout filled in for us */ + /* The alignment may differ from the natural (file) alignment */ + req->r_num_pages = calc_pages_for(page_align, *plen); req->r_page_alignment = page_align; diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 4f90c24..980911e 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -64,7 +64,6 @@ static int op_has_extent(int op) * fill osd op in request message. */ static int calc_layout(struct ceph_file_layout *layout, u64 off, u64 *plen, - struct ceph_osd_request *req, struct ceph_osd_req_op *op, u64 *bno) { u64 orig_len = *plen; @@ -95,13 +94,10 @@ static int calc_layout(struct ceph_file_layout *layout, u64 off, u64 *plen, op->extent.truncate_size = osize; } } - req->r_num_pages = calc_pages_for(off, *plen); - req->r_page_alignment = off & ~PAGE_MASK; if (op->op == CEPH_OSD_OP_WRITE) op->payload_len = *plen; - dout("calc_layout bno=%llx %llu~%llu (%d pages)\n", - *bno, objoff, objlen, req->r_num_pages); + dout("calc_layout bno=%llx %llu~%llu\n", *bno, objoff, objlen); return 0;