From patchwork Mon Feb 25 23:12:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2183131 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 4B6FDDF230 for ; Mon, 25 Feb 2013 23:12:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758692Ab3BYXMU (ORCPT ); Mon, 25 Feb 2013 18:12:20 -0500 Received: from mail-ia0-f171.google.com ([209.85.210.171]:64504 "EHLO mail-ia0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758265Ab3BYXMT (ORCPT ); Mon, 25 Feb 2013 18:12:19 -0500 Received: by mail-ia0-f171.google.com with SMTP id z13so2950875iaz.2 for ; Mon, 25 Feb 2013 15:12:18 -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=1tVFu686aEqLrBPq43bp5/nXWZosaQg+XEtU19t/pO0=; b=J5nbB8sjGaJ8d4Tfj97UOVaUOybi3cr/cb2pU+FA8MmmU5HHZ56C+RSFumHJPgIkwf a//lnxRWR1JKDBSv6oMyH3wbLPslkJQudcweeMXWyxXDlCjPMVcDeTrfCSbKxIybOloZ WqtxqABM7hFEi3CzraqftrtO9QH5eBTH7dhyWGhqXzLPihGxTn5SBpi+bzKCbby02MFY KbXrR+hAyz+Xo6q50T/fkKQONuYxVRd5Ai+btYRFhDYF79YVkn7LNIxVBgoYvFRJE67J cSTs2aw4HWRTUSZp9USwu2ZHg1ytRxXp2U+rFYTd3bIdG1Fa7w4uPoS7MvCbYX/vLJzx DUbA== X-Received: by 10.50.160.169 with SMTP id xl9mr2670801igb.83.1361833938478; Mon, 25 Feb 2013 15:12:18 -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 qn10sm4660407igc.6.2013.02.25.15.12.16 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Feb 2013 15:12:17 -0800 (PST) Message-ID: <512BEFCF.80408@inktank.com> Date: Mon, 25 Feb 2013 17:12:15 -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 2/3] libceph: format target object name in caller References: <512BEF26.3030207@inktank.com> In-Reply-To: <512BEF26.3030207@inktank.com> X-Gm-Message-State: ALoCoQl5ZaolSkggKyWUh+q2RS3CUZCP+uD2wya8Almmn5RAUTK4iQZ6yvsk+IP5lSKn4Pu+Xstw Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Move the formatting of the object name (oid) to use for an object request into the caller of calc_layout(). This makes the "vino" parameter no longer necessary, so get rid of it. Signed-off-by: Alex Elder --- net/ceph/osd_client.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) return ERR_PTR(r); @@ -444,6 +439,9 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, req->r_file_layout = *layout; /* keep a copy */ + 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 */ req->r_num_pages = calc_pages_for(page_align, *plen); diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index fcc783b..4f90c24 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -63,9 +63,7 @@ static int op_has_extent(int op) * * fill osd op in request message. */ -static int calc_layout(struct ceph_vino vino, - struct ceph_file_layout *layout, - u64 off, u64 *plen, +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) { @@ -105,9 +103,6 @@ static int calc_layout(struct ceph_vino vino, dout("calc_layout bno=%llx %llu~%llu (%d pages)\n", *bno, objoff, objlen, req->r_num_pages); - snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", vino.ino, *bno); - req->r_oid_len = strlen(req->r_oid); - return 0; } @@ -436,7 +431,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(vino, layout, off, plen, req, ops, &bno); + r = calc_layout(layout, off, plen, req, ops, &bno); if (r < 0) { ceph_osdc_put_request(req);