]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueStore: cleanup code. 8109/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Tue, 15 Mar 2016 10:31:56 +0000 (18:31 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Tue, 15 Mar 2016 10:31:56 +0000 (18:31 +0800)
Those code only usefull when content didn't locate in the same extent.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/os/bluestore/BlueStore.cc

index 2dcacdb7820a9a0e40fc5aefe3868905c8ce52c0..96d3c9c092d9ca089e72bab1314ea69130e71052 100644 (file)
@@ -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<uint64_t, bluestore_extent_t>::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;