summaryrefslogtreecommitdiff
path: root/fs/ceph/buffer.c
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2010-04-06 15:14:15 -0700
committerSage Weil <sage@newdream.net>2010-10-20 15:37:28 -0700
commit3d14c5d2b6e15c21d8e5467dc62d33127c23a644 (patch)
tree7d123c47847df9d1e865b6b78dc7da3fe739b704 /fs/ceph/buffer.c
parentae1533b62b3369e6ae32338f4a77d64d0e88f676 (diff)
downloadlinux-3.10-3d14c5d2b6e15c21d8e5467dc62d33127c23a644.tar.gz
linux-3.10-3d14c5d2b6e15c21d8e5467dc62d33127c23a644.tar.bz2
linux-3.10-3d14c5d2b6e15c21d8e5467dc62d33127c23a644.zip
ceph: factor out libceph from Ceph file system
This factors out protocol and low-level storage parts of ceph into a separate libceph module living in net/ceph and include/linux/ceph. This is mostly a matter of moving files around. However, a few key pieces of the interface change as well: - ceph_client becomes ceph_fs_client and ceph_client, where the latter captures the mon and osd clients, and the fs_client gets the mds client and file system specific pieces. - Mount option parsing and debugfs setup is correspondingly broken into two pieces. - The mon client gets a generic handler callback for otherwise unknown messages (mds map, in this case). - The basic supported/required feature bits can be expanded (and are by ceph_fs_client). No functional change, aside from some subtle error handling cases that got cleaned up in the refactoring process. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/buffer.c')
-rw-r--r--fs/ceph/buffer.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/fs/ceph/buffer.c b/fs/ceph/buffer.c
deleted file mode 100644
index cd39f17021d..00000000000
--- a/fs/ceph/buffer.c
+++ /dev/null
@@ -1,65 +0,0 @@
-
-#include "ceph_debug.h"
-
-#include <linux/slab.h>
-
-#include "buffer.h"
-#include "decode.h"
-
-struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp)
-{
- struct ceph_buffer *b;
-
- b = kmalloc(sizeof(*b), gfp);
- if (!b)
- return NULL;
-
- b->vec.iov_base = kmalloc(len, gfp | __GFP_NOWARN);
- if (b->vec.iov_base) {
- b->is_vmalloc = false;
- } else {
- b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL);
- if (!b->vec.iov_base) {
- kfree(b);
- return NULL;
- }
- b->is_vmalloc = true;
- }
-
- kref_init(&b->kref);
- b->alloc_len = len;
- b->vec.iov_len = len;
- dout("buffer_new %p\n", b);
- return b;
-}
-
-void ceph_buffer_release(struct kref *kref)
-{
- struct ceph_buffer *b = container_of(kref, struct ceph_buffer, kref);
-
- dout("buffer_release %p\n", b);
- if (b->vec.iov_base) {
- if (b->is_vmalloc)
- vfree(b->vec.iov_base);
- else
- kfree(b->vec.iov_base);
- }
- kfree(b);
-}
-
-int ceph_decode_buffer(struct ceph_buffer **b, void **p, void *end)
-{
- size_t len;
-
- ceph_decode_need(p, end, sizeof(u32), bad);
- len = ceph_decode_32(p);
- dout("decode_buffer len %d\n", (int)len);
- ceph_decode_need(p, end, len, bad);
- *b = ceph_buffer_new(len, GFP_NOFS);
- if (!*b)
- return -ENOMEM;
- ceph_decode_copy(p, (*b)->vec.iov_base, len);
- return 0;
-bad:
- return -EINVAL;
-}