]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueFS: simplify extent list
authorSage Weil <sage@redhat.com>
Thu, 10 Dec 2015 21:37:55 +0000 (16:37 -0500)
committerSage Weil <sage@redhat.com>
Fri, 1 Jan 2016 18:06:55 +0000 (13:06 -0500)
Merge contiguous extents.

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

index bda920b7e1f37eb779f6a23d1cfbf90bff55fac5..0321812d648cfc430873a2d1dc8f2a9f7cbeba3d 100644 (file)
@@ -888,7 +888,10 @@ int BlueFS::_allocate(unsigned id, uint64_t len, vector<bluefs_extent_t> *ev)
                                &e.offset, &e.length);
     if (r < 0)
       return r;
-    ev->push_back(e);
+    if (!ev->empty() && ev->back().end() == e.offset)
+      ev->back().length += e.length;
+    else
+      ev->push_back(e);
     if (e.length >= left)
       break;
     left -= e.length;