diff options
Diffstat (limited to 'net/ceph/ceph_common.c')
-rw-r--r-- | net/ceph/ceph_common.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index 34b11ee8124e..67d7721d237e 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/statfs.h> | 16 | #include <linux/statfs.h> |
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/vmalloc.h> | ||
18 | #include <linux/nsproxy.h> | 19 | #include <linux/nsproxy.h> |
19 | #include <net/net_namespace.h> | 20 | #include <net/net_namespace.h> |
20 | 21 | ||
@@ -170,6 +171,25 @@ int ceph_compare_options(struct ceph_options *new_opt, | |||
170 | } | 171 | } |
171 | EXPORT_SYMBOL(ceph_compare_options); | 172 | EXPORT_SYMBOL(ceph_compare_options); |
172 | 173 | ||
174 | void *ceph_kvmalloc(size_t size, gfp_t flags) | ||
175 | { | ||
176 | if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) { | ||
177 | void *ptr = kmalloc(size, flags | __GFP_NOWARN); | ||
178 | if (ptr) | ||
179 | return ptr; | ||
180 | } | ||
181 | |||
182 | return __vmalloc(size, flags | __GFP_HIGHMEM, PAGE_KERNEL); | ||
183 | } | ||
184 | |||
185 | void ceph_kvfree(const void *ptr) | ||
186 | { | ||
187 | if (is_vmalloc_addr(ptr)) | ||
188 | vfree(ptr); | ||
189 | else | ||
190 | kfree(ptr); | ||
191 | } | ||
192 | |||
173 | 193 | ||
174 | static int parse_fsid(const char *str, struct ceph_fsid *fsid) | 194 | static int parse_fsid(const char *str, struct ceph_fsid *fsid) |
175 | { | 195 | { |
@@ -461,8 +481,8 @@ EXPORT_SYMBOL(ceph_client_id); | |||
461 | * create a fresh client instance | 481 | * create a fresh client instance |
462 | */ | 482 | */ |
463 | struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private, | 483 | struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private, |
464 | unsigned int supported_features, | 484 | u64 supported_features, |
465 | unsigned int required_features) | 485 | u64 required_features) |
466 | { | 486 | { |
467 | struct ceph_client *client; | 487 | struct ceph_client *client; |
468 | struct ceph_entity_addr *myaddr = NULL; | 488 | struct ceph_entity_addr *myaddr = NULL; |