From f48690ebbee6aff6dcb9da0f851ead037212bb22 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 4 Oct 2016 10:01:07 -0400 Subject: [PATCH] os/bluestore: only split blobs on min_alloc_size boundaries Otherwise we can throw off the allocator. Signed-off-by: Sage Weil --- src/os/bluestore/BlueStore.cc | 7 ++++--- src/os/bluestore/BlueStore.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index af80303c0e2..8659500ec4d 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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?" diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index a0fdddb7b96..723e6d3a24b 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -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); -- 2.39.5