]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd/cache/pwl: remove RBD_FEATURE_DIRTY_CACHE check in DiscardRequest 45895/head
authorIlya Dryomov <idryomov@gmail.com>
Sun, 10 Apr 2022 16:13:48 +0000 (18:13 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 13 Apr 2022 10:51:21 +0000 (12:51 +0200)
commit282a526277c8e9ba6700f8262f588ad5e69d46c3
tree713f087c42353dd0b2157b379ccd319d684a51f7
parent1ed031fec5ca5eb275a9601e390f8cb4201d42f9
librbd/cache/pwl: remove RBD_FEATURE_DIRTY_CACHE check in DiscardRequest

"m_image_ctx.features &&RBD_FEATURE_DIRTY_CACHE" is obviously wrong
because it would pretty much always be true.  However, even if bitwise
AND was used, this check would still be dead because DiscardRequest is
only invoked if RBD_FEATURE_DIRTY_CACHE is enabled:

  int invalidate_cache(ImageCtx *ictx) {
  {
    ...
    // Delete writeback cache if it is not initialized
    if ((!ictx->exclusive_lock ||
         !ictx->exclusive_lock->is_lock_owner()) &&
ictx->test_features(RBD_FEATURE_DIRTY_CACHE)) {
      C_SaferCond ctx3;
      ictx->plugin_registry->discard(&ctx3);
      r = ctx3.wait();
    }

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit aee78bbb9d7edd606a8a235c57b2b704d7b94e4c)
src/librbd/cache/pwl/DiscardRequest.cc