From patchwork Fri Sep 7 18:19:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1424791 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 51D0FDF283 for ; Fri, 7 Sep 2012 18:19:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753540Ab2IGSTZ (ORCPT ); Fri, 7 Sep 2012 14:19:25 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:41755 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753283Ab2IGSTY (ORCPT ); Fri, 7 Sep 2012 14:19:24 -0400 Received: by iahk25 with SMTP id k25so3471231iah.19 for ; Fri, 07 Sep 2012 11:19:24 -0700 (PDT) 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=AfTfa3xgACyoE7eNxSVfpZaeXU+gXtNTWyenr6sv7ek=; b=LJU+KzA5yNsA8N3Z2lZOnm3mtQsU2ENcBRsfz5QxfZm2kY88stXD/WwBSate1FQuXS 3zynTcw9KY1fiO8oONg5geSint39T66VBhYrxfqmNkUcux6dZXNpe7RHzzSnUZ1BIzAc bTjcvUU5OVvfcD9uDqGaOHTDlea0AMg9vEscuIlImkhpH4cdlUdVzVbIaaLFQzg2IrWL V7XWmjgWBZ5i061T/u7wiDLhFgfostA+gu02AAGeTNQhdkuH9razBPlmiTTyQBiVM5sw mepYYepxVXhlHCrYUV9qqkuevfqNI4tKumo4arqBqaCb5SaO2WcTpMbD6nZNwDOKZULY Q88Q== Received: by 10.50.10.227 with SMTP id l3mr29338696igb.71.1347041964138; Fri, 07 Sep 2012 11:19:24 -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 fu4sm5158igc.4.2012.09.07.11.19.22 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 11:19:23 -0700 (PDT) Message-ID: <504A3AA9.80004@inktank.com> Date: Fri, 07 Sep 2012 13:19:21 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 2/5] rbd: support data returned from OSD methods References: <504A39E0.1040107@inktank.com> In-Reply-To: <504A39E0.1040107@inktank.com> X-Gm-Message-State: ALoCoQlKtoLBuXul294OkLnvhdGqyoo7MA75ne7KBE7IOhud+9O58GKf3QuL6uwspkRFK1AXbknO Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org An OSD object method call can be made using rbd_req_sync_exec(). Until now this has only been used for creating a new RBD snapshot, and that has only required sending data out, not receiving anything back from the OSD. We will now need to get data back from an OSD on a method call, so add parameters to rbd_req_sync_exec() that allow a buffer into which returned data should be placed to be specified, along with its size. Previously, rbd_req_sync_exec() passed a null pointer and zero size to rbd_req_sync_op(); change this so the new inbound buffer information is provided instead. Rename the "buf" and "len" parameters in rbd_req_sync_op() to make it more obvious they are describing inbound data. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) ops, @@ -1125,8 +1125,8 @@ static int rbd_req_sync_op(struct rbd_device *rbd_dev, if (ret < 0) goto done; - if ((flags & CEPH_OSD_FLAG_READ) && buf) - ret = ceph_copy_from_page_vector(pages, buf, ofs, ret); + if ((flags & CEPH_OSD_FLAG_READ) && inbound) + ret = ceph_copy_from_page_vector(pages, inbound, ofs, ret); done: ceph_release_page_vector(pages, num_pages); @@ -1445,6 +1445,8 @@ static int rbd_req_sync_exec(struct rbd_device *rbd_dev, const char *method_name, const char *outbound, size_t outbound_size, + char *inbound, + size_t inbound_size, int flags, u64 *ver) { @@ -1478,7 +1480,8 @@ static int rbd_req_sync_exec(struct rbd_device *rbd_dev, ret = rbd_req_sync_op(rbd_dev, NULL, CEPH_NOSNAP, flags, ops, - object_name, 0, 0, NULL, NULL, ver); + object_name, 0, inbound_size, inbound, + NULL, ver); rbd_destroy_ops(ops); @@ -1789,7 +1792,7 @@ static int rbd_header_add_snap(struct rbd_device *rbd_dev, ret = rbd_req_sync_exec(rbd_dev, rbd_dev->header_name, "rbd", "snap_add", - data, (size_t) (p - data), + data, (size_t) (p - data), NULL, 0, CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK, NULL); diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 4e84f99..ba68566 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1098,8 +1098,8 @@ static int rbd_req_sync_op(struct rbd_device *rbd_dev, int flags, struct ceph_osd_req_op *ops, const char *object_name, - u64 ofs, u64 len, - char *buf, + u64 ofs, u64 inbound_size, + char *inbound, struct ceph_osd_request **linger_req, u64 *ver) { @@ -1109,13 +1109,13 @@ static int rbd_req_sync_op(struct rbd_device *rbd_dev, rbd_assert(ops != NULL); - num_pages = calc_pages_for(ofs , len); + num_pages = calc_pages_for(ofs, inbound_size); pages = ceph_alloc_page_vector(num_pages, GFP_KERNEL); if (IS_ERR(pages)) return PTR_ERR(pages); ret = rbd_do_request(NULL, rbd_dev, snapc, snapid, - object_name, ofs, len, NULL, + object_name, ofs, inbound_size, NULL, pages, num_pages, flags,