msgpool.h 811 B

123456789101112131415161718192021222324252627
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _FS_CEPH_MSGPOOL
  3. #define _FS_CEPH_MSGPOOL
  4. #include <linux/mempool.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. int max_data_items;
  15. };
  16. int ceph_msgpool_init(struct ceph_msgpool *pool, int type,
  17. int front_len, int max_data_items, int size,
  18. const char *name);
  19. extern void ceph_msgpool_destroy(struct ceph_msgpool *pool);
  20. struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool, int front_len,
  21. int max_data_items);
  22. extern void ceph_msgpool_put(struct ceph_msgpool *, struct ceph_msg *);
  23. #endif