diff options
author | Ilya Dryomov <ilya.dryomov@inktank.com> | 2014-01-09 13:08:21 -0500 |
---|---|---|
committer | Ilya Dryomov <ilya.dryomov@inktank.com> | 2014-01-26 05:34:23 -0500 |
commit | eeb0bed5572b1282009dfc2635604df5a35d1a02 (patch) | |
tree | 6b90792affac20b326daa59a59227766f746ee2f /include/linux/ceph/libceph.h | |
parent | 80213a84a96c3040f5824bce646a184d5dd3dd2b (diff) |
libceph: add ceph_kv{malloc,free}() and switch to them
Encapsulate kmalloc vs vmalloc memory allocation and freeing logic into
two helpers, ceph_kvmalloc() and ceph_kvfree(), and switch to them.
ceph_kvmalloc() kmalloc()'s a maximum of 8 pages, anything bigger is
vmalloc()'ed with __GFP_HIGHMEM set. This changes the existing
behaviour:
- for buffers (ceph_buffer_new()), from trying to kmalloc() everything
and using vmalloc() just as a fallback
- for messages (ceph_msg_new()), from going to vmalloc() for anything
bigger than a page
- for messages (ceph_msg_new()), from disallowing vmalloc() to use high
memory
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'include/linux/ceph/libceph.h')
-rw-r--r-- | include/linux/ceph/libceph.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index 7d704db60cbb..2f49aa4c4f7f 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h | |||
@@ -173,15 +173,18 @@ static inline int calc_pages_for(u64 off, u64 len) | |||
173 | (off >> PAGE_CACHE_SHIFT); | 173 | (off >> PAGE_CACHE_SHIFT); |
174 | } | 174 | } |
175 | 175 | ||
176 | extern struct kmem_cache *ceph_inode_cachep; | ||
177 | extern struct kmem_cache *ceph_cap_cachep; | ||
178 | extern struct kmem_cache *ceph_dentry_cachep; | ||
179 | extern struct kmem_cache *ceph_file_cachep; | ||
180 | |||
176 | /* ceph_common.c */ | 181 | /* ceph_common.c */ |
177 | extern bool libceph_compatible(void *data); | 182 | extern bool libceph_compatible(void *data); |
178 | 183 | ||
179 | extern const char *ceph_msg_type_name(int type); | 184 | extern const char *ceph_msg_type_name(int type); |
180 | extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); | 185 | extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); |
181 | extern struct kmem_cache *ceph_inode_cachep; | 186 | extern void *ceph_kvmalloc(size_t size, gfp_t flags); |
182 | extern struct kmem_cache *ceph_cap_cachep; | 187 | extern void ceph_kvfree(const void *ptr); |
183 | extern struct kmem_cache *ceph_dentry_cachep; | ||
184 | extern struct kmem_cache *ceph_file_cachep; | ||
185 | 188 | ||
186 | extern struct ceph_options *ceph_parse_options(char *options, | 189 | extern struct ceph_options *ceph_parse_options(char *options, |
187 | const char *dev_name, const char *dev_name_end, | 190 | const char *dev_name, const char *dev_name_end, |