public void reserveDiscardBruteForce(int freeListIx, DiscardContext ctx, int startHeaderIx) {
      if (data == null) return; // not allocated yet
      int headerStep = 1 << freeListIx;
      int headerIx = startHeaderIx;
      do {
        long reserveResult = reserveBlockContents(
            freeListIx, headerIx, ctx.victimHeaders, ctx.victimCount, true);
        int reservedCount = getFirstInt(reserveResult), moveSize = getSecondInt(reserveResult);
        if (moveSize == FAILED_TO_RESERVE) {
          for (int i = ctx.victimCount; i < ctx.victimCount + reservedCount; ++i) {
            abandonOneHeaderBeingMoved(ctx.victimHeaders[i], CasLog.Src.ABANDON_MOVE);
          }
        } else {
          ctx.victimCount += reservedCount;
          ctx.addBaseHeader(headerIx);
        }
        headerIx = getNextIx(headerIx, headers.length, headerStep);
      } while (ctx.remainingToFind > 0 && headerIx != startHeaderIx);
    }
Reserves the blocks to use to merge into larger blocks.
@param freeListIx The free list to reserve for.
@param startHeaderIx The header index at which to start looking (to avoid churn at 0).
llap-server/src/java/org/apache/hadoop/hive/llap/cache/BuddyAllocator.java