| 296 | } |
| 297 | |
| 298 | void PunchHole(int64_t offset, int64_t hole_size) { |
| 299 | DCHECK_EQ(offset % PAGE_SIZE, 0); |
| 300 | DCHECK_EQ(hole_size % PAGE_SIZE, 0); |
| 301 | if (UNLIKELY(readonly_.Load())) return; |
| 302 | // Hold the lock in shared mode to check if 'file_' is not closed already. |
| 303 | kudu::shared_lock<rw_spinlock> lock(lock_.get_lock()); |
| 304 | if (UNLIKELY(!file_ || readonly_.Load())) return; |
| 305 | DCHECK_LE(offset + hole_size, current_offset_.Load()); |
| 306 | kudu::Status status = file_->PunchHole(offset, hole_size); |
| 307 | if (UNLIKELY(!status.ok())) { |
| 308 | LOG(DFATAL) << Substitute("Failed to punch hole in $0 at offset $1 for $2 $3", |
| 309 | path_, offset, PrettyPrinter::PrintBytes(hole_size), status.ToString()); |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | Status Flush() { |
| 314 | std::unique_lock<percpu_rwlock> lock(lock_); |
no test coverage detected