]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: call fault_range properly prior to looking for blob to reuse 27570/head
authorIgor Fedotov <ifedotov@suse.com>
Mon, 8 Apr 2019 16:41:55 +0000 (19:41 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Fri, 12 Apr 2019 20:56:51 +0000 (23:56 +0300)
Fixes: https://tracker.ceph.com/issues/21312
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit e0a395ee2240d7565953a9bb0a1e5c336efe6336)

src/os/bluestore/BlueStore.cc

index 82e6c161054514afb4a522af6163da01a3d5abd5..a137a50bab4165e7b76981dd9fbedc2dc10d8df6 100644 (file)
@@ -2747,7 +2747,8 @@ void BlueStore::ExtentMap::fault_range(
       p->extents = decode_some(v);
       p->loaded = true;
       dout(20) << __func__ << " open shard 0x" << std::hex
-              << p->shard_info->offset << std::dec
+              << p->shard_info->offset
+              << " for range 0x" << offset << "~" << length << std::dec
               << " (" << v.length() << " bytes)" << dendl;
       ceph_assert(p->dirty == false);
       ceph_assert(v.length() == p->shard_info->bytes);
@@ -10362,6 +10363,20 @@ void BlueStore::_do_write_small(
   bufferlist bl;
   blp.copy(length, bl);
 
+  auto max_bsize = std::max(wctx->target_blob_size, min_alloc_size);
+  auto min_off = offset >= max_bsize ? offset - max_bsize : 0;
+  uint32_t alloc_len = min_alloc_size;
+  auto offset0 = p2align<uint64_t>(offset, alloc_len);
+
+  bool any_change;
+
+  // search suitable extent in both forward and reverse direction in
+  // [offset - target_max_blob_size, offset + target_max_blob_size] range
+  // then check if blob can be reused via can_reuse_blob func or apply
+  // direct/deferred write (the latter for extents including or higher
+  // than 'offset' only).
+  o->extent_map.fault_range(db, min_off, offset + max_bsize - min_off);
+
   // Look for an existing mutable blob we can use.
   auto begin = o->extent_map.extent_map.begin();
   auto end = o->extent_map.extent_map.end();
@@ -10379,18 +10394,6 @@ void BlueStore::_do_write_small(
     prev_ep = end; // to avoid this extent check as it's a duplicate
   }
 
-  auto max_bsize = std::max(wctx->target_blob_size, min_alloc_size);
-  auto min_off = offset >= max_bsize ? offset - max_bsize : 0;
-  uint32_t alloc_len = min_alloc_size;
-  auto offset0 = p2align<uint64_t>(offset, alloc_len);
-
-  bool any_change;
-
-  // search suitable extent in both forward and reverse direction in
-  // [offset - target_max_blob_size, offset + target_max_blob_size] range
-  // then check if blob can be reused via can_reuse_blob func or apply
-  // direct/deferred write (the latter for extents including or higher
-  // than 'offset' only).
   do {
     any_change = false;