linux/fs/btrfs/lru_cache.h

/* SPDX-License-Identifier: GPL-2.0 */

#ifndef BTRFS_LRU_CACHE_H
#define BTRFS_LRU_CACHE_H

#include <linux/types.h>
#include <linux/maple_tree.h>
#include <linux/list.h>

/*
 * A cache entry. This is meant to be embedded in a structure of a user of
 * this module. Similar to how struct list_head and struct rb_node are used.
 *
 * Note: it should be embedded as the first element in a struct (offset 0), and
 * this module assumes it was allocated with kmalloc(), so it calls kfree() when
 * it needs to free an entry.
 */
struct btrfs_lru_cache_entry {};

struct btrfs_lru_cache {};

#define btrfs_lru_cache_for_each_entry_safe(cache, entry, tmp)

static inline struct btrfs_lru_cache_entry *btrfs_lru_cache_lru_entry(
					      struct btrfs_lru_cache *cache)
{}

void btrfs_lru_cache_init(struct btrfs_lru_cache *cache, unsigned int max_size);
struct btrfs_lru_cache_entry *btrfs_lru_cache_lookup(struct btrfs_lru_cache *cache,
						     u64 key, u64 gen);
int btrfs_lru_cache_store(struct btrfs_lru_cache *cache,
			  struct btrfs_lru_cache_entry *new_entry,
			  gfp_t gfp);
void btrfs_lru_cache_remove(struct btrfs_lru_cache *cache,
			    struct btrfs_lru_cache_entry *entry);
void btrfs_lru_cache_clear(struct btrfs_lru_cache *cache);

#endif