Commit | Line | Data |
---|---|---|
8fc91fd8 SW |
1 | #ifndef _FS_CEPH_MSGPOOL |
2 | #define _FS_CEPH_MSGPOOL | |
3 | ||
d52f847a | 4 | #include <linux/mempool.h> |
a1ce3928 | 5 | #include <linux/ceph/messenger.h> |
8fc91fd8 SW |
6 | |
7 | /* | |
8 | * we use memory pools for preallocating messages we may receive, to | |
9 | * avoid unexpected OOM conditions. | |
10 | */ | |
11 | struct ceph_msgpool { | |
4f48280e | 12 | const char *name; |
d52f847a | 13 | mempool_t *pool; |
d50b409f | 14 | int type; /* preallocated message type */ |
8fc91fd8 | 15 | int front_len; /* preallocated payload size */ |
8fc91fd8 SW |
16 | }; |
17 | ||
d50b409f | 18 | extern int ceph_msgpool_init(struct ceph_msgpool *pool, int type, |
4f48280e SW |
19 | int front_len, int size, bool blocking, |
20 | const char *name); | |
8fc91fd8 | 21 | extern void ceph_msgpool_destroy(struct ceph_msgpool *pool); |
8f3bc053 SW |
22 | extern struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *, |
23 | int front_len); | |
8fc91fd8 SW |
24 | extern void ceph_msgpool_put(struct ceph_msgpool *, struct ceph_msg *); |
25 | ||
26 | #endif |