]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd, objecter: clean up assert_ver()
authorSage Weil <sage@inktank.com>
Sun, 25 Aug 2013 18:12:44 +0000 (11:12 -0700)
committerSage Weil <sage@inktank.com>
Fri, 30 Aug 2013 23:54:16 +0000 (16:54 -0700)
Create a separate union in the args and clean up the code a bit so that
this doesn't reuse the (unrelated) watch helpers.  No change in
protocol.

Signed-off-by: Sage Weil <sage@inktank.com>
src/include/rados.h
src/osd/ReplicatedPG.cc
src/osd/osd_types.cc
src/osdc/Objecter.h

index de9b449ed157f45805736718be27628085877a59..9037606d154a9b535f2f3cb26ba0a5a85d955492 100644 (file)
@@ -397,6 +397,10 @@ struct ceph_osd_op {
                        __le64 ver;
                        __u8 flag;      /* 0 = unwatch, 1 = watch */
                } __attribute__ ((packed)) watch;
+               struct {
+                       __le64 unused;
+                       __le64 ver;
+               } __attribute__ ((packed)) assert_ver;
                struct {
                        __le64 offset, length;
                        __le64 src_offset;
index e5d50ef28b4454a72ddda30514232e9e4c31d948..6e047fb6367256237a509f38fdd99e18e0202e35 100644 (file)
@@ -2536,7 +2536,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
     case CEPH_OSD_OP_ASSERT_SRC_VERSION:
       ++ctx->num_read;
       {
-       uint64_t ver = op.watch.ver;
+       uint64_t ver = op.assert_ver.ver;
        if (!ver)
          result = -EINVAL;
         else if (ver < src_obc->obs.oi.user_version)
index fafea2c816e64822e7e6e86c47de7707dc661ff4..6511d802952b04553b06c5719353aec36238fa1e 100644 (file)
@@ -3416,6 +3416,9 @@ ostream& operator<<(ostream& out, const OSDOp& op)
     case CEPH_OSD_OP_LIST_WATCHERS:
     case CEPH_OSD_OP_LIST_SNAPS:
       break;
+    case CEPH_OSD_OP_ASSERT_VER:
+      out << " v" << op.op.assert_ver.ver;
+      break;
     case CEPH_OSD_OP_TRUNCATE:
       out << " " << op.op.extent.offset;
       break;
index be756054497617c59a93f7b2a1165398534a06de..4fdaa407a58bb8e859906d60e8e50c3ba4dfb5e7 100644 (file)
@@ -647,8 +647,8 @@ struct ObjectOperation {
   }
 
   void assert_version(uint64_t ver) {
-    bufferlist bl;
-    add_watch(CEPH_OSD_OP_ASSERT_VER, 0, ver, 0, bl);
+    OSDOp& osd_op = add_op(CEPH_OSD_OP_ASSERT_VER);
+    osd_op.op.assert_ver.ver = ver;
   }
   void assert_src_version(const object_t& srcoid, snapid_t srcsnapid, uint64_t ver) {
     bufferlist bl;