msgpool.h 770 B

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