]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueStore: Fix bug when calc offset & end whether locate in the a extent. 7892/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Thu, 3 Mar 2016 10:49:28 +0000 (18:49 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Thu, 3 Mar 2016 10:58:04 +0000 (18:58 +0800)
Suppose: bluestore_overlay_max_length == bluestore_min_alloc_size
The orignal code which calc content of written whether locate in a
extent:
(offset / min_alloc_size) == (offset + length) /min_alloc_size
This will make the case which offset=0 & length =min_alloc_size locate
in the different extent.
In fact, this content is in the same extent.

Change end = offset + length - 1 make work.

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

index 96a10f423bdfdefbe0563d61098b2ef466c75b3e..aa37a46a53632076788f3ec5d7093e1d1ed8ddd1 100644 (file)
@@ -5059,7 +5059,7 @@ int BlueStore::_do_allocate(
   bool shared_head = false;
   bool shared_tail = false;
   uint64_t orig_end = orig_offset + orig_length;
-  if (orig_offset / min_alloc_size == orig_end / min_alloc_size) {
+  if (orig_offset / min_alloc_size == (orig_end - 1)/ min_alloc_size) {
     // we fall within the same block
     offset = orig_offset - orig_offset % min_alloc_size;
     length = 0;