client.o \
mds_client.o mdsmap.o \
mon_client.o monmap.o \
- osd_client.o
+ osd_client.o crush/crush.o crush/mapper.o
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 */
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;
}
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)
{
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);
#include <linux/slab.h>
#include <linux/err.h>
-#include "../crush/crush.h"
+#include "crush/crush.h"
#include "osd_client.h"
#include "messenger.h"
/* 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;
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);