private void flushWithReadLock() throws IOException {
    if (!isDirty()) {
      return;
    }

    //We need to ensure nobody _modifies_ page content while we're flushing it. The most natural way to
    // do it is by acquiring readLock -- but we could avoid lock acquisition if page state > ABOUT_TO_UNMAP,
    // because no one but housekeeper thread could legally use (and even see) the page in those states.

    if (state() > PageImpl.STATE_ABOUT_TO_UNMAP) {
      //This branch is not merely an optimization, but deadlock/livelock-prevention: page lock is not
      // exclusively owned by page, it could be a _shared_ lock, used by many pages -- hence, it is
      // possible for this lock to be write-locked even if the page is in > ABOUT_TO_UNMAP state. That
      // would be impossible for lock exclusively owned by the page: if the page is not available for
      // anyone outside FPCache, then no one outside FPC could acquire the page lock either -- but if
      // page lock is shared, then it becomes possible.
      // Hence, consider the scenario; there page_1 and page_2 shares the same lock:
      // - Thread 1: writeLock page_1, tries to get another page_2 from the storage. page_2 happens to be
      //             in the PRE_TOMBSTONE state, and must be fully released _before_ it could be re-allocated
      //             and returned.
      // - FPC housekeeper: tries to release page_2, finds out it is dirty, tries to flush it, get locked
      //             on the (shared) pageLock (which is held by Thread 1)
      // This branch prevents the deadlock in such a cases by bypassing page lock entirely

      flushImpl();
    }
    else {
      lockPageForRead();
      try {
        flushImpl();
      }
      finally {
        unlockPageForRead();
      }
    }
  }
private void flushWithReadLock()