From patchwork Fri Aug 13 17:40:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sage Weil X-Patchwork-Id: 119486 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7DHi7sv004733 for ; Fri, 13 Aug 2010 17:44:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934632Ab0HMRmS (ORCPT ); Fri, 13 Aug 2010 13:42:18 -0400 Received: from cobra.newdream.net ([66.33.216.30]:46710 "EHLO cobra.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761921Ab0HMRlp (ORCPT ); Fri, 13 Aug 2010 13:41:45 -0400 Received: from localhost.localdomain (ip-66-33-206-8.dreamhost.com [66.33.206.8]) by cobra.newdream.net (Postfix) with ESMTPA id 04FBCBC797; Fri, 13 Aug 2010 10:42:00 -0700 (PDT) From: Sage Weil To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: ceph-devel@vger.kernel.org, hch@lst.de, akpm@linux-foundation.org, yehuda@hq.newdream.net Subject: [PATCH 6/8] ceph-rbd: osdc support for osd call and rollback operations Date: Fri, 13 Aug 2010 10:40:38 -0700 Message-Id: <1281721240-26130-7-git-send-email-sage@newdream.net> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1281721240-26130-1-git-send-email-sage@newdream.net> References: <1281721240-26130-1-git-send-email-sage@newdream.net> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 13 Aug 2010 17:44:07 +0000 (UTC) diff --git a/fs/ceph/decode.h b/fs/ceph/decode.h index 3d25415..c5b6939 100644 --- a/fs/ceph/decode.h +++ b/fs/ceph/decode.h @@ -191,6 +191,11 @@ static inline void ceph_encode_string(void **p, void *end, ceph_encode_need(p, end, n, bad); \ ceph_encode_copy(p, pv, n); \ } while (0) +#define ceph_encode_string_safe(p, end, s, n, bad) \ + do { \ + ceph_encode_need(p, end, n, bad); \ + ceph_encode_string(p, end, s, n); \ + } while (0) #endif diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c index 8b1d0a6..34f6fe6 100644 --- a/fs/ceph/osd_client.c +++ b/fs/ceph/osd_client.c @@ -161,6 +161,7 @@ static int op_needs_trail(int op) case CEPH_OSD_OP_GETXATTR: case CEPH_OSD_OP_SETXATTR: case CEPH_OSD_OP_CMPXATTR: + case CEPH_OSD_OP_CALL: return 1; default: return 0; @@ -301,6 +302,23 @@ static void osd_req_encode_op(struct ceph_osd_request *req, ceph_pagelist_append(req->r_trail, src->xattr.val, src->xattr.value_len); break; + case CEPH_OSD_OP_CALL: + BUG_ON(!req->r_trail); + + dst->cls.class_len = src->cls.class_len; + dst->cls.method_len = src->cls.method_len; + dst->cls.indata_len = cpu_to_le32(src->cls.indata_len); + + ceph_pagelist_append(req->r_trail, src->cls.class_name, + src->cls.class_len); + ceph_pagelist_append(req->r_trail, src->cls.method_name, + src->cls.method_len); + ceph_pagelist_append(req->r_trail, src->cls.indata, + src->cls.indata_len); + break; + case CEPH_OSD_OP_ROLLBACK: + dst->snap.snapid = cpu_to_le64(src->snap.snapid); + break; case CEPH_OSD_OP_STARTSYNC: break; default: diff --git a/fs/ceph/osd_client.h b/fs/ceph/osd_client.h index 0a82bd1..6c91fb0 100644 --- a/fs/ceph/osd_client.h +++ b/fs/ceph/osd_client.h @@ -135,14 +135,20 @@ struct ceph_osd_req_op { __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */ } xattr; struct { + const char *class_name; __u8 class_len; + const char *method_name; __u8 method_len; __u8 argc; + const char *indata; u32 indata_len; } cls; struct { u64 cookie, count; } pgls; + struct { + u64 snapid; + } snap; }; u32 payload_len; };