diff options
| author | James Morris <jmorris@namei.org> | 2010-03-31 08:39:27 +1100 |
|---|---|---|
| committer | James Morris <jmorris@namei.org> | 2010-03-31 08:39:27 +1100 |
| commit | d25d6fa1a95f465ff1ec4458ca15e30b2c8dffec (patch) | |
| tree | 7362b182dedd825fc762ef7706830837e42943af /fs/ceph/buffer.h | |
| parent | 225a9be24d799aa16d543c31fb09f0c9ed1d9caa (diff) | |
| parent | 2eaa9cfdf33b8d7fb7aff27792192e0019ae8fc6 (diff) | |
| download | olio-linux-3.10-d25d6fa1a95f465ff1ec4458ca15e30b2c8dffec.tar.xz olio-linux-3.10-d25d6fa1a95f465ff1ec4458ca15e30b2c8dffec.zip | |
Merge branch 'master' into next
Diffstat (limited to 'fs/ceph/buffer.h')
| -rw-r--r-- | fs/ceph/buffer.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/fs/ceph/buffer.h b/fs/ceph/buffer.h new file mode 100644 index 00000000000..58d19014068 --- /dev/null +++ b/fs/ceph/buffer.h @@ -0,0 +1,39 @@ +#ifndef __FS_CEPH_BUFFER_H +#define __FS_CEPH_BUFFER_H + +#include <linux/kref.h> +#include <linux/mm.h> +#include <linux/vmalloc.h> +#include <linux/types.h> +#include <linux/uio.h> + +/* + * a simple reference counted buffer. + * + * use kmalloc for small sizes (<= one page), vmalloc for larger + * sizes. + */ +struct ceph_buffer { + struct kref kref; + struct kvec vec; + size_t alloc_len; + bool is_vmalloc; +}; + +extern struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp); +extern void ceph_buffer_release(struct kref *kref); + +static inline struct ceph_buffer *ceph_buffer_get(struct ceph_buffer *b) +{ + kref_get(&b->kref); + return b; +} + +static inline void ceph_buffer_put(struct ceph_buffer *b) +{ + kref_put(&b->kref, ceph_buffer_release); +} + +extern int ceph_decode_buffer(struct ceph_buffer **b, void **p, void *end); + +#endif |