]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: fix allocation vs reservation for bluefs extents 7130/head
authorSage Weil <sage@redhat.com>
Fri, 8 Jan 2016 21:11:02 +0000 (16:11 -0500)
committerSage Weil <sage@redhat.com>
Fri, 8 Jan 2016 21:11:02 +0000 (16:11 -0500)
- drop the MIN cruft
- unreserve what we didn't get

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc

index 38fb369e5ce3d58feea8021cf7347e63bf19284c..b97d40b78f7e6a67c8a15c2eb86f60dc3ca95307 100644 (file)
@@ -1430,12 +1430,14 @@ int BlueStore::_balance_bluefs_freespace(vector<bluestore_extent_t> *extents)
       assert(r == 0);
 
       bluestore_extent_t e;
-      r =  alloc->allocate(MIN(gift, 1ull<<31), min_alloc_size, 0,
-                          &e.offset, &e.length);
+      r = alloc->allocate(gift, min_alloc_size, 0, &e.offset, &e.length);
       if (r < 0) {
        assert(0 == "allocate failed, wtf");
        return r;
       }
+      if (e.length < gift) {
+       alloc->unreserve(gift - e.length);
+      }
 
       dout(1) << __func__ << " gifting " << e << " to bluefs" << dendl;
       extents->push_back(e);