]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
clean up CEPH_WATCH_EVENT_* namespace, and make COMPLETE distinct
authorSage Weil <sage@redhat.com>
Fri, 7 Nov 2014 23:35:24 +0000 (15:35 -0800)
committerSage Weil <sage@redhat.com>
Thu, 4 Dec 2014 18:32:38 +0000 (10:32 -0800)
Use a proper prefix and make a separate event for the notify completion
message.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/ceph_strings.cc
src/include/ceph_fs.h
src/librados/RadosClient.cc
src/messages/MWatchNotify.h
src/osd/Watch.cc

index a0651fad32230a7c9d41846a5615b36ac7a4b7af..247a3f079a6a209367812e06d91aa18311bbd550 100644 (file)
@@ -180,6 +180,15 @@ const char *ceph_snap_op_name(int o)
        return "???";
 }
 
+const char *ceph_watch_event_name(int e)
+{
+       switch (e) {
+       case CEPH_WATCH_EVENT_NOTIFY: return "notify";
+       case CEPH_WATCH_EVENT_NOTIFY_COMPLETE: return "notify_complete";
+       }
+       return "???";
+}
+
 const char *ceph_pool_op_name(int op)
 {
        switch (op) {
index 70a3958c7e558b20a207791a64214e5d4a3ca6bb..5eebdd8fddb83fc8f23bb0eb113cc22ff00f5635 100644 (file)
@@ -130,10 +130,11 @@ struct ceph_dir_layout {
 
 /* watch-notify operations */
 enum {
-  WATCH_NOTIFY                         = 1, /* notifying watcher */
-  WATCH_NOTIFY_COMPLETE                        = 2, /* notifier notified when done */
+       CEPH_WATCH_EVENT_NOTIFY           = 1, /* notifying watcher */
+       CEPH_WATCH_EVENT_NOTIFY_COMPLETE  = 2, /* notifier notified when done */
 };
 
+const char *ceph_watch_event_name(int o);
 
 /* pool operations */
 enum {
index ba4f5a89b1fd3d5172ed0f6f346012f54a5f4c21..f5a4e161d9350332e8838c1fc3ad570017b3602b 100644 (file)
@@ -775,7 +775,7 @@ void librados::RadosClient::do_watch_notify(MWatchNotify *m)
       assert(!!wc->watch_ctx ^ !!wc->watch_ctx2);  // only one is defined
       lock.Unlock();
       if (wc->watch_ctx) {
-       wc->watch_ctx->notify(WATCH_NOTIFY, m->ver, m->bl);
+       wc->watch_ctx->notify(CEPH_WATCH_EVENT_NOTIFY, m->ver, m->bl);
        // send ACK back to the OSD
        bufferlist empty;
        wc->io_ctx_impl->notify_ack(wc->oid, m->notify_id, m->cookie, empty);
index aa82140739f8e8db0d197627009dd661720c58dc..af426805fbb5085392f2e8057594bee0ec7f52df 100644 (file)
@@ -27,7 +27,7 @@ class MWatchNotify : public Message {
   uint64_t cookie;     ///< client unique id for this watch or notify
   uint64_t ver;        ///< unused
   uint64_t notify_id;  ///< osd unique id for a notify notification
-  uint8_t opcode;      ///< always WATCH_NOTIFY
+  uint8_t opcode;      ///< CEPH_WATCH_EVENT_*
   bufferlist bl;       ///< notify payload (osd->client)
   int32_t return_code; ///< notify result (osd->client)
   uint64_t notifier_gid; ///< who sent the notify
index 4e07d6e66a9cf6a656fa4d3153f7c471a30c76d8..91ed6d84f0123596e92e4b8b31764827587d4220 100644 (file)
@@ -189,7 +189,7 @@ void Notify::maybe_complete_notify()
     ::encode(notify_replies, bl);
     bufferlist empty;
     MWatchNotify *reply(new MWatchNotify(cookie, version, notify_id,
-                                        WATCH_NOTIFY, empty));
+                                        CEPH_WATCH_EVENT_NOTIFY_COMPLETE, empty));
     reply->notifier_gid = client_gid;
     reply->set_data(bl);
     if (timed_out)
@@ -430,7 +430,7 @@ void Watch::send_notify(NotifyRef notif)
   dout(10) << "send_notify" << dendl;
   MWatchNotify *notify_msg = new MWatchNotify(
     cookie, notif->version, notif->notify_id,
-    WATCH_NOTIFY, notif->payload);
+    CEPH_WATCH_EVENT_NOTIFY, notif->payload);
   notify_msg->notifier_gid = notif->client_gid;
   osd->send_message_osd_client(notify_msg, conn.get());
 }