]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
blk/BlockDevice: use ceph_assertf() for assert
authorKefu Chai <kchai@redhat.com>
Sat, 11 Jul 2020 17:04:19 +0000 (01:04 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 13 Jul 2020 03:19:16 +0000 (11:19 +0800)
also silences a warning like

src/blk/BlockDevice.cc:158:1: warning: label 'out_fail' defined but not used [-Wunused-label]
  158 | out_fail:
      | ^~~~~~~~

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/blk/BlockDevice.cc

index 8a6763b448d1186c10b4711acfe0798c67d006fc..64abde6e386d0e895b428c04264b6f957db3809b 100644 (file)
@@ -135,11 +135,7 @@ BlockDevice *BlockDevice::create(CephContext* cct, const string& path,
   if (r == 1) {
     return new HMSMRDevice(cct, cb, cbpriv, d_cb, d_cbpriv);
   }
-  if (r < 0) {
-    derr << __func__ << " zbc_device_is_zoned(" << path << ") failed: "
-        << cpp_strerror(r) << dendl;
-    goto out_fail;
-  }
+  ceph_assertf(r >= 0, "zbc_device_is_zoned(%s) failed: %d", path.c_str(), r);
 #endif
   if (type == "kernel") {
     return new KernelDevice(cct, cb, cbpriv, d_cb, d_cbpriv);
@@ -155,7 +151,6 @@ BlockDevice *BlockDevice::create(CephContext* cct, const string& path,
 
   derr << __func__ << " unknown backend " << type << dendl;
 
-out_fail:
   ceph_abort();
   return NULL;
 }