2009-10-07 02:31:13 +08:00
|
|
|
#ifndef _FS_CEPH_MSGPOOL
|
|
|
|
#define _FS_CEPH_MSGPOOL
|
|
|
|
|
2010-04-02 06:23:14 +08:00
|
|
|
#include <linux/mempool.h>
|
2012-10-03 01:01:25 +08:00
|
|
|
#include <linux/ceph/messenger.h>
|
2009-10-07 02:31:13 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* we use memory pools for preallocating messages we may receive, to
|
|
|
|
* avoid unexpected OOM conditions.
|
|
|
|
*/
|
|
|
|
struct ceph_msgpool {
|
2010-04-25 00:56:35 +08:00
|
|
|
const char *name;
|
2010-04-02 06:23:14 +08:00
|
|
|
mempool_t *pool;
|
2012-07-10 05:22:34 +08:00
|
|
|
int type; /* preallocated message type */
|
2009-10-07 02:31:13 +08:00
|
|
|
int front_len; /* preallocated payload size */
|
|
|
|
};
|
|
|
|
|
2012-07-10 05:22:34 +08:00
|
|
|
extern int ceph_msgpool_init(struct ceph_msgpool *pool, int type,
|
2010-04-25 00:56:35 +08:00
|
|
|
int front_len, int size, bool blocking,
|
|
|
|
const char *name);
|
2009-10-07 02:31:13 +08:00
|
|
|
extern void ceph_msgpool_destroy(struct ceph_msgpool *pool);
|
2009-10-15 08:36:07 +08:00
|
|
|
extern struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *,
|
|
|
|
int front_len);
|
2009-10-07 02:31:13 +08:00
|
|
|
extern void ceph_msgpool_put(struct ceph_msgpool *, struct ceph_msg *);
|
|
|
|
|
|
|
|
#endif
|