]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
blk, os/bluestore: introduce a cache bypassing to IOContext and BlueStore.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 3 Nov 2021 18:13:49 +0000 (18:13 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 12 Jan 2022 20:35:50 +0000 (20:35 +0000)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/blk/BlockDevice.h
src/os/bluestore/BlueStore.cc

index 4eef1ef0df4cbc015e8e039bc7e1098f5d57014f..a82c4761c8bf14af29b00df8da7cdb01532cbbc8 100644 (file)
@@ -73,6 +73,10 @@ std::ostream& operator<<(std::ostream& os, const blk_access_mode_t buffered);
 
 /// track in-flight io
 struct IOContext {
+  enum {
+    FLAG_DONT_CACHE = 1
+  };
+
 private:
   ceph::mutex lock = ceph::make_mutex("IOContext::lock");
   ceph::condition_variable cond;
@@ -94,6 +98,7 @@ public:
   std::atomic_int num_pending = {0};
   std::atomic_int num_running = {0};
   bool allow_eio;
+  uint32_t flags = 0;               // FLAG_*
 
   explicit IOContext(CephContext* cct, void *p, bool allow_eio = false)
     : cct(cct), priv(p), allow_eio(allow_eio)
@@ -131,6 +136,10 @@ public:
   int get_return_value() const {
     return r;
   }
+
+  bool skip_cache() const {
+    return flags & FLAG_DONT_CACHE;
+  }
 };
 
 
index 89cc0713a44eb57f98c46742845efc0634a579d2..ae4efa12b9a8152f6389490c08b206eb99f61f31 100644 (file)
@@ -10812,7 +10812,8 @@ int BlueStore::_do_read(
   bool csum_error = false;
   r = _generate_read_result_bl(o, offset, length, ready_regions,
                               compressed_blob_bls, blobs2read,
-                              buffered, &csum_error, bl);
+                              buffered && !ioc.skip_cache(),
+                              &csum_error, bl);
   if (csum_error) {
     // Handles spurious read errors caused by a kernel bug.
     // We sometimes get all-zero pages as a result of the read under