]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/BlockGuard: explicit BlockGuard is right exclusive 33681/head
authorChangcheng Liu <changcheng.liu@aliyun.com>
Tue, 3 Mar 2020 05:54:53 +0000 (13:54 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Tue, 3 Mar 2020 05:54:53 +0000 (13:54 +0800)
It's better to explicitly specify that BlockGuard is right
exclusive to avoid "+1/-1" adjust for the user.

Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
src/librbd/BlockGuard.h

index 3641512f8b2b6be0c930b7b5029dad99217fd0b2..4a9cac04523493ababe7a8266429dedf163192fc 100644 (file)
@@ -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<DetainedBlockExtent &>(
       *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)