Lines Matching refs:cache

886 	struct rb_root *root = &dso__data(dso)->cache;  in dso_cache__free()
891 struct dso_cache *cache; in dso_cache__free() local
893 cache = rb_entry(next, struct dso_cache, rb_node); in dso_cache__free()
894 next = rb_next(&cache->rb_node); in dso_cache__free()
895 rb_erase(&cache->rb_node, root); in dso_cache__free()
896 free(cache); in dso_cache__free()
903 const struct rb_root *root = &dso__data(dso)->cache; in __dso_cache__find()
906 struct dso_cache *cache; in __dso_cache__find() local
912 cache = rb_entry(parent, struct dso_cache, rb_node); in __dso_cache__find()
913 end = cache->offset + DSO__DATA_CACHE_SIZE; in __dso_cache__find()
915 if (offset < cache->offset) in __dso_cache__find()
920 return cache; in __dso_cache__find()
929 struct rb_root *root = &dso__data(dso)->cache; in dso_cache__insert()
932 struct dso_cache *cache; in dso_cache__insert() local
940 cache = rb_entry(parent, struct dso_cache, rb_node); in dso_cache__insert()
941 end = cache->offset + DSO__DATA_CACHE_SIZE; in dso_cache__insert()
943 if (offset < cache->offset) in dso_cache__insert()
954 cache = NULL; in dso_cache__insert()
957 return cache; in dso_cache__insert()
960 static ssize_t dso_cache__memcpy(struct dso_cache *cache, u64 offset, u8 *data, in dso_cache__memcpy() argument
963 u64 cache_offset = offset - cache->offset; in dso_cache__memcpy()
964 u64 cache_size = min(cache->size - cache_offset, size); in dso_cache__memcpy()
967 memcpy(data, cache->data + cache_offset, cache_size); in dso_cache__memcpy()
969 memcpy(cache->data + cache_offset, data, cache_size); in dso_cache__memcpy()
1003 struct dso_cache *cache; in dso_cache__populate() local
1006 cache = zalloc(sizeof(*cache) + DSO__DATA_CACHE_SIZE); in dso_cache__populate()
1007 if (!cache) { in dso_cache__populate()
1013 *ret = bpf_read(dso, cache_offset, cache->data); in dso_cache__populate()
1019 *ret = file_read(dso, machine, cache_offset, cache->data); in dso_cache__populate()
1022 free(cache); in dso_cache__populate()
1026 cache->offset = cache_offset; in dso_cache__populate()
1027 cache->size = *ret; in dso_cache__populate()
1029 old = dso_cache__insert(dso, cache); in dso_cache__populate()
1032 free(cache); in dso_cache__populate()
1033 cache = old; in dso_cache__populate()
1036 return cache; in dso_cache__populate()
1044 struct dso_cache *cache = __dso_cache__find(dso, offset); in dso_cache__find() local
1046 return cache ? cache : dso_cache__populate(dso, machine, offset, ret); in dso_cache__find()
1052 struct dso_cache *cache; in dso_cache_io() local
1055 cache = dso_cache__find(dso, machine, offset, &ret); in dso_cache_io()
1056 if (!cache) in dso_cache_io()
1059 return dso_cache__memcpy(cache, offset, data, size, out); in dso_cache_io()
1564 data->cache = RB_ROOT; in dso__new_id()