init_completion(&req.completion);
/* allocate memory for reply */
- err = ceph_msgpool_resv(&monc->client->msgpool_statfs_reply, 1);
+ err = ceph_msgpool_resv(&monc->msgpool_statfs_reply, 1);
if (err)
return err;
mutex_lock(&monc->mutex);
radix_tree_delete(&monc->statfs_request_tree, req.tid);
monc->num_statfs_requests--;
- ceph_msgpool_resv(&monc->client->msgpool_statfs_reply, -1);
+ ceph_msgpool_resv(&monc->msgpool_statfs_reply, -1);
mutex_unlock(&monc->mutex);
if (!err)
int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
{
+ int err = 0;
+
dout("init\n");
memset(monc, 0, sizeof(*monc));
monc->client = cl;
monc->con = NULL;
+ /* msg pools */
+ err = ceph_msgpool_init(&monc->msgpool_mount_ack, 4096, 1, false);
+ if (err < 0)
+ goto out;
+ err = ceph_msgpool_init(&monc->msgpool_subscribe_ack, 8, 1, false);
+ if (err < 0)
+ goto out;
+ err = ceph_msgpool_init(&monc->msgpool_statfs_reply,
+ sizeof(struct ceph_mon_statfs_reply), 0, false);
+ if (err < 0)
+ goto out;
+
monc->cur_mon = -1;
monc->hunting = false; /* not really */
monc->sub_renew_after = jiffies;
monc->have_osdmap = 0;
monc->want_next_osdmap = 1;
monc->want_mount = true;
- return 0;
+out:
+ return err;
}
void ceph_monc_stop(struct ceph_mon_client *monc)
}
mutex_unlock(&monc->mutex);
+ ceph_msgpool_destroy(&monc->msgpool_mount_ack);
+ ceph_msgpool_destroy(&monc->msgpool_subscribe_ack);
+ ceph_msgpool_destroy(&monc->msgpool_statfs_reply);
+
kfree(monc->monmap);
}
int type = le32_to_cpu(hdr->type);
switch (type) {
+ case CEPH_MSG_CLIENT_MOUNT_ACK:
+ return ceph_msgpool_get(&monc->msgpool_mount_ack);
+ case CEPH_MSG_MON_SUBSCRIBE_ACK:
+ return ceph_msgpool_get(&monc->msgpool_subscribe_ack);
case CEPH_MSG_STATFS_REPLY:
- return ceph_msgpool_get(&monc->client->msgpool_statfs_reply);
+ return ceph_msgpool_get(&monc->msgpool_statfs_reply);
}
return ceph_alloc_msg(con, hdr);
}
#ifndef _FS_CEPH_MON_CLIENT_H
#define _FS_CEPH_MON_CLIENT_H
-#include "messenger.h"
#include <linux/completion.h>
#include <linux/radix-tree.h>
+#include "messenger.h"
+#include "msgpool.h"
+
struct ceph_client;
struct ceph_mount_args;
unsigned long sub_sent, sub_renew_after;
struct ceph_connection *con;
+ /* msg pools */
+ struct ceph_msg_pool msgpool_mount_ack;
+ struct ceph_msg_pool msgpool_subscribe_ack;
+ struct ceph_msg_pool msgpool_statfs_reply;
+
/* pending statfs requests */
struct radix_tree_root statfs_request_tree;
int num_statfs_requests;
if (client->trunc_wq == NULL)
goto fail;
- /* msg pools */
- /* preallocated at request time: */
- err = ceph_msgpool_init(&client->msgpool_statfs_reply,
- sizeof(struct ceph_mon_statfs_reply), 0, false);
- if (err < 0)
- goto fail;
-
/* subsystems */
err = ceph_monc_init(&client->monc, client);
if (err < 0)
if (client->wb_pagevec_pool)
mempool_destroy(client->wb_pagevec_pool);
- /* msg pools */
- ceph_msgpool_destroy(&client->msgpool_statfs_reply);
-
release_mount_args(&client->mount_args);
kfree(client);