@@ -2010,7 +2010,7 @@ int lustre_shrink_msg(struct lustre_msg *msg, int segment,
u32 lustre_msg_size(u32 magic, int count, u32 *lengths);
u32 lustre_msg_size_v2(int count, u32 *lengths);
u32 lustre_packed_msg_size(struct lustre_msg *msg);
-u32 lustre_msg_early_size(void);
+extern u32 lustre_msg_early_size;
void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, u32 n, u32 min_size);
void *lustre_msg_buf(struct lustre_msg *m, u32 n, u32 minlen);
u32 lustre_msg_buflen(struct lustre_msg *m, u32 n);
@@ -397,7 +397,7 @@ static int mdc_save_lovea(struct ptlrpc_request *req, void *data, u32 size)
/* Get real repbuf allocated size as rounded up power of 2 */
repsize = size_roundup_power2(req->rq_replen +
- lustre_msg_early_size());
+ lustre_msg_early_size);
/* Estimate free space for DoM files in repbuf */
repsize_estimate = repsize - (req->rq_replen -
mdt_md_capsule_size +
@@ -415,7 +415,7 @@ static int mdc_save_lovea(struct ptlrpc_request *req, void *data, u32 size)
CDEBUG(D_INFO, "Increase repbuf by %d bytes, total: %d\n",
repsize, req->rq_replen);
repsize = size_roundup_power2(req->rq_replen +
- lustre_msg_early_size());
+ lustre_msg_early_size);
}
/* The only way to report real allocated repbuf size to the server
* is the lm_repsize but it must be set prior buffer allocation itself
@@ -72,14 +72,16 @@ u32 lustre_msg_hdr_size(u32 magic, u32 count)
}
}
+u32 lustre_msg_early_size;
+EXPORT_SYMBOL(lustre_msg_early_size);
+
/* early reply size */
-u32 lustre_msg_early_size(void)
+void lustre_msg_early_size_init(void)
{
u32 pblen = sizeof(struct ptlrpc_body);
- return lustre_msg_size(LUSTRE_MSG_MAGIC_V2, 1, &pblen);
+ lustre_msg_early_size = lustre_msg_size(LUSTRE_MSG_MAGIC_V2, 1, &pblen);
}
-EXPORT_SYMBOL(lustre_msg_early_size);
u32 lustre_msg_size_v2(int count, u32 *lengths)
{
@@ -244,6 +244,7 @@ void ptlrpc_fill_bulk_md(struct lnet_md *md, struct ptlrpc_bulk_desc *desc,
struct ptlrpc_reply_state *
lustre_get_emerg_rs(struct ptlrpc_service_part *svcpt);
void lustre_put_emerg_rs(struct ptlrpc_reply_state *rs);
+void lustre_msg_early_size_init(void); /* just for init */
/* pinger.c */
int ptlrpc_start_pinger(void);
@@ -85,6 +85,7 @@ static int __init ptlrpc_init(void)
mutex_init(&pinger_mutex);
mutex_init(&ptlrpcd_mutex);
ptlrpc_init_xid();
+ lustre_msg_early_size_init();
rc = libcfs_setup();
if (rc)
@@ -195,7 +195,7 @@ int null_alloc_repbuf(struct ptlrpc_sec *sec,
int msgsize)
{
/* add space for early replied */
- msgsize += lustre_msg_early_size();
+ msgsize += lustre_msg_early_size;
msgsize = size_roundup_power2(msgsize);
@@ -367,7 +367,7 @@ int null_authorize(struct ptlrpc_request *req)
if (likely(req->rq_packed_final)) {
if (lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT)
- req->rq_reply_off = lustre_msg_early_size();
+ req->rq_reply_off = lustre_msg_early_size;
} else {
u32 cksum;
@@ -996,7 +996,7 @@ int sptlrpc_plain_init(void)
u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, };
int rc;
- buflens[PLAIN_PACK_MSG_OFF] = lustre_msg_early_size();
+ buflens[PLAIN_PACK_MSG_OFF] = lustre_msg_early_size;
plain_at_offset = lustre_msg_size_v2(PLAIN_PACK_SEGMENTS, buflens);
rc = sptlrpc_register_policy(&plain_policy);