Skip to content

Commit

Permalink
ceph: drop unnecessary msgpool for mon_client auth_reply
Browse files Browse the repository at this point in the history
Preallocate a single reply message that we can reuse instead.

Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Sage Weil committed May 17, 2010
1 parent 3143edd commit 6694d6b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
19 changes: 12 additions & 7 deletions fs/ceph/mon_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,16 +638,21 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
sizeof(struct ceph_mon_subscribe_ack), 1, false);
if (err < 0)
goto out_monmap;
err = ceph_msgpool_init(&monc->msgpool_auth_reply, 4096, 1, false);
if (err < 0)

monc->m_auth_reply = ceph_msg_new(CEPH_MSG_AUTH_REPLY, 4096, 0, 0,
NULL);
if (IS_ERR(monc->m_auth_reply)) {
err = PTR_ERR(monc->m_auth_reply);
monc->m_auth_reply = NULL;
goto out_pool;
}

monc->m_auth = ceph_msg_new(CEPH_MSG_AUTH, 4096, 0, 0, NULL);
monc->pending_auth = 0;
if (IS_ERR(monc->m_auth)) {
err = PTR_ERR(monc->m_auth);
monc->m_auth = NULL;
goto out_pool3;
goto out_auth_reply;
}

monc->cur_mon = -1;
Expand All @@ -665,8 +670,8 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
monc->want_next_osdmap = 1;
return 0;

out_pool3:
ceph_msgpool_destroy(&monc->msgpool_auth_reply);
out_auth_reply:
ceph_msg_put(monc->m_auth_reply);
out_pool:
ceph_msgpool_destroy(&monc->msgpool_subscribe_ack);
out_monmap:
Expand All @@ -692,8 +697,8 @@ void ceph_monc_stop(struct ceph_mon_client *monc)
ceph_auth_destroy(monc->auth);

ceph_msg_put(monc->m_auth);
ceph_msg_put(monc->m_auth_reply);
ceph_msgpool_destroy(&monc->msgpool_subscribe_ack);
ceph_msgpool_destroy(&monc->msgpool_auth_reply);

kfree(monc->monmap);
}
Expand Down Expand Up @@ -815,7 +820,7 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,
case CEPH_MSG_STATFS_REPLY:
return get_statfs_reply(con, hdr, skip);
case CEPH_MSG_AUTH_REPLY:
m = ceph_msgpool_get(&monc->msgpool_auth_reply, front_len);
m = ceph_msg_get(monc->m_auth_reply);
break;
case CEPH_MSG_MON_MAP:
case CEPH_MSG_MDS_MAP:
Expand Down
5 changes: 2 additions & 3 deletions fs/ceph/mon_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct ceph_mon_client {
struct delayed_work delayed_work;

struct ceph_auth_client *auth;
struct ceph_msg *m_auth;
struct ceph_msg *m_auth, *m_auth_reply;
int pending_auth;

bool hunting;
Expand All @@ -72,9 +72,8 @@ struct ceph_mon_client {
struct ceph_connection *con;
bool have_fsid;

/* msg pools */
/* msgs */
struct ceph_msgpool msgpool_subscribe_ack;
struct ceph_msgpool msgpool_auth_reply;

/* pending statfs requests */
struct rb_root statfs_request_tree;
Expand Down

0 comments on commit 6694d6b

Please sign in to comment.