]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: rename need_size to want_size in StupidAllocator. 8101/head
authorJianjian Huo <samuel.huo@gmail.com>
Thu, 17 Mar 2016 00:17:49 +0000 (17:17 -0700)
committerJianjian Huo <samuel.huo@gmail.com>
Thu, 17 Mar 2016 06:09:28 +0000 (23:09 -0700)
Allocate() could return extent with size < need_size, so rename it per
Sage's suggestion.

Signed-off-by: Jianjian Huo <samuel.huo@gmail.com>
src/os/bluestore/StupidAllocator.cc
src/os/bluestore/StupidAllocator.h

index 2a6d1820f6d1695345f54e0a0d05f0a5d6795653..584c310da712d043be2c7049dc10c404d8a12a91 100755 (executable)
@@ -85,15 +85,15 @@ static uint64_t aligned_len(btree_interval_set<uint64_t>::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<std::mutex> 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);
index 1b09ace2dc9de8620490fe4ef91b5b4951347992..fa10c5d7473cde95becf7c6667b8ef1a90e3bd65 100644 (file)
@@ -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(