From: Radoslaw Zarzynski Date: Wed, 3 Nov 2021 18:13:49 +0000 (+0000) Subject: blk, os/bluestore: introduce a cache bypassing to IOContext and BlueStore. X-Git-Tag: v17.1.0~51^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9768120e9a60d8bf22cdd36eb2b92a943a466068;p=ceph.git blk, os/bluestore: introduce a cache bypassing to IOContext and BlueStore. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/blk/BlockDevice.h b/src/blk/BlockDevice.h index 4eef1ef0df4..a82c4761c8b 100644 --- a/src/blk/BlockDevice.h +++ b/src/blk/BlockDevice.h @@ -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; + } }; diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 89cc0713a44..ae4efa12b9a 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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