msgpool.h 736 B

12345678910111213141516171819202122232425
  1. #ifndef _FS_CEPH_MSGPOOL
  2. #define _FS_CEPH_MSGPOOL
  3. #include <linux/mempool.h>
  4. /*
  5. * we use memory pools for preallocating messages we may receive, to
  6. * avoid unexpected OOM conditions.
  7. */
  8. struct ceph_msgpool {
  9. const char *name;
  10. mempool_t *pool;
  11. int type; /* preallocated message type */
  12. int front_len; /* preallocated payload size */
  13. };
  14. extern int ceph_msgpool_init(struct ceph_msgpool *pool, int type,
  15. int front_len, int size, bool blocking,
  16. const char *name);
  17. extern void ceph_msgpool_destroy(struct ceph_msgpool *pool);
  18. extern struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *,
  19. int front_len);
  20. extern void ceph_msgpool_put(struct ceph_msgpool *, struct ceph_msg *);
  21. #endif