| 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 | 4f48280 | 2010-04-24 09:56:35 -0700 | [diff] [blame] | 12 | 	const char *name; | 
| Sage Weil | d52f847 | 2010-04-01 15:23:14 -0700 | [diff] [blame] | 13 | 	mempool_t *pool; | 
| Sage Weil | 9beb73f | 2012-07-09 14:22:34 -0700 | [diff] [blame] | 14 | 	int type;               /* preallocated message type */ | 
| Sage Weil | 8fc91fd | 2009-10-06 11:31:13 -0700 | [diff] [blame] | 15 | 	int front_len;          /* preallocated payload size */ | 
| Sage Weil | 8fc91fd | 2009-10-06 11:31:13 -0700 | [diff] [blame] | 16 | }; | 
 | 17 |  | 
| Sage Weil | 9beb73f | 2012-07-09 14:22:34 -0700 | [diff] [blame] | 18 | extern int ceph_msgpool_init(struct ceph_msgpool *pool, int type, | 
| Sage Weil | 4f48280 | 2010-04-24 09:56:35 -0700 | [diff] [blame] | 19 | 			     int front_len, int size, bool blocking, | 
 | 20 | 			     const char *name); | 
| Sage Weil | 8fc91fd | 2009-10-06 11:31:13 -0700 | [diff] [blame] | 21 | extern void ceph_msgpool_destroy(struct ceph_msgpool *pool); | 
| Sage Weil | 8f3bc05 | 2009-10-14 17:36:07 -0700 | [diff] [blame] | 22 | extern struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *, | 
 | 23 | 					 int front_len); | 
| Sage Weil | 8fc91fd | 2009-10-06 11:31:13 -0700 | [diff] [blame] | 24 | extern void ceph_msgpool_put(struct ceph_msgpool *, struct ceph_msg *); | 
 | 25 |  | 
 | 26 | #endif |