From: Sage Weil Date: Wed, 23 Dec 2015 15:17:44 +0000 (-0500) Subject: os/bluestore/StupidAllocator: add reservation assertions X-Git-Tag: v10.0.3~154^2~47 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=193d25f78611dea52f14acd2dec54512a5faec45;p=ceph.git os/bluestore/StupidAllocator: add reservation assertions Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/StupidAllocator.cc b/src/os/bluestore/StupidAllocator.cc index 2a1394a13e7a..307c21158395 100644 --- a/src/os/bluestore/StupidAllocator.cc +++ b/src/os/bluestore/StupidAllocator.cc @@ -159,6 +159,8 @@ int StupidAllocator::allocate( num_free -= *length; num_reserved -= need_size; + assert(num_free >= 0); + assert(num_reserved >= 0); last_alloc = *offset + *length; return 0; } @@ -232,6 +234,7 @@ void StupidAllocator::init_rm_free(uint64_t offset, uint64_t length) } assert(rm.empty()); num_free -= length; + assert(num_free >= 0); } diff --git a/src/os/bluestore/StupidAllocator.h b/src/os/bluestore/StupidAllocator.h index 76abc5d5fdd4..cad115d417c0 100644 --- a/src/os/bluestore/StupidAllocator.h +++ b/src/os/bluestore/StupidAllocator.h @@ -11,10 +11,10 @@ class StupidAllocator : public Allocator { Mutex lock; - uint64_t num_free; ///< total bytes in freelist - uint64_t num_uncommitted; - uint64_t num_committing; - uint64_t num_reserved; ///< reserved bytes + int64_t num_free; ///< total bytes in freelist + int64_t num_uncommitted; + int64_t num_committing; + int64_t num_reserved; ///< reserved bytes vector > free; ///< leading-edge copy interval_set uncommitted; ///< released but not yet usable