]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: only split blobs on min_alloc_size boundaries
authorSage Weil <sage@redhat.com>
Tue, 4 Oct 2016 14:01:07 +0000 (10:01 -0400)
committerSage Weil <sage@redhat.com>
Tue, 4 Oct 2016 14:01:07 +0000 (10:01 -0400)
Otherwise we can throw off the allocator.

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

index af80303c0e27bb246a4df3d9c1797cca6244f0f8..8659500ec4d64fa7cb00c8b1fcf6d6faf7c22635 100644 (file)
@@ -1564,7 +1564,7 @@ bool BlueStore::ExtentMap::update(Onode *o, KeyValueDB::Transaction t,
   return false;
 }
 
-void BlueStore::ExtentMap::reshard(Onode *o)
+void BlueStore::ExtentMap::reshard(Onode *o, uint64_t min_alloc_size)
 {
   // un-span all blobs
   auto p = spanning_blob_map.begin();
@@ -1701,7 +1701,8 @@ void BlueStore::ExtentMap::reshard(Onode *o)
          for (const auto& sh : shards) {
            if (bstart < sh.offset && bend > sh.offset) {
              uint32_t blob_offset = sh.offset - bstart;
-             if (b->get_blob().can_split_at(blob_offset)) {
+             if (b->get_blob().can_split_at(blob_offset) &&
+                 blob_offset % min_alloc_size == 0) {
                dout(20) << __func__ << "    splitting blob, bstart 0x"
                         << std::hex << bstart
                         << " blob_offset 0x" << blob_offset
@@ -6206,7 +6207,7 @@ void BlueStore::_txc_write_nodes(TransContext *txc, KeyValueDB::Transaction t)
        t->rmkey(PREFIX_OBJ, s.key);
       }
       o->extent_map.fault_range(db, 0, o->onode.size);
-      o->extent_map.reshard(o.get());
+      o->extent_map.reshard(o.get(), min_alloc_size);
       reshard = o->extent_map.update(o.get(), t, true);
       if (reshard) {
        dout(20) << __func__ << " warning: still wants reshard, check options?"
index a0fdddb7b96d01282197d80afea8861ccf35b1b7..723e6d3a24b8919794a9b737f78e719db04d3609 100644 (file)
@@ -591,7 +591,7 @@ public:
     BlobRef get_spanning_blob(int id);
 
     bool update(Onode *on, KeyValueDB::Transaction t, bool force);
-    void reshard(Onode *on);
+    void reshard(Onode *on, uint64_t min_alloc_size);
 
     /// initialize Shards from the onode
     void init_shards(Onode *on, bool loaded, bool dirty);