^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2006-2007 Silicon Graphics, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef __XFS_MRU_CACHE_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define __XFS_MRU_CACHE_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) struct xfs_mru_cache;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct xfs_mru_cache_elem {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) struct list_head list_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) unsigned long key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) /* Function pointer type for callback to free a client's data pointer. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) typedef void (*xfs_mru_cache_free_func_t)(void *, struct xfs_mru_cache_elem *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) int xfs_mru_cache_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) void xfs_mru_cache_uninit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) int xfs_mru_cache_create(struct xfs_mru_cache **mrup, void *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) unsigned int lifetime_ms, unsigned int grp_count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) xfs_mru_cache_free_func_t free_func);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) void xfs_mru_cache_destroy(struct xfs_mru_cache *mru);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) int xfs_mru_cache_insert(struct xfs_mru_cache *mru, unsigned long key,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct xfs_mru_cache_elem *elem);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct xfs_mru_cache_elem *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) xfs_mru_cache_remove(struct xfs_mru_cache *mru, unsigned long key);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) void xfs_mru_cache_delete(struct xfs_mru_cache *mru, unsigned long key);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct xfs_mru_cache_elem *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) xfs_mru_cache_lookup(struct xfs_mru_cache *mru, unsigned long key);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) void xfs_mru_cache_done(struct xfs_mru_cache *mru);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #endif /* __XFS_MRU_CACHE_H__ */