Rounds up to the smallest unit of allocation in a scratch file that will fit 'bytes'.
| 1393 | // Rounds up to the smallest unit of allocation in a scratch file |
| 1394 | // that will fit 'bytes'. |
| 1395 | static int64_t RoundUpToScratchRangeSize(bool punch_holes, int64_t bytes) { |
| 1396 | if (punch_holes) { |
| 1397 | // Round up to a typical disk block size - 4KB that that hole punching can always |
| 1398 | // free the backing storage for the entire range. |
| 1399 | return BitUtil::RoundUpToPowerOf2(bytes, TmpFileMgr::HOLE_PUNCH_BLOCK_SIZE_BYTES); |
| 1400 | } else { |
| 1401 | // We recycle scratch ranges, which must be positive power-of-two sizes. |
| 1402 | return max<int64_t>(1L, BitUtil::RoundUpToPowerOfTwo(bytes)); |
| 1403 | } |
| 1404 | } |
| 1405 | |
| 1406 | void TmpFileGroup::UpdateScratchSpaceMetrics(int64_t num_bytes, bool is_remote) { |
| 1407 | scratch_space_bytes_used_counter_->Add(num_bytes); |
no outgoing calls
no test coverage detected