From 149084fc5017ea28def35668f9c17d5911d03aae Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Thu, 22 May 2025 06:41:01 +0000 Subject: [PATCH] crimson/os/seastore: prevent incorrect space calculation at maximum capacity 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 --- src/crimson/os/seastore/async_cleaner.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/crimson/os/seastore/async_cleaner.h b/src/crimson/os/seastore/async_cleaner.h index b17a4bd5be53b..4f7bf8d7f8e51 100644 --- a/src/crimson/os/seastore/async_cleaner.h +++ b/src/crimson/os/seastore/async_cleaner.h @@ -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; } -- 2.39.5