Sage Weil | 8fc91fd | 2009-10-06 11:31:13 -0700 | [diff] [blame] | 1 | #ifndef _FS_CEPH_MSGPOOL |
| 2 | #define _FS_CEPH_MSGPOOL |
| 3 | |
Sage Weil | d52f847 | 2010-04-01 15:23:14 -0700 | [diff] [blame^] | 4 | #include <linux/mempool.h> |
Sage Weil | 8fc91fd | 2009-10-06 11:31:13 -0700 | [diff] [blame] | 5 | #include "messenger.h" |
| 6 | |
| 7 | /* |
| 8 | * we use memory pools for preallocating messages we may receive, to |
| 9 | * avoid unexpected OOM conditions. |
| 10 | */ |
| 11 | struct ceph_msgpool { |
Sage Weil | d52f847 | 2010-04-01 15:23:14 -0700 | [diff] [blame^] | 12 | mempool_t *pool; |
Sage Weil | 8fc91fd | 2009-10-06 11:31:13 -0700 | [diff] [blame] | 13 | int front_len; /* preallocated payload size */ |
Sage Weil | 8fc91fd | 2009-10-06 11:31:13 -0700 | [diff] [blame] | 14 | }; |
| 15 | |
| 16 | extern int ceph_msgpool_init(struct ceph_msgpool *pool, |
| 17 | int front_len, int size, bool blocking); |
| 18 | extern void ceph_msgpool_destroy(struct ceph_msgpool *pool); |
Sage Weil | 8f3bc05 | 2009-10-14 17:36:07 -0700 | [diff] [blame] | 19 | extern struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *, |
| 20 | int front_len); |
Sage Weil | 8fc91fd | 2009-10-06 11:31:13 -0700 | [diff] [blame] | 21 | extern void ceph_msgpool_put(struct ceph_msgpool *, struct ceph_msg *); |
| 22 | |
| 23 | #endif |