]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: prevent incorrect space calculation at maximum capacity 63428/head
authormyoungwon oh <ohmyoungwon@gmail.com>
Thu, 22 May 2025 06:41:01 +0000 (06:41 +0000)
committermyoungwon oh <ohmyoungwon@gmail.com>
Thu, 22 May 2025 10:38:06 +0000 (10:38 +0000)
This commit updates seastore to increment used_bytes only when
 allocation is successful.
Without this commit, the seatore reports incorrect size if alloc_paddr fails
(e.g., due to insufficient space)

Signed-off-by: Myoungwon Oh <ohmyoungwon@gmail.com>
src/crimson/os/seastore/async_cleaner.h

index b17a4bd5be53bacd807ca5b70f464810df11536b..4f7bf8d7f8e5150afe6f3fd43b50733368f1e522 100644 (file)
@@ -1746,7 +1746,9 @@ public:
     // TODO: implement allocation strategy (dirty metadata and multiple devices)
     auto rbs = rb_group->get_rb_managers();
     auto paddr = rbs[0]->alloc_extent(length);
-    stats.used_bytes += length;
+    if (paddr != P_ADDR_NULL) {
+      stats.used_bytes += length;
+    }
     return paddr;
   }
 
@@ -1754,7 +1756,9 @@ public:
     // TODO: implement allocation strategy (dirty metadata and multiple devices)
     auto rbs = rb_group->get_rb_managers();
     auto ret = rbs[0]->alloc_extents(length);
-    stats.used_bytes += length;
+    if (!ret.empty()) {
+      stats.used_bytes += length;
+    }
     return ret;
   }