From: Changcheng Liu Date: Tue, 3 Mar 2020 05:54:53 +0000 (+0800) Subject: librbd/BlockGuard: explicit BlockGuard is right exclusive X-Git-Tag: v16.0.0~63^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bc8f37a5b580758dc7fe46e1e385da114f732d23;p=ceph.git librbd/BlockGuard: explicit BlockGuard is right exclusive It's better to explicitly specify that BlockGuard is right exclusive to avoid "+1/-1" adjust for the user. Signed-off-by: Changcheng Liu --- diff --git a/src/librbd/BlockGuard.h b/src/librbd/BlockGuard.h index 3641512f8b2b6..4a9cac0452349 100644 --- a/src/librbd/BlockGuard.h +++ b/src/librbd/BlockGuard.h @@ -21,6 +21,7 @@ namespace librbd { struct BlockExtent { + // [block_start, block_end) uint64_t block_start = 0; uint64_t block_end = 0; @@ -64,8 +65,8 @@ public: int detain(const BlockExtent &block_extent, BlockOperation *block_operation, BlockGuardCell **cell) { std::lock_guard locker{m_lock}; - ldout(m_cct, 20) << "block_start=" << block_extent.block_start << ", " - << "block_end=" << block_extent.block_end << ", " + ldout(m_cct, 20) << "[block_start=" << block_extent.block_start << ", " + << "block_end=" << block_extent.block_end << "), " << "free_slots=" << m_free_detained_block_extents.size() << dendl; @@ -109,10 +110,10 @@ public: ceph_assert(cell != nullptr); auto &detained_block_extent = reinterpret_cast( *cell); - ldout(m_cct, 20) << "block_start=" + ldout(m_cct, 20) << "[block_start=" << detained_block_extent.block_extent.block_start << ", " << "block_end=" - << detained_block_extent.block_extent.block_end << ", " + << detained_block_extent.block_extent.block_end << "), " << "pending_ops=" << (detained_block_extent.block_operations.empty() ? 0 : detained_block_extent.block_operations.size() - 1)