Commit 4965fc38 authored by Ilya Dryomov's avatar Ilya Dryomov

libceph: nuke ceph_kvfree()

Use kvfree() from linux/mm.h instead, which is identical.  Also fix the
ceph_buffer comment: we will allocate with kmalloc() up to 32k - the
value of PAGE_ALLOC_COSTLY_ORDER, but that really is just an
implementation detail so don't mention it at all.
Signed-off-by: default avatarIlya Dryomov <idryomov@redhat.com>
parent 9280be24
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
/* /*
* a simple reference counted buffer. * a simple reference counted buffer.
* *
* use kmalloc for small sizes (<= one page), vmalloc for larger * use kmalloc for smaller sizes, vmalloc for larger sizes.
* sizes.
*/ */
struct ceph_buffer { struct ceph_buffer {
struct kref kref; struct kref kref;
......
...@@ -184,7 +184,6 @@ extern bool libceph_compatible(void *data); ...@@ -184,7 +184,6 @@ extern bool libceph_compatible(void *data);
extern const char *ceph_msg_type_name(int type); extern const char *ceph_msg_type_name(int type);
extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid);
extern void *ceph_kvmalloc(size_t size, gfp_t flags); extern void *ceph_kvmalloc(size_t size, gfp_t flags);
extern void ceph_kvfree(const void *ptr);
extern struct ceph_options *ceph_parse_options(char *options, extern struct ceph_options *ceph_parse_options(char *options,
const char *dev_name, const char *dev_name_end, const char *dev_name, const char *dev_name_end,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <linux/ceph/buffer.h> #include <linux/ceph/buffer.h>
#include <linux/ceph/decode.h> #include <linux/ceph/decode.h>
#include <linux/ceph/libceph.h> /* for ceph_kv{malloc,free} */ #include <linux/ceph/libceph.h> /* for ceph_kvmalloc */
struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp) struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp)
{ {
...@@ -35,7 +35,7 @@ void ceph_buffer_release(struct kref *kref) ...@@ -35,7 +35,7 @@ void ceph_buffer_release(struct kref *kref)
struct ceph_buffer *b = container_of(kref, struct ceph_buffer, kref); struct ceph_buffer *b = container_of(kref, struct ceph_buffer, kref);
dout("buffer_release %p\n", b); dout("buffer_release %p\n", b);
ceph_kvfree(b->vec.iov_base); kvfree(b->vec.iov_base);
kfree(b); kfree(b);
} }
EXPORT_SYMBOL(ceph_buffer_release); EXPORT_SYMBOL(ceph_buffer_release);
......
...@@ -184,14 +184,6 @@ void *ceph_kvmalloc(size_t size, gfp_t flags) ...@@ -184,14 +184,6 @@ void *ceph_kvmalloc(size_t size, gfp_t flags)
return __vmalloc(size, flags | __GFP_HIGHMEM, PAGE_KERNEL); return __vmalloc(size, flags | __GFP_HIGHMEM, PAGE_KERNEL);
} }
void ceph_kvfree(const void *ptr)
{
if (is_vmalloc_addr(ptr))
vfree(ptr);
else
kfree(ptr);
}
static int parse_fsid(const char *str, struct ceph_fsid *fsid) static int parse_fsid(const char *str, struct ceph_fsid *fsid)
{ {
......
...@@ -3288,7 +3288,7 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip) ...@@ -3288,7 +3288,7 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip)
static void ceph_msg_free(struct ceph_msg *m) static void ceph_msg_free(struct ceph_msg *m)
{ {
dout("%s %p\n", __func__, m); dout("%s %p\n", __func__, m);
ceph_kvfree(m->front.iov_base); kvfree(m->front.iov_base);
kmem_cache_free(ceph_msg_cache, m); kmem_cache_free(ceph_msg_cache, m);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment