From patchwork Fri Sep 7 18:19:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1424781 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 C89E8DF283 for ; Fri, 7 Sep 2012 18:19:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753448Ab2IGSTR (ORCPT ); Fri, 7 Sep 2012 14:19:17 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:35579 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753283Ab2IGSTQ (ORCPT ); Fri, 7 Sep 2012 14:19:16 -0400 Received: by ieje11 with SMTP id e11so5532930iej.19 for ; Fri, 07 Sep 2012 11:19:16 -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=G7ii6fXGlIK+bCZ92vj/RpAH7SfXUzQjeMVlrGXUirs=; b=BWLL551pn7tTdc36Sh5ai2d2gfU+5BiISLpfhzjV2+csDbG+jdwcocGxRmUj1tMk1r tf+H8+QrlqKmlQTd++xnR0COAXFiBcFaOYLWqaZ8J1HPq3F79bf7oobF2HYtnTm+V+1w EIZIt5+FXjPiWuysCKV5LUrzNMafoM9+fhpDQTO60lD0YQdRmFFx4zcm5/BZrFVWY/X3 fYpWqFxJ5B8wH0gKaogV5vO3cglbOYvr8S5kX3ttZ23QBqU5d78szmjM2rLg/EvVB+Js xgdsFcyXR2WBlpOqnIJ4U2BcrygSPdOMq2aE9G2jwc++H2L6VSP9iscBvmygV1ayXdx8 8Drw== Received: by 10.50.100.165 with SMTP id ez5mr10247918igb.68.1347041956042; Fri, 07 Sep 2012 11:19:16 -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 ch4sm10514igb.2.2012.09.07.11.19.14 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 11:19:15 -0700 (PDT) Message-ID: <504A3AA1.6090603@inktank.com> Date: Fri, 07 Sep 2012 13:19:13 -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 1/5] rbd: pass flags to rbd_req_sync_exec() References: <504A39E0.1040107@inktank.com> In-Reply-To: <504A39E0.1040107@inktank.com> X-Gm-Message-State: ALoCoQlv/qqB7jtU5IHdUc16+hM/kWo2SWUzTL4BSFMn9U+kPeyTjU/yhp7oSRoWa1R/pwmzbG6q Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org In order to allow both read requests and write requests to be initiated using rbd_req_sync_exec(), add an OSD flags value which can be passed down to rbd_req_sync_op(). Rename the "data" and "len" parameters to be more clear that they represent data that is outbound. At this point, this function is still only used (and only works) for write requests. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) rbd_destroy_ops(ops); @@ -1780,7 +1789,9 @@ 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, p - data, NULL); + data, (size_t) (p - data), + CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK, + NULL); kfree(data); diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index daa428e3..4e84f99 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1437,23 +1437,33 @@ fail: } /* - * Request sync osd read + * Synchronous osd object method call */ static int rbd_req_sync_exec(struct rbd_device *rbd_dev, const char *object_name, const char *class_name, const char *method_name, - const char *data, - int len, + const char *outbound, + size_t outbound_size, + int flags, u64 *ver) { struct ceph_osd_req_op *ops; int class_name_len = strlen(class_name); int method_name_len = strlen(method_name); + int payload_size; int ret; - ops = rbd_create_rw_ops(1, CEPH_OSD_OP_CALL, - class_name_len + method_name_len + len); + /* + * Any input parameters required by the method we're calling + * will be sent along with the class and method names as + * part of the message payload. That data and its size are + * supplied via the indata and indata_len fields (named from + * the perspective of the server side) in the OSD request + * operation. + */ + payload_size = class_name_len + method_name_len + outbound_size; + ops = rbd_create_rw_ops(1, CEPH_OSD_OP_CALL, payload_size); if (!ops) return -ENOMEM; @@ -1462,13 +1472,12 @@ static int rbd_req_sync_exec(struct rbd_device *rbd_dev, ops[0].cls.method_name = method_name; ops[0].cls.method_len = (__u8) method_name_len; ops[0].cls.argc = 0; - ops[0].cls.indata = data; - ops[0].cls.indata_len = len; + ops[0].cls.indata = outbound; + ops[0].cls.indata_len = outbound_size; ret = rbd_req_sync_op(rbd_dev, NULL, CEPH_NOSNAP, - CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK, - ops, + flags, ops, object_name, 0, 0, NULL, NULL, ver);