MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / fallocate

Method fallocate

fs/cache/persistent_cache/persistent_cache.cpp:283–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281}
282
283int PersistentCacheFile::fallocate(int mode, off_t offset, off_t len) {
284 if (m_local_file == nullptr) {
285 LOG_WARN("local path or size not set, ignore");
286 return 0;
287 }
288 if (len == -1) {
289 len = m_size - offset;
290 }
291 range_split_power2 rs(offset, len, m_fs->block_size);
292 auto aligned_offset = rs.aligned_begin_offset();
293 auto aligned_len = rs.aligned_length();
294 LOG_DEBUG("fallocate offset: `, len: `, aligned offset: `, aligned len: `", offset, len,
295 aligned_offset, aligned_len);
296
297 return m_local_file->trim(aligned_offset, aligned_len);
298}
299
300std::pair<off_t, size_t> PersistentCacheStore::query_refill_range(off_t offset, size_t size) {
301 off_t align_left = align_down(offset, m_fs->block_size);

Callers 4

evictMethod · 0.45
fallocateMethod · 0.45
single_file_ocf_cacheFunction · 0.45
multiple_files_testFunction · 0.45

Calls 3

aligned_begin_offsetMethod · 0.45
aligned_lengthMethod · 0.45
trimMethod · 0.45

Tested by 2

single_file_ocf_cacheFunction · 0.36
multiple_files_testFunction · 0.36