From: Sage Weil Date: Tue, 1 Sep 2009 23:16:53 +0000 (-0700) Subject: kclient: kill msgr->parent, dead msg pool code, prepare_pages arg X-Git-Tag: v0.14~62 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4ce269292b730e9a19e81602841837a262ff9e13;p=ceph.git kclient: kill msgr->parent, dead msg pool code, prepare_pages arg --- diff --git a/src/kernel/messenger.c b/src/kernel/messenger.c index c8fb3c5c907b..43903212bb11 100644 --- a/src/kernel/messenger.c +++ b/src/kernel/messenger.c @@ -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); diff --git a/src/kernel/messenger.h b/src/kernel/messenger.h index 5df7236daeb5..28e3ad17621b 100644 --- a/src/kernel/messenger.h +++ b/src/kernel/messenger.h @@ -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. diff --git a/src/kernel/osd_client.c b/src/kernel/osd_client.c index 9832031a3136..72ca5a016dcc 100644 --- a/src/kernel/osd_client.c +++ b/src/kernel/osd_client.c @@ -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! */ diff --git a/src/kernel/super.c b/src/kernel/super.c index 852e67c108f5..14485ec17ab8 100644 --- a/src/kernel/super.c +++ b/src/kernel/super.c @@ -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;