]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
some kernel osd_client bits
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 22 Nov 2007 06:46:55 +0000 (06:46 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 22 Nov 2007 06:46:55 +0000 (06:46 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@2111 29311d96-e01e-0410-9327-a35deaab8ce9

trunk/ceph/kernel/Makefile
trunk/ceph/kernel/client.c
trunk/ceph/kernel/mds_client.c
trunk/ceph/kernel/mds_client.h
trunk/ceph/kernel/osd_client.c
trunk/ceph/kernel/osd_client.h

index 269f6b1da5dedd4af0048d2829dc11edbaa3bd17..3be93433beb56254704f1623f9d477e79f33e0ee 100644 (file)
@@ -9,4 +9,4 @@ ceph-objs := super.o inode.o \
        client.o \
        mds_client.o mdsmap.o \
        mon_client.o monmap.o \
-       osd_client.o 
+       osd_client.o crush/crush.o crush/mapper.o
index b1919f9677f964ec51fce73f0907d86927b58ff2..85007f781e9c8804a9d2b896278d1f1e520987e4 100644 (file)
@@ -59,6 +59,8 @@ static int mount(struct ceph_client *client, struct ceph_mount_args *args)
        int err;
        int attempts = 10;
        int which;
+       struct ceph_msg *open_msg;
+       struct ceph_msg *open_reply;
        
        client->mounting = 6;  /* FIXME don't wait for osd map, for now */
 
@@ -88,13 +90,15 @@ trymount:
                        goto trymount;
                return -EIO;
        }
+       ceph_msg_put(mount_msg);
 
        /* get handle for mount path */
-       /*err = ceph_mdsc_open_dir(&client->mdsc, CEPH_INO_ROOT, args->path);
-       if (err)
+       err = ceph_mdsc_do(&client->mdsc, CEPH_MDS_OP_OPEN,
+                          CEPH_INO_ROOT, args->path, 0, 0);
+       if (err < 0)
                return err;
-       */
-       
+
+       /* yay */
        return 0;
 }
 
index 961e9ad03b58826e079d3299fdc63f0c29dd9f70..fe27d302a723623b808990e63e411b57f51952c1 100644 (file)
@@ -328,6 +328,30 @@ retry:
        return reply;
 }
 
+int ceph_mdsc_do(struct ceph_mds_client *mdsc, int op, 
+                ceph_ino_t ino1, const char *path1, 
+                ceph_ino_t ino2, const char *path2)
+{
+       struct ceph_msg *req, *reply;
+       struct ceph_client_reply_head *head;
+       int ret;
+
+       req = ceph_mdsc_create_request_msg(&client->mdsc, op, ino1, path1, ino2, path2);
+       if (IS_ERR(req)) 
+               return PTR_ERR(req);
+
+       reply = ceph_mdsc_do_request(&client->mdsc, req, -1);
+       if (IS_ERR(reply))
+               return PTR_ERR(reply);
+
+       head = reply->front.iov_base;
+       ret = head->result;
+
+       ceph_msg_put(reply);
+       return ret;
+}
+
+
 
 void ceph_mdsc_handle_reply(struct ceph_mds_client *mdsc, struct ceph_msg *msg)
 {
index 67f3e9188b739ee6a66b7c4fa0286f709db68e4d..e1e29df87f1c9a7aeed5b69651418d145a3e8f8b 100644 (file)
@@ -61,9 +61,10 @@ struct ceph_mds_client {
        struct completion map_waiters;
 };
 
-extern void ceph_mdsc_init(struct ceph_mds_client *mdsc,
-                          struct ceph_client *client);
-extern void ceph_mdsc_submit_request(struct ceph_mds_client *mdsc, struct ceph_msg *msg, int mds);
+extern void ceph_mdsc_init(struct ceph_mds_client *mdsc, struct ceph_client *client);
+struct ceph_msg *ceph_mdsc_do_request(struct ceph_mds_client *mdsc, struct ceph_msg *msg, int mds);
+int ceph_mdsc_do(struct ceph_mds_client *mdsc, int op, ceph_ino_t ino1, const char *path1, ceph_ino_t ino2, const char *path2);
+
 extern void ceph_mdsc_handle_reply(struct ceph_mds_client *mdsc, struct ceph_msg *msg);
 extern void ceph_mdsc_handle_forward(struct ceph_mds_client *mdsc, struct ceph_msg *msg);
 extern void ceph_mdsc_handle_map(struct ceph_mds_client *mdsc, struct ceph_msg *msg);
index e4c88a5da12406e36de4e1fa21351f592e53f7ea..d605de180a7f188f55ae7952270d57f7d508cc62 100644 (file)
@@ -2,7 +2,7 @@
 #include <linux/slab.h>
 #include <linux/err.h>
 
-#include "../crush/crush.h"
+#include "crush/crush.h"
 #include "osd_client.h"
 #include "messenger.h"
 
index 11b56f90cf4bc2d461e9c0bf4f02848948e45a95..c8b1df80c8380739451b1e9d4f67e77732bc5d10 100644 (file)
@@ -4,6 +4,8 @@
 /* this will be equivalent to osdc/Objecter.h */
 
 #include <linux/ceph_fs.h>
+#include <linux/radix-tree.h>
+#include <linux/completion.h>
 
 struct ceph_msg;
 
@@ -23,9 +25,28 @@ struct ceph_osdmap {
        struct crush_map *crush;
 };
 
+enum {
+       REQUEST_ACK, REQUEST_SAFE
+};
+
+struct ceph_osd_request {
+       __u64 r_tid;
+       ceph_pg_t r_pgid;
+       int r_flags;
+
+       atomic_t r_ref;
+       struct ceph_msg *r_request;
+       struct completion r_completion;
+};
+
 struct ceph_osd_client {
        struct ceph_osdmap *osdmap;  /* current osd map */
 
+       __u64 last_tid;              /* id of last mds request */
+       struct radix_tree_root request_tree;  /* pending mds requests */
+
+       __u64 last_requested_map;
+       struct completion map_waiters;
 };
 
 extern void ceph_osdc_init(struct ceph_osd_client *osdc);