]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
messages: Use ceph_assert for asserts.
authorAdam C. Emerson <aemerson@redhat.com>
Thu, 23 Aug 2018 15:25:42 +0000 (11:25 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Mon, 27 Aug 2018 14:27:22 +0000 (10:27 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
15 files changed:
src/messages/MClientCaps.h
src/messages/MClientQuota.h
src/messages/MClientReply.h
src/messages/MClientRequest.h
src/messages/MClientRequestForward.h
src/messages/MClientSnap.h
src/messages/MForward.h
src/messages/MMDSBeacon.h
src/messages/MMonGetOSDMap.h
src/messages/MMonQuorumService.h
src/messages/MMonScrub.h
src/messages/MMonSync.h
src/messages/MOSDOp.h
src/messages/MOSDOpReply.h
src/messages/MRemoveSnaps.h

index c48c478f0f1d11018c89c8205063038405017c13..56762641a0bae822ef8165218480a16c86a9dadd 100644 (file)
@@ -222,7 +222,7 @@ public:
     }
     decode_nohead(head.snap_trace_len, snapbl, p);
 
-    assert(middle.length() == head.xattr_len);
+    ceph_assert(middle.length() == head.xattr_len);
     if (head.xattr_len)
       xattrbl = middle;
 
index bced9f1a033555e8bdc3fb0d52a1ebadb3415967..2c58c2fc762448a0708eb965ebc0a6248ec9d97f 100644 (file)
@@ -45,7 +45,7 @@ public:
     decode(rstat.rfiles, p);
     decode(rstat.rsubdirs, p);
     decode(quota, p);
-    assert(p.end());
+    ceph_assert(p.end());
   }
 };
 
index cdcc8a615bf212bf54082f2df767f6d58b81abf6..3da3256d956e807c9f704f7f24e10c6fcfc5a844 100644 (file)
@@ -314,7 +314,7 @@ public:
     decode(trace_bl, p);
     decode(extra_bl, p);
     decode(snapbl, p);
-    assert(p.end());
+    ceph_assert(p.end());
   }
   void encode_payload(uint64_t features) override {
     using ceph::encode;
index d109ca59b5b581465b3457efdea5a74dd36c4672..f7be533d1ce0d93f8ccf9b85c9a2797178c6384a 100644 (file)
@@ -103,14 +103,14 @@ public:
   void set_mdsmap_epoch(epoch_t e) { head.mdsmap_epoch = e; }
   epoch_t get_mdsmap_epoch() const { return head.mdsmap_epoch; }
   epoch_t get_osdmap_epoch() const {
-    assert(head.op == CEPH_MDS_OP_SETXATTR);
+    ceph_assert(head.op == CEPH_MDS_OP_SETXATTR);
     if (header.version >= 3)
       return head.args.setxattr.osdmap_epoch;
     else
       return 0;
   }
   void set_osdmap_epoch(epoch_t e) {
-    assert(head.op == CEPH_MDS_OP_SETXATTR);
+    ceph_assert(head.op == CEPH_MDS_OP_SETXATTR);
     head.args.setxattr.osdmap_epoch = e;
   }
 
index 313818491711a43630365ae2b8639c7a956a2614..ed88617ed963c20aeee40c89f73754108b481d22 100644 (file)
@@ -33,7 +33,7 @@ protected:
   MClientRequestForward(ceph_tid_t t, int dm, int nf, bool cmr) :
     MessageInstance(CEPH_MSG_CLIENT_REQUEST_FORWARD),
     dest_mds(dm), num_fwd(nf), client_must_resend(cmr) {
-    assert(client_must_resend);
+    ceph_assert(client_must_resend);
     header.tid = t;
   }
   ~MClientRequestForward() override {}
index 9c7927576e6f824bd8b24e748ab8efe856264742..8e2d958f2b55090c33e9c245efa2376b7cb6376c 100644 (file)
@@ -62,7 +62,7 @@ public:
     decode_nohead(head.num_split_inos, split_inos, p);
     decode_nohead(head.num_split_realms, split_realms, p);
     decode_nohead(head.trace_len, bl, p);
-    assert(p.end());
+    ceph_assert(p.end());
   }
 
 };
index 2067d52a1934c9d5fc4498a62d38ce5903012a10..61ea6692445725041313269d19cdb0197b2457ae 100644 (file)
@@ -147,7 +147,7 @@ public:
 
   PaxosServiceMessage *claim_message() {
     // let whoever is claiming the message deal with putting it.
-    assert(msg);
+    ceph_assert(msg);
     msg_desc = stringify(*msg);
     PaxosServiceMessage *m = msg;
     msg = NULL;
index 6e1433d614cd5377ed2a524574cb0c69d5639876..1d1436ad363aeed29e6cc10d34877b2c155c8237 100644 (file)
@@ -121,7 +121,7 @@ struct MDSHealthMetric
 
   void encode(bufferlist& bl) const {
     ENCODE_START(1, 1, bl);
-    assert(type != MDS_HEALTH_NULL);
+    ceph_assert(type != MDS_HEALTH_NULL);
     encode((uint16_t)type, bl);
     encode((uint8_t)sev, bl);
     encode(message, bl);
@@ -132,7 +132,7 @@ struct MDSHealthMetric
   void decode(bufferlist::const_iterator& bl) {
     DECODE_START(1, bl);
     decode((uint16_t&)type, bl);
-    assert(type != MDS_HEALTH_NULL);
+    ceph_assert(type != MDS_HEALTH_NULL);
     decode((uint8_t&)sev, bl);
     decode(message, bl);
     decode(metadata, bl);
index 851b70fb645e81832a0996ae7884b08702b0d788..93a4d4756556f541f461526386f3834a4b516512 100644 (file)
@@ -39,12 +39,12 @@ private:
 
 public:
   void request_full(epoch_t first, epoch_t last) {
-    assert(last >= first);
+    ceph_assert(last >= first);
     full_first = first;
     full_last = last;
   }
   void request_inc(epoch_t first, epoch_t last) {
-    assert(last >= first);
+    ceph_assert(last >= first);
     inc_first = first;
     inc_last = last;
   }
index 068849875b78d0239d6be762b9e046537c9d96b5..c97b371982f21d238ea5e7cc2412a5aadf761bdd 100644 (file)
@@ -57,11 +57,11 @@ public:
   }
 
   void encode_payload(uint64_t features) override {
-    assert(0 == "MMonQuorumService message must always be a base class");
+    ceph_assert(0 == "MMonQuorumService message must always be a base class");
   }
 
   void decode_payload() override {
-    assert(0 == "MMonQuorumService message must always be a base class");
+    ceph_assert(0 == "MMonQuorumService message must always be a base class");
   }
 
   const char *get_type_name() const override { return "quorum_service"; }
index cb04ac2e85e6d64d44cf6f6d2dba7ce5fb4d0b8e..b105be624ee2c33a91d2d699e54ca65cbaf4fc85 100644 (file)
@@ -33,7 +33,7 @@ public:
     switch (op) {
     case OP_SCRUB: return "scrub";
     case OP_RESULT: return "result";
-    default: assert(0 == "unknown op type"); return NULL;
+    default: ceph_assert(0 == "unknown op type"); return NULL;
     }
   }
 
index 0f2f34862300e1bd27b807259a46dd404f23ec8a..8ccc2cdbc3fafa15828208f341ee09a5b504887d 100644 (file)
@@ -51,7 +51,7 @@ public:
     case OP_CHUNK: return "chunk";
     case OP_LAST_CHUNK: return "last_chunk";
     case OP_NO_COOKIE: return "no_cookie";
-    default: assert(0 == "unknown op type"); return NULL;
+    default: ceph_assert(0 == "unknown op type"); return NULL;
     }
   }
 
index e8b1d024d257f670439525352441b1c7d9e5ce1d..bfd0b8a506f4534de8e213d748a3599c416be326 100644 (file)
@@ -84,32 +84,32 @@ public:
 
   // Fields decoded in partial decoding
   pg_t get_pg() const {
-    assert(!partial_decode_needed);
+    ceph_assert(!partial_decode_needed);
     return pgid.pgid;
   }
   spg_t get_spg() const override {
-    assert(!partial_decode_needed);
+    ceph_assert(!partial_decode_needed);
     return pgid;
   }
   pg_t get_raw_pg() const {
-    assert(!partial_decode_needed);
+    ceph_assert(!partial_decode_needed);
     return pg_t(hobj.get_hash(), pgid.pgid.pool());
   }
   epoch_t get_map_epoch() const override {
-    assert(!partial_decode_needed);
+    ceph_assert(!partial_decode_needed);
     return osdmap_epoch;
   }
   int get_flags() const {
-    assert(!partial_decode_needed);
+    ceph_assert(!partial_decode_needed);
     return flags;
   }
   osd_reqid_t get_reqid() const {
-    assert(!partial_decode_needed);
+    ceph_assert(!partial_decode_needed);
     if (reqid.name != entity_name_t() || reqid.tid != 0) {
       return reqid;
     } else {
       if (!final_decode_needed)
-       assert(reqid.inc == (int32_t)client_inc);  // decode() should have done this
+       ceph_assert(reqid.inc == (int32_t)client_inc);  // decode() should have done this
       return osd_reqid_t(get_orig_source(),
                          reqid.inc,
                         header.tid);
@@ -118,37 +118,37 @@ public:
 
   // Fields decoded in final decoding
   int get_client_inc() const {
-    assert(!final_decode_needed);
+    ceph_assert(!final_decode_needed);
     return client_inc;
   }
   utime_t get_mtime() const {
-    assert(!final_decode_needed);
+    ceph_assert(!final_decode_needed);
     return mtime;
   }
   object_locator_t get_object_locator() const {
-    assert(!final_decode_needed);
+    ceph_assert(!final_decode_needed);
     if (hobj.oid.name.empty())
       return object_locator_t(hobj.pool, hobj.nspace, hobj.get_hash());
     else
       return object_locator_t(hobj);
   }
   const object_t& get_oid() const {
-    assert(!final_decode_needed);
+    ceph_assert(!final_decode_needed);
     return hobj.oid;
   }
   const hobject_t &get_hobj() const {
     return hobj;
   }
   snapid_t get_snapid() const {
-    assert(!final_decode_needed);
+    ceph_assert(!final_decode_needed);
     return hobj.snap;
   }
   const snapid_t& get_snap_seq() const {
-    assert(!final_decode_needed);
+    ceph_assert(!final_decode_needed);
     return snap_seq;
   }
   const vector<snapid_t> &get_snaps() const {
-    assert(!final_decode_needed);
+    ceph_assert(!final_decode_needed);
     return snaps;
   }
 
@@ -393,7 +393,7 @@ struct ceph_osd_request_head {
   }
 
   void decode_payload() override {
-    assert(partial_decode_needed && final_decode_needed);
+    ceph_assert(partial_decode_needed && final_decode_needed);
     p = std::cbegin(payload);
 
     // Always keep here the newest version of decoding order/rule
@@ -531,10 +531,10 @@ struct ceph_osd_request_head {
   }
 
   bool finish_decode() {
-    assert(!partial_decode_needed); // partial decoding required
+    ceph_assert(!partial_decode_needed); // partial decoding required
     if (!final_decode_needed)
       return false; // Message is already final decoded
-    assert(header.version >= 7);
+    ceph_assert(header.version >= 7);
 
     decode(client_inc, p);
     decode(mtime, p);
index 1e5edd4b42c441f6bb4a4c184f195530d9e5db1b..625a0f7405221397a7600480b16e1c15909caeea 100644 (file)
@@ -100,7 +100,7 @@ public:
   void add_flags(int f) { flags |= f; }
 
   void claim_op_out_data(vector<OSDOp>& o) {
-    assert(ops.size() == o.size());
+    ceph_assert(ops.size() == o.size());
     for (unsigned i = 0; i < o.size(); i++) {
       ops[i].outdata.claim(o[i].outdata);
     }
index 9d983d5edb61f339fb859023d13108e58f2ea822..849ef55f87b862d7cd97b704bf4b2f8ab6f8cf49 100644 (file)
@@ -47,7 +47,7 @@ public:
     auto p = payload.cbegin();
     paxos_decode(p);
     decode(snaps, p);
-    assert(p.end());
+    ceph_assert(p.end());
   }
 
 };