]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
missing pieces
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 16 Nov 2007 18:44:26 +0000 (18:44 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 16 Nov 2007 18:44:26 +0000 (18:44 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@2074 29311d96-e01e-0410-9327-a35deaab8ce9

trunk/ceph/kernel/Makefile
trunk/ceph/kernel/client.c
trunk/ceph/kernel/mon_client.c [new file with mode: 0644]
trunk/ceph/kernel/monmap.c [new file with mode: 0644]
trunk/ceph/kernel/osd_client.c [new file with mode: 0644]
trunk/ceph/kernel/osd_client.h

index 7e87822352fd56caaa14f080f9cdef85461f0ab9..269f6b1da5dedd4af0048d2829dc11edbaa3bd17 100644 (file)
@@ -8,4 +8,5 @@ ceph-objs := super.o inode.o \
        bufferlist.o ktcp.o messenger.o \
        client.o \
        mds_client.o mdsmap.o \
-       mon_client.o monmap.o
+       mon_client.o monmap.o \
+       osd_client.o 
index 99d338c50b13c5c5ed760128ce2501c3299c45e9..451ae1a804b867472f835068fa18e7bfd860bed6 100644 (file)
@@ -44,7 +44,7 @@ static int mount(struct ceph_client *client, struct ceph_mount_args *args)
        int attempts = 10;
        int which;
        
-       client->mounting = 7;
+       client->mounting = 6;  /* FIXME don't wait for osd map, for now */
 
        /* send mount request */
        mount_msg = ceph_msg_new(CEPH_MSG_CLIENT_MOUNT, 0, 0, 0);
diff --git a/trunk/ceph/kernel/mon_client.c b/trunk/ceph/kernel/mon_client.c
new file mode 100644 (file)
index 0000000..3019ba6
--- /dev/null
@@ -0,0 +1,16 @@
+
+#include <linux/types.h>
+#include <linux/random.h>
+#include "mon_client.h"
+
+
+static int pick_mon(struct ceph_mon_client *monc, int notmon)
+{
+       if (notmon < 0 && monc->last_mon >= 0)
+               return monc->last_mon;
+       monc->last_mon = get_random_int() % monc->monmap.num_mon;
+       return monc->last_mon;
+}
+
+
+
diff --git a/trunk/ceph/kernel/monmap.c b/trunk/ceph/kernel/monmap.c
new file mode 100644 (file)
index 0000000..05765ef
--- /dev/null
@@ -0,0 +1,26 @@
+#include <linux/slab.h>
+#include "monmap.h"
+#include "messenger.h"
+
+int ceph_monmap_decode(struct ceph_monmap *m, void **p, void *end)
+{
+       int err;
+
+       if ((err = ceph_decode_64(p, end, &m->epoch)) < 0)
+               return err;
+       if ((err = ceph_decode_32(p, end, &m->num_mon)) < 0)
+               return err;
+
+       m->mon_inst = kmalloc(m->num_mon*sizeof(*m->mon_inst), GFP_KERNEL);
+       if (m->mon_inst == NULL)
+               return -ENOMEM;
+       if ((err = ceph_decode_copy(p, end, m->mon_inst, m->num_mon*sizeof(m->mon_inst[0]))) < 0)
+               goto bad;
+
+       return 0;
+
+bad:
+       kfree(m->mon_inst);
+       m->mon_inst = 0;
+       return err;
+}
diff --git a/trunk/ceph/kernel/osd_client.c b/trunk/ceph/kernel/osd_client.c
new file mode 100644 (file)
index 0000000..2d5b493
--- /dev/null
@@ -0,0 +1,15 @@
+
+#include "osd_client.h"
+#include "messenger.h"
+
+
+void ceph_osdc_init(struct ceph_osd_client *osdc)
+{
+       osdc->osdmap = NULL;
+}
+
+void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg)
+{
+       dout(1, "ceph_osdc_handle_map - implement me\n");
+       ceph_msg_put(msg);
+}
index 6f643646b9427ce7cf1bc8ae7832764c95c7dd5d..a8e3d64272733b04386e366bcfe5589adc660272 100644 (file)
@@ -7,10 +7,10 @@
 #include "osdmap.h"
 */
 struct ceph_osdmap;
-
+struct ceph_msg;
 
 struct ceph_osd_client {
-       struct ceph_osdmap *osdmap;  /* osd map */
+       struct ceph_osdmap *osdmap;  /* current osd map */
 
 };