2017-11-01 15:07:57 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2009-10-06 11:31:13 -07:00
|
|
|
#ifndef _FS_CEPH_MSGPOOL
|
|
|
|
|
#define _FS_CEPH_MSGPOOL
|
|
|
|
|
|
2010-04-01 15:23:14 -07:00
|
|
|
#include <linux/mempool.h>
|
2009-10-06 11:31:13 -07:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* we use memory pools for preallocating messages we may receive, to
|
|
|
|
|
* avoid unexpected OOM conditions.
|
|
|
|
|
*/
|
|
|
|
|
struct ceph_msgpool {
|
2010-04-24 09:56:35 -07:00
|
|
|
const char *name;
|
2010-04-01 15:23:14 -07:00
|
|
|
mempool_t *pool;
|
2012-07-09 14:22:34 -07:00
|
|
|
int type; /* preallocated message type */
|
2009-10-06 11:31:13 -07:00
|
|
|
int front_len; /* preallocated payload size */
|
2018-10-15 17:38:23 +02:00
|
|
|
int max_data_items;
|
2009-10-06 11:31:13 -07:00
|
|
|
};
|
|
|
|
|
|
2018-10-15 17:38:23 +02:00
|
|
|
int ceph_msgpool_init(struct ceph_msgpool *pool, int type,
|
|
|
|
|
int front_len, int max_data_items, int size,
|
|
|
|
|
const char *name);
|
2009-10-06 11:31:13 -07:00
|
|
|
extern void ceph_msgpool_destroy(struct ceph_msgpool *pool);
|
2018-10-15 17:38:23 +02:00
|
|
|
struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool, int front_len,
|
|
|
|
|
int max_data_items);
|
2009-10-06 11:31:13 -07:00
|
|
|
extern void ceph_msgpool_put(struct ceph_msgpool *, struct ceph_msg *);
|
|
|
|
|
|
|
|
|
|
#endif
|