Lines Matching defs:cache
838 struct rb_root *root = &dso->data.cache;
843 struct dso_cache *cache;
845 cache = rb_entry(next, struct dso_cache, rb_node);
846 next = rb_next(&cache->rb_node);
847 rb_erase(&cache->rb_node, root);
848 free(cache);
855 const struct rb_root *root = &dso->data.cache;
858 struct dso_cache *cache;
864 cache = rb_entry(parent, struct dso_cache, rb_node);
865 end = cache->offset + DSO__DATA_CACHE_SIZE;
867 if (offset < cache->offset)
872 return cache;
881 struct rb_root *root = &dso->data.cache;
884 struct dso_cache *cache;
892 cache = rb_entry(parent, struct dso_cache, rb_node);
893 end = cache->offset + DSO__DATA_CACHE_SIZE;
895 if (offset < cache->offset)
906 cache = NULL;
909 return cache;
912 static ssize_t dso_cache__memcpy(struct dso_cache *cache, u64 offset, u8 *data,
915 u64 cache_offset = offset - cache->offset;
916 u64 cache_size = min(cache->size - cache_offset, size);
919 memcpy(data, cache->data + cache_offset, cache_size);
921 memcpy(cache->data + cache_offset, data, cache_size);
955 struct dso_cache *cache;
958 cache = zalloc(sizeof(*cache) + DSO__DATA_CACHE_SIZE);
959 if (!cache) {
965 *ret = bpf_read(dso, cache_offset, cache->data);
971 *ret = file_read(dso, machine, cache_offset, cache->data);
974 free(cache);
978 cache->offset = cache_offset;
979 cache->size = *ret;
981 old = dso_cache__insert(dso, cache);
984 free(cache);
985 cache = old;
988 return cache;
996 struct dso_cache *cache = __dso_cache__find(dso, offset);
998 return cache ? cache : dso_cache__populate(dso, machine, offset, ret);
1004 struct dso_cache *cache;
1007 cache = dso_cache__find(dso, machine, offset, &ret);
1008 if (!cache)
1011 return dso_cache__memcpy(cache, offset, data, size, out);
1017 * by cached data. Writes update the cache only, not the backing file.
1070 pr_err("dso cache fstat failed: %s\n",
1169 * dso__data_write_cache_offs - Write data to dso data cache at file offset
1176 * Write into the dso file data cache, but do not change the file itself.
1190 * dso__data_write_cache_addr - Write data to dso data cache at dso address
1197 * External interface to write into the dso file data cache, but do not change
1326 dso->data.cache = RB_ROOT;