2 #include "ceph_debug.h"
5 struct ceph_buffer *ceph_buffer_new(gfp_t gfp)
9 b = kmalloc(sizeof(*b), gfp);
13 b->vec.iov_base = NULL;
19 void ceph_buffer_release(struct kref *kref)
21 struct ceph_buffer *b = container_of(kref, struct ceph_buffer, kref);
22 if (b->vec.iov_base) {
24 vfree(b->vec.iov_base);
26 kfree(b->vec.iov_base);
31 int ceph_buffer_alloc(struct ceph_buffer *b, int len, gfp_t gfp)
33 b->vec.iov_base = kmalloc(len, gfp | __GFP_NOWARN);
34 if (b->vec.iov_base) {
35 b->is_vmalloc = false;
37 b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL);