Lines Matching refs:cache

557 	struct rb_root *root = &dso->data.cache;  in dso_cache__free()
562 struct dso_cache *cache; in dso_cache__free() local
564 cache = rb_entry(next, struct dso_cache, rb_node); in dso_cache__free()
565 next = rb_next(&cache->rb_node); in dso_cache__free()
566 rb_erase(&cache->rb_node, root); in dso_cache__free()
567 free(cache); in dso_cache__free()
574 const struct rb_root *root = &dso->data.cache; in dso_cache__find()
577 struct dso_cache *cache; in dso_cache__find() local
583 cache = rb_entry(parent, struct dso_cache, rb_node); in dso_cache__find()
584 end = cache->offset + DSO__DATA_CACHE_SIZE; in dso_cache__find()
586 if (offset < cache->offset) in dso_cache__find()
591 return cache; in dso_cache__find()
600 struct rb_root *root = &dso->data.cache; in dso_cache__insert()
603 struct dso_cache *cache; in dso_cache__insert() local
611 cache = rb_entry(parent, struct dso_cache, rb_node); in dso_cache__insert()
612 end = cache->offset + DSO__DATA_CACHE_SIZE; in dso_cache__insert()
614 if (offset < cache->offset) in dso_cache__insert()
625 cache = NULL; in dso_cache__insert()
628 return cache; in dso_cache__insert()
632 dso_cache__memcpy(struct dso_cache *cache, u64 offset, in dso_cache__memcpy() argument
635 u64 cache_offset = offset - cache->offset; in dso_cache__memcpy()
636 u64 cache_size = min(cache->size - cache_offset, size); in dso_cache__memcpy()
638 memcpy(data, cache->data + cache_offset, cache_size); in dso_cache__memcpy()
646 struct dso_cache *cache; in dso_cache__read() local
653 cache = zalloc(sizeof(*cache) + DSO__DATA_CACHE_SIZE); in dso_cache__read()
654 if (!cache) in dso_cache__read()
673 ret = pread(dso->data.fd, cache->data, DSO__DATA_CACHE_SIZE, cache_offset); in dso_cache__read()
677 cache->offset = cache_offset; in dso_cache__read()
678 cache->size = ret; in dso_cache__read()
684 old = dso_cache__insert(dso, cache); in dso_cache__read()
687 free(cache); in dso_cache__read()
688 cache = old; in dso_cache__read()
691 ret = dso_cache__memcpy(cache, offset, data, size); in dso_cache__read()
695 free(cache); in dso_cache__read()
703 struct dso_cache *cache; in dso_cache_read() local
705 cache = dso_cache__find(dso, offset); in dso_cache_read()
706 if (cache) in dso_cache_read()
707 return dso_cache__memcpy(cache, offset, data, size); in dso_cache_read()
1050 dso->data.cache = RB_ROOT; in dso__new()