From patchwork Mon Feb 25 23:12:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2183121 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 D8736DF230 for ; Mon, 25 Feb 2013 23:12:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758580Ab3BYXMG (ORCPT ); Mon, 25 Feb 2013 18:12:06 -0500 Received: from mail-ie0-f170.google.com ([209.85.223.170]:49627 "EHLO mail-ie0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757698Ab3BYXMF (ORCPT ); Mon, 25 Feb 2013 18:12:05 -0500 Received: by mail-ie0-f170.google.com with SMTP id c11so3797065ieb.1 for ; Mon, 25 Feb 2013 15:12:04 -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=9d+DX/T5R19vxUB/CFx+xNoi8kfKdK574vTx7eFYqO4=; b=jPgRLGY94JxSQxle5KHmZXMLWcVahFU24oRB+yON0mBzE0rfK1rgTvg83ajht9+A5R 2g1d0jViOVwKRFfxQWFysXj9NgpjCXXaU0J+ob566MjTdAouPLQEm8d/xjetLvwlQlJt hVGh1UbE8kZ9w0BdnK1CbJFUSTBhF/josml1rzflR8T0ASLXlxy2dckzvIzkO0fFvQHU JSOD9NeE0ng97M/S0YsJ6wWzM2xKI5NUhu5tuaGFGvSPbyCBshxAd/k+4bh2jdJkj4dr HaseP7Hbp74EbSqjzri/3rAaMzn1HnxfWHSM+suYyQr7BOfCzGnnB5L6wujltniOhFOx ylqA== X-Received: by 10.50.155.134 with SMTP id vw6mr4408222igb.34.1361833924473; Mon, 25 Feb 2013 15:12:04 -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 dy5sm6355506igc.1.2013.02.25.15.12.02 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Feb 2013 15:12:03 -0800 (PST) Message-ID: <512BEFC1.5020006@inktank.com> Date: Mon, 25 Feb 2013 17:12:01 -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/3] libceph: pass object number back to calc_layout() caller References: <512BEF26.3030207@inktank.com> In-Reply-To: <512BEF26.3030207@inktank.com> X-Gm-Message-State: ALoCoQnzQsaNN0sMVNtQWcj644q/+hoYKDAyN2zTkQpHuWvEdFG3EmE7T31PeuCOPxZTR9Z9Px10 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Have calc_layout() pass the computed object number back to its caller. (This is a small step to simplify review.) Signed-off-by: Alex Elder --- net/ceph/osd_client.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) memset(&ops, 0, sizeof ops); @@ -436,11 +436,12 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, req->r_flags = flags; /* calculate max write size */ - r = calc_layout(vino, layout, off, plen, req, ops); + r = calc_layout(vino, layout, off, plen, req, ops, &bno); if (r < 0) { ceph_osdc_put_request(req); return ERR_PTR(r); } + req->r_file_layout = *layout; /* keep a copy */ /* in case it differs from natural (file) alignment that diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 5daced2..fcc783b 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -67,16 +67,15 @@ static int calc_layout(struct ceph_vino vino, struct ceph_file_layout *layout, u64 off, u64 *plen, struct ceph_osd_request *req, - struct ceph_osd_req_op *op) + struct ceph_osd_req_op *op, u64 *bno) { u64 orig_len = *plen; - u64 bno = 0; u64 objoff = 0; u64 objlen = 0; int r; /* object extent? */ - r = ceph_calc_file_object_mapping(layout, off, orig_len, &bno, + r = ceph_calc_file_object_mapping(layout, off, orig_len, bno, &objoff, &objlen); if (r < 0) return r; @@ -104,9 +103,9 @@ static int calc_layout(struct ceph_vino vino, op->payload_len = *plen; dout("calc_layout bno=%llx %llu~%llu (%d pages)\n", - bno, objoff, objlen, req->r_num_pages); + *bno, objoff, objlen, req->r_num_pages); - snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", vino.ino, bno); + snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", vino.ino, *bno); req->r_oid_len = strlen(req->r_oid); return 0; @@ -416,6 +415,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, struct ceph_osd_req_op ops[2]; struct ceph_osd_request *req; unsigned int num_op = 1; + u64 bno = 0; int r;