From: Kefu Chai Date: Sat, 11 Jul 2020 17:04:19 +0000 (+0800) Subject: blk/BlockDevice: use ceph_assertf() for assert X-Git-Tag: v17.0.0~1767^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6f7895fa5b6736bfcd8be2ff6dfa20ab6b4343d5;p=ceph.git blk/BlockDevice: use ceph_assertf() for assert 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 --- diff --git a/src/blk/BlockDevice.cc b/src/blk/BlockDevice.cc index 8a6763b448d11..64abde6e386d0 100644 --- a/src/blk/BlockDevice.cc +++ b/src/blk/BlockDevice.cc @@ -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; }