From 017a9fe568fba401fb288eef6eb2252dfbb25279 Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Tue, 15 Mar 2016 18:31:56 +0800 Subject: [PATCH] os/bluestore/BlueStore: cleanup code. Those code only usefull when content didn't locate in the same extent. Signed-off-by: Jianpeng Ma --- src/os/bluestore/BlueStore.cc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 2dcacdb7820a9..96d3c9c092d9c 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5041,19 +5041,6 @@ int BlueStore::_do_allocate( // start with any full blocks we will write uint64_t offset = orig_offset; uint64_t length = orig_length; - uint64_t head = 0; - uint64_t tail = 0; - if (offset % min_alloc_size) { - head = min_alloc_size - (offset % min_alloc_size); - offset += head; - if (length >= head) - length -= head; - } - if ((offset + length) % min_alloc_size) { - tail = (offset + length) % min_alloc_size; - if (length >= tail) - length -= tail; - } map::iterator bp; bool shared_head = false; @@ -5081,6 +5068,20 @@ int BlueStore::_do_allocate( } } } else { + uint64_t head = 0; + uint64_t tail = 0; + if (offset % min_alloc_size) { + head = min_alloc_size - (offset % min_alloc_size); + offset += head; + if (length >= head) + length -= head; + } + if ((offset + length) % min_alloc_size) { + tail = (offset + length) % min_alloc_size; + if (length >= tail) + length -= tail; + } + dout(20) << " initial full " << offset << "~" << length << ", head " << head << " tail " << tail << dendl; -- 2.39.5