summaryrefslogtreecommitdiff
path: root/drivers/staging/ramster/zcache.h
blob: 81722b33b0872ac8a165f983af2cc1dd6494d8e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

/*
 * zcache.h
 *
 * Copyright (c) 2012, Dan Magenheimer, Oracle Corp.
 */

#ifndef _ZCACHE_H_
#define _ZCACHE_H_

struct zcache_preload {
	struct tmem_obj *obj;
	struct tmem_objnode *objnodes[OBJNODE_TREE_MAX_PATH];
};

struct tmem_pool;

#define MAX_POOLS_PER_CLIENT 16

#define MAX_CLIENTS 16
#define LOCAL_CLIENT ((uint16_t)-1)

struct zcache_client {
	struct tmem_pool *tmem_pools[MAX_POOLS_PER_CLIENT];
	bool allocated;
	atomic_t refcount;
};

extern struct tmem_pool *zcache_get_pool_by_id(uint16_t cli_id,
							uint16_t poolid);
extern void zcache_put_pool(struct tmem_pool *pool);

extern int zcache_put_page(int, int, struct tmem_oid *,
				uint32_t, void *,
				unsigned int, bool, int);
extern int zcache_get_page(int, int, struct tmem_oid *, uint32_t,
				void *, size_t *, bool, int);
extern int zcache_flush_page(int, int, struct tmem_oid *, uint32_t);
extern int zcache_flush_object(int, int, struct tmem_oid *);
extern void zcache_decompress_to_page(char *, unsigned int, struct page *);

#ifdef CONFIG_RAMSTER
extern void *zcache_pampd_create(char *, unsigned int, bool, int,
				struct tmem_handle *);
int zcache_autocreate_pool(unsigned int cli_id, unsigned int pool_id, bool eph);
#endif

#define MAX_POOLS_PER_CLIENT 16

#define MAX_CLIENTS 16
#define LOCAL_CLIENT ((uint16_t)-1)

#endif /* _ZCACHE_H_ */