/- uninline frags
/- uninline string hash
-
+- document data structures
+- audit all inline in kclient
+- document on-wire protocol
+- ceph_buffer fixes
bugs
- mislinked directory?
*/
static unsigned long ceph_end_name_hash(unsigned long hash)
{
- return (unsigned int) hash;
+ return hash & 0xffffffff;
}
/* Compute the hash for a name string. */
* whenever the wire protocol changes. try to keep this string length
* constant.
*/
-#define CEPH_BANNER "ceph v019"
+#define CEPH_BANNER "ceph v020"
#define CEPH_BANNER_MAX_LEN 30
#define CEPH_MSGR_TAG_RETRY_GLOBAL 5 /* server->client + gseq: try again
with higher gseq */
#define CEPH_MSGR_TAG_CLOSE 6 /* closing pipe */
-#define CEPH_MSGR_TAG_MSG 10 /* message */
-#define CEPH_MSGR_TAG_ACK 11 /* message ack */
-#define CEPH_MSGR_TAG_KEEPALIVE 12 /* just a keepalive byte! */
-#define CEPH_MSGR_TAG_BADPROTOVER 13 /* bad protocol version */
+#define CEPH_MSGR_TAG_MSG 7 /* message */
+#define CEPH_MSGR_TAG_ACK 8 /* message ack */
+#define CEPH_MSGR_TAG_KEEPALIVE 9 /* just a keepalive byte! */
+#define CEPH_MSGR_TAG_BADPROTOVER 10 /* bad protocol version */
/*
#define __RADOS_H
/*
- * Data types for RADOS, the distributed object storage layer used by
- * the Ceph file system.
+ * Data types for the Ceph distributed object storage layer RADOS
+ * (Reliable Autonomic Distributed Object Store).
*/
#include "msgr.h"
* placement group.
* we encode this into one __le64.
*/
-#define CEPH_PG_TYPE_REP 1
-#define CEPH_PG_TYPE_RAID4 2
union ceph_pg {
__u64 pg64;
struct {
__s16 preferred; /* preferred primary osd */
__u16 ps; /* placement seed */
__u32 pool; /* implies crush ruleset */
- } pg;
+ } __attribute__ ((packed)) pg;
} __attribute__ ((packed));
-#define ceph_pg_is_rep(pg) ((pg).pg.type == CEPH_PG_TYPE_REP)
-#define ceph_pg_is_raid4(pg) ((pg).pg.type == CEPH_PG_TYPE_RAID4)
-
/*
* pg_pool is a set of pgs storing a pool of objects
*
*
* lpgp_num -- as above.
*/
+#define CEPH_PG_TYPE_REP 1
+#define CEPH_PG_TYPE_RAID4 2
struct ceph_pg_pool {
__u8 type;
__u8 size;
ceph-objs := super.o inode.o dir.o file.o addr.o ioctl.o \
export.o caps.o snap.o xattr.o \
- messenger.o msgpool.o \
+ messenger.o msgpool.o buffer.o \
mds_client.o mdsmap.o \
mon_client.o \
osd_client.o osdmap.o crush/crush.o crush/mapper.o \
--- /dev/null
+
+#include "ceph_debug.h"
+#include "buffer.h"
+
+struct ceph_buffer *ceph_buffer_new(gfp_t gfp)
+{
+ struct ceph_buffer *b;
+
+ b = kmalloc(sizeof(*b), gfp);
+ if (!b)
+ return NULL;
+ atomic_set(&b->nref, 1);
+ b->vec.iov_base = NULL;
+ b->vec.iov_len = 0;
+ b->alloc_len = 0;
+ return b;
+}
+
+int ceph_buffer_alloc(struct ceph_buffer *b, int len, gfp_t gfp)
+{
+ if (len <= PAGE_SIZE) {
+ b->vec.iov_base = kmalloc(len, gfp);
+ b->is_vmalloc = false;
+ } else {
+ b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL);
+ b->is_vmalloc = true;
+ }
+ if (!b->vec.iov_base)
+ return -ENOMEM;
+ b->alloc_len = len;
+ b->vec.iov_len = len;
+ return 0;
+}
+
#define __FS_CEPH_BUFFER_H
#include <linux/mm.h>
-#include <linux/types.h>
#include <linux/vmalloc.h>
-
-#include "ceph_debug.h"
+#include <linux/types.h>
+#include <linux/uio.h>
/*
* a simple reference counted buffer.
bool is_vmalloc;
};
-static inline struct ceph_buffer *ceph_buffer_new(gfp_t gfp)
-{
- struct ceph_buffer *b;
-
- b = kmalloc(sizeof(*b), gfp);
- if (!b)
- return NULL;
- atomic_set(&b->nref, 1);
- b->vec.iov_base = NULL;
- b->vec.iov_len = 0;
- b->alloc_len = 0;
- return b;
-}
-
-static inline int ceph_buffer_alloc(struct ceph_buffer *b, int len, gfp_t gfp)
-{
- if (len <= PAGE_SIZE) {
- b->vec.iov_base = kmalloc(len, gfp);
- b->is_vmalloc = false;
- } else {
- b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL);
- b->is_vmalloc = true;
- }
- if (!b->vec.iov_base)
- return -ENOMEM;
- b->alloc_len = len;
- b->vec.iov_len = len;
- return 0;
-}
+struct ceph_buffer *ceph_buffer_new(gfp_t gfp);
+int ceph_buffer_alloc(struct ceph_buffer *b, int len, gfp_t gfp);
static inline struct ceph_buffer *ceph_buffer_get(struct ceph_buffer *b)
{
static inline struct ceph_buffer *ceph_buffer_new_alloc(int len, gfp_t gfp)
{
- struct ceph_buffer *b = ceph_buffer_new(gfp);
+ struct ceph_buffer *b = ceph_buffer_new(gfp);
- if (b && ceph_buffer_alloc(b, len, gfp) < 0) {
- ceph_buffer_put(b);
- b = NULL;
- }
- return b;
+ if (b && ceph_buffer_alloc(b, len, gfp) < 0) {
+ ceph_buffer_put(b);
+ b = NULL;
+ }
+ return b;
}
#endif
struct crush_map *crush;
};
-/* file layout helpers */
+/*
+ * file layout helpers
+ */
#define ceph_file_layout_su(l) ((__s32)le32_to_cpu((l).fl_stripe_unit))
#define ceph_file_layout_stripe_count(l) \
((__s32)le32_to_cpu((l).fl_stripe_count))
#define ceph_file_layout_pg_pool(l) \
((__s32)le32_to_cpu((l).fl_pg_pool))
-#define ceph_file_layout_stripe_width(l) (le32_to_cpu((l).fl_stripe_unit) * \
- le32_to_cpu((l).fl_stripe_count))
+static inline unsigned ceph_file_layout_stripe_width(struct ceph_file_layout *l)
+{
+ return le32_to_cpu(l->fl_stripe_unit) *
+ le32_to_cpu(l->fl_stripe_count);
+}
/* "period" == bytes before i start on a new set of objects */
-#define ceph_file_layout_period(l) (le32_to_cpu((l).fl_object_size) * \
- le32_to_cpu((l).fl_stripe_count))
+static inline unsigned ceph_file_layout_period(struct ceph_file_layout *l)
+{
+ return le32_to_cpu(l->fl_object_size) *
+ le32_to_cpu(l->fl_stripe_count);
+}
+
static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd)
{