private void ascendUntilCachedParent(int fileId) {
      int currentId = fileId;

      while (true) {

        int parentId = vfsPeer.getParent(currentId);

        if (parentId != FSRecords.NULL_FILE_ID) {
          foundParent = myIdToDirCache.getCachedDir(parentId);
          if (foundParent != null) {
            return;
          }
        }
        else {
          //RC: currentId is root, but not cached -- it is OK, root _could_ be not (yet) cached, since
          //    idToDirCache caches a root only during PersistentFSImpl.findRoot() call -- it could be
          //    that not all the roots known to FSRecords were requested at a given moment.
          //    => we need to force idToDirCache to cache the root it misses:
          cacheMissedRootFromPersistence(currentId);

          foundParent = myIdToDirCache.getCachedDir(currentId);
          if (foundParent != null) {
            //currentId is in the list, but shouldn't be, if it is == foundParent
            // => remove it
            if (parentIds != null && !parentIds.isEmpty()) {
              parentIds.removeInt(parentIds.size() - 1);
            }
            else {
              parentIds = null;
            }
            return;
          }


          //MAYBE RC: despite all the efforts the root entry wasn't found/loaded -- it means VFS is corrupted,
          // and we should throw assertion (VFS rebuild?).
          // But (it seems) the method .findFileById() is used in an assumption it just returns null if 'incorrect'
          // fileId is passed in? -- so I keep that legacy behaviour (just log warning with diagnostic) until I'll
          // be sure all 'legal' cases are covered:
          logVeryDetailedErrorMessageAboutParentNotFound(currentId, fileId);
          return;
        }


        if (parentIds != null && (parentIds.size() % 128 == 0 && parentIds.contains(parentId))) {
          //circularity check is expensive: do it only once-in-a-while, as path became deep enough
          //  to start to suspect something may be wrong.
          throw new AssertionError("Cyclic parent-child relations: fileId: " + fileId + ", parentId: " + parentId + ", path: " + parentIds);
        }

        if (parentIds == null) {
          parentIds = new IntArrayList(IntArrayList.DEFAULT_INITIAL_CAPACITY);
        }
        parentIds.add(parentId);

        currentId = parentId;
      }
    }
private void ascendUntilCachedParent(int fileId)