From: Jianpeng Ma Date: Tue, 15 Mar 2016 10:31:56 +0000 (+0800) Subject: os/bluestore/BlueStore: cleanup code. X-Git-Tag: v11.0.0~779^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=017a9fe568fba401fb288eef6eb2252dfbb25279;p=ceph.git os/bluestore/BlueStore: cleanup code. Those code only usefull when content didn't locate in the same extent. Signed-off-by: Jianpeng Ma --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 2dcacdb7820a..96d3c9c092d9 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;