From 06d22ef1632a4af12beede839fc55bdb9847fcec Mon Sep 17 00:00:00 2001 From: Jianjian Huo Date: Wed, 16 Mar 2016 17:17:49 -0700 Subject: [PATCH] os/bluestore: rename need_size to want_size in StupidAllocator. Allocate() could return extent with size < need_size, so rename it per Sage's suggestion. Signed-off-by: Jianjian Huo --- src/os/bluestore/StupidAllocator.cc | 12 ++++++------ src/os/bluestore/StupidAllocator.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/os/bluestore/StupidAllocator.cc b/src/os/bluestore/StupidAllocator.cc index 2a6d1820f6d16..584c310da712d 100755 --- a/src/os/bluestore/StupidAllocator.cc +++ b/src/os/bluestore/StupidAllocator.cc @@ -85,15 +85,15 @@ static uint64_t aligned_len(btree_interval_set::iterator p, } int StupidAllocator::allocate( - uint64_t need_size, uint64_t alloc_unit, int64_t hint, + uint64_t want_size, uint64_t alloc_unit, int64_t hint, uint64_t *offset, uint32_t *length) { std::lock_guard l(lock); - dout(10) << __func__ << " need_size " << need_size + dout(10) << __func__ << " want_size " << want_size << " alloc_unit " << alloc_unit << " hint " << hint << dendl; - uint64_t want = MAX(alloc_unit, need_size); + uint64_t want = MAX(alloc_unit, want_size); int bin = _choose_bin(want); int orig_bin = bin; @@ -107,7 +107,7 @@ int StupidAllocator::allocate( for (bin = orig_bin; bin < (int)free.size(); ++bin) { p = free[bin].lower_bound(hint); while (p != free[bin].end()) { - if (aligned_len(p, alloc_unit) >= need_size) { + if (aligned_len(p, alloc_unit) >= want_size) { goto found; } ++p; @@ -120,7 +120,7 @@ int StupidAllocator::allocate( p = free[bin].begin(); auto end = hint ? free[bin].lower_bound(hint) : free[bin].end(); while (p != end) { - if (aligned_len(p, alloc_unit) >= need_size) { + if (aligned_len(p, alloc_unit) >= want_size) { goto found; } ++p; @@ -160,7 +160,7 @@ int StupidAllocator::allocate( if (skew) skew = alloc_unit - skew; *offset = p.get_start() + skew; - *length = MIN(MAX(alloc_unit, need_size), p.get_len() - skew); + *length = MIN(MAX(alloc_unit, want_size), p.get_len() - skew); if (g_conf->bluestore_debug_small_allocations) { uint64_t max = alloc_unit * (rand() % g_conf->bluestore_debug_small_allocations); diff --git a/src/os/bluestore/StupidAllocator.h b/src/os/bluestore/StupidAllocator.h index 1b09ace2dc9de..fa10c5d7473cd 100644 --- a/src/os/bluestore/StupidAllocator.h +++ b/src/os/bluestore/StupidAllocator.h @@ -34,7 +34,7 @@ public: void unreserve(uint64_t unused); int allocate( - uint64_t need_size, uint64_t alloc_unit, int64_t hint, + uint64_t want_size, uint64_t alloc_unit, int64_t hint, uint64_t *offset, uint32_t *length); int release( -- 2.39.5