]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: kill msgr->parent, dead msg pool code, prepare_pages arg
authorSage Weil <sage@newdream.net>
Tue, 1 Sep 2009 23:16:53 +0000 (16:16 -0700)
committerSage Weil <sage@newdream.net>
Tue, 1 Sep 2009 23:16:53 +0000 (16:16 -0700)
src/kernel/messenger.c
src/kernel/messenger.h
src/kernel/osd_client.c
src/kernel/super.c

index c8fb3c5c907bc598703f25ed07d310ca5d5f6828..43903212bb1107d3022c185e2a8f1974e6d9980c 100644 (file)
@@ -586,11 +586,10 @@ out:
  */
 static int write_partial_msg_pages(struct ceph_connection *con)
 {
-       struct ceph_client *client = con->msgr->parent;
        struct ceph_msg *msg = con->out_msg;
        unsigned data_len = le32_to_cpu(msg->hdr.data_len);
        size_t len;
-       int crc = !ceph_test_opt(client, NOCRC);
+       int crc = con->msgr->nocrc;
        int ret;
 
        dout("write_partial_msg_pages %p msg %p page %d/%d offset %d\n",
@@ -926,8 +925,7 @@ static int read_partial_message(struct ceph_connection *con)
        int ret;
        int to, want, left;
        unsigned front_len, middle_len, data_len, data_off;
-       struct ceph_client *client = con->msgr->parent;
-       int datacrc = !ceph_test_opt(client, NOCRC);
+       int datacrc = con->msgr->nocrc;
 
        dout("read_partial_message con %p msg %p\n", con, m);
 
@@ -966,8 +964,7 @@ static int read_partial_message(struct ceph_connection *con)
        if (!con->in_msg) {
                dout("got hdr type %d front %d data %d\n", con->in_hdr.type,
                     con->in_hdr.front_len, con->in_hdr.data_len);
-               con->in_msg = con->ops->alloc_msg(con->msgr->parent,
-                                                 &con->in_hdr);
+               con->in_msg = con->ops->alloc_msg(con, &con->in_hdr);
                if (!con->in_msg) {
                        /* skip this message */
                        dout("alloc_msg returned NULL, skipping message\n");
@@ -1006,7 +1003,7 @@ static int read_partial_message(struct ceph_connection *con)
                                  m->middle->vec.iov_len < middle_len)) {
                if (m->middle == NULL) {
                        BUG_ON(!con->ops->alloc_middle);
-                       ret = con->ops->alloc_middle(con->msgr->parent, m);
+                       ret = con->ops->alloc_middle(con, m);
                        if (ret < 0) {
                                dout("alloc_middle failed, skipping payload\n");
                                con->in_base_pos = -middle_len - data_len
@@ -1043,7 +1040,7 @@ static int read_partial_message(struct ceph_connection *con)
                want = calc_pages_for(data_off & ~PAGE_MASK, data_len);
                ret = 0;
                BUG_ON(!con->ops->prepare_pages);
-               ret = con->ops->prepare_pages(con->msgr->parent, m, want);
+               ret = con->ops->prepare_pages(con, m, want);
                if (ret < 0) {
                        dout("%p prepare_pages failed, skipping payload\n", m);
                        con->in_base_pos = -data_len - sizeof(m->footer);
index 5df7236daeb5a232514a4621af25be36ee126376..28e3ad17621b20aaeb891e770fd8ec36cdb61887 100644 (file)
@@ -69,12 +69,11 @@ static inline const char *ceph_name_type_str(int t)
                le32_to_cpu((n).num)
 
 struct ceph_messenger {
-       void *parent;                    /* normally struct ceph_client * */
-
        struct ceph_entity_inst inst;    /* my name+address */
-
        struct page *zero_page;          /* used in certain error cases */
 
+       bool nocrc;
+
        /*
         * the global_seq counts connections i (attempt to) initiate
         * in order to disambiguate certain connect race conditions.
index 9832031a31367dc2a0ca7618fc3990e71ef033e2..72ca5a016dccc771da4a02836c52ebdeb702d19d 100644 (file)
@@ -930,13 +930,17 @@ static int prepare_pages(struct ceph_connection *con, struct ceph_msg *m,
                         int want)
 {
        struct ceph_osd *osd = con->private;
-       struct ceph_osd_client *osdc = osd->o_osdc;
+       struct ceph_osd_client *osdc;
        struct ceph_osd_reply_head *rhead = m->front.iov_base;
        struct ceph_osd_request *req;
        u64 tid;
        int ret = -1;
        int type = le16_to_cpu(m->hdr.type);
 
+       if (!osd)
+               return -1;
+       osdc = osd->o_osdc;
+
        dout("prepare_pages on msg %p want %d\n", m, want);
        if (unlikely(type != CEPH_MSG_OSD_OPREPLY))
                return -1;  /* hmm! */
index 852e67c108f5fe17492b23eabc9da2b7b72bec48..14485ec17ab886b4886233264831847ed1214963 100644 (file)
@@ -744,7 +744,7 @@ static int ceph_mount(struct ceph_client *client, struct vfsmount *mnt,
                        client->msgr = NULL;
                        goto out;
                }
-               client->msgr->parent = client;
+               client->msgr->nocrc = ceph_test_opt(client, NOCRC);
        }
 
        /* send mount request, and wait for mon, mds, and osd maps */
@@ -803,71 +803,6 @@ out:
        return err;
 }
 
-#if 0
-static struct ceph_msg_pool *get_pool(struct ceph_client *client, int type)
-{
-       switch (type) {
-       case CEPH_MSG_STATFS_REPLY:
-               return &client->msgpool_statfs_reply;
-       case CEPH_MSG_CLIENT_MOUNT_ACK:
-       case CEPH_MSG_CLIENT_UNMOUNT:
-       case CEPH_MSG_MDS_MAP:
-       case CEPH_MSG_CLIENT_SESSION:
-       case CEPH_MSG_CLIENT_REQUEST_FORWARD:
-       case CEPH_MSG_CLIENT_LEASE:
-       case CEPH_MSG_CLIENT_CAPS:
-       case CEPH_MSG_OSD_OPREPLY:
-       case CEPH_MSG_OSD_MAP:
-       case CEPH_MSG_CLIENT_REPLY:
-       case CEPH_MSG_CLIENT_SNAP:
-       default:
-               return NULL;
-       }
-}
-
-/*
- * Allocate incoming message.  Return message, or NULL to ignore message,
- * or error to fault connection.
- */
-struct ceph_msg *my_ceph_alloc_msg(struct ceph_connection *con,
-                               struct ceph_msg_header *hdr)
-{
-       struct ceph_client *client = p;
-       int type = le32_to_cpu(hdr->type);
-       int front_len = le32_to_cpu(hdr->front_len);
-       struct ceph_msg *msg;
-       struct ceph_msg_pool *pool;
-
-       pool = get_pool(client, type);
-       if (!pool) {
-               dout("alloc_msg type %d %s len %d (NO POOL)\n", type,
-                    ceph_msg_type_name(type), front_len);
-               msg = ceph_msg_new(type, front_len, 0, 0, NULL);
-               return msg;
-       }
-
-       dout("alloc_msg type %d %s pool %p front_len %d/%d\n", type,
-            ceph_msg_type_name(type), pool, front_len, pool->front_len);
-       msg = ceph_msgpool_get(pool);
-
-       /* verify front_len */
-       WARN_ON(front_len > msg->front_max);
-       if (front_len > msg->front_max) {
-               pr_err("ceph: need type %d len %d > pool len %d\n",
-                       type, front_len, msg->front_max);
-               ceph_msg_put(msg);
-               msg = ceph_msg_new(type, front_len, 0, 0, NULL);
-               if (!msg) {
-                       pr_err("ceph: unable to allocate msg type %d len %d\n",
-                              type, front_len);
-                       return ERR_PTR(-ENOMEM);
-               }
-       }
-       msg->front.iov_len = front_len;
-       return msg;
-}
-#endif
-
 static int ceph_set_super(struct super_block *s, void *data)
 {
        struct ceph_client *client = data;