From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Alexey Lyashkov <alexey.lyashkov@hpe.com>,
Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 10/13] lustre: ptlrpc: use a cached value
Date: Wed, 29 Dec 2021 09:51:24 -0500 [thread overview]
Message-ID: <1640789487-22279-11-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1640789487-22279-1-git-send-email-jsimmons@infradead.org>
From: Alexey Lyashkov <alexey.lyashkov@hpe.com>
Don't calculate a early reply size - use a cached,
as it don't changed after start
WC-bug-id: https://jira.whamcloud.com/browse/LU-15279
Lustre-commit: d6a3b0529d7da440a ("LU-15279 ptlrpc: use a cached value")
Signed-off-by: Alexey Lyashkov <alexey.lyashkov@hpe.com>
Reviewed-on: https://review.whamcloud.com/45661
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
fs/lustre/include/lustre_net.h | 2 +-
fs/lustre/mdc/mdc_locks.c | 4 ++--
fs/lustre/ptlrpc/pack_generic.c | 8 +++++---
fs/lustre/ptlrpc/ptlrpc_internal.h | 1 +
fs/lustre/ptlrpc/ptlrpc_module.c | 1 +
fs/lustre/ptlrpc/sec_null.c | 4 ++--
fs/lustre/ptlrpc/sec_plain.c | 2 +-
7 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/fs/lustre/include/lustre_net.h b/fs/lustre/include/lustre_net.h
index 78df59b..cf1bb7f 100644
--- a/fs/lustre/include/lustre_net.h
+++ b/fs/lustre/include/lustre_net.h
@@ -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);
diff --git a/fs/lustre/mdc/mdc_locks.c b/fs/lustre/mdc/mdc_locks.c
index aba94d1..b86d1b9 100644
--- a/fs/lustre/mdc/mdc_locks.c
+++ b/fs/lustre/mdc/mdc_locks.c
@@ -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
diff --git a/fs/lustre/ptlrpc/pack_generic.c b/fs/lustre/ptlrpc/pack_generic.c
index 23b36de..b41f51d 100644
--- a/fs/lustre/ptlrpc/pack_generic.c
+++ b/fs/lustre/ptlrpc/pack_generic.c
@@ -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)
{
diff --git a/fs/lustre/ptlrpc/ptlrpc_internal.h b/fs/lustre/ptlrpc/ptlrpc_internal.h
index f1f414c..d6edfde 100644
--- a/fs/lustre/ptlrpc/ptlrpc_internal.h
+++ b/fs/lustre/ptlrpc/ptlrpc_internal.h
@@ -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);
diff --git a/fs/lustre/ptlrpc/ptlrpc_module.c b/fs/lustre/ptlrpc/ptlrpc_module.c
index 8379bc4..7e29a91 100644
--- a/fs/lustre/ptlrpc/ptlrpc_module.c
+++ b/fs/lustre/ptlrpc/ptlrpc_module.c
@@ -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)
diff --git a/fs/lustre/ptlrpc/sec_null.c b/fs/lustre/ptlrpc/sec_null.c
index cf8f24b..a7241bd 100644
--- a/fs/lustre/ptlrpc/sec_null.c
+++ b/fs/lustre/ptlrpc/sec_null.c
@@ -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;
diff --git a/fs/lustre/ptlrpc/sec_plain.c b/fs/lustre/ptlrpc/sec_plain.c
index 0d1c591..d546722 100644
--- a/fs/lustre/ptlrpc/sec_plain.c
+++ b/fs/lustre/ptlrpc/sec_plain.c
@@ -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);
--
1.8.3.1
_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
next prev parent reply other threads:[~2021-12-29 14:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-29 14:51 [lustre-devel] [PATCH 00/13] lustre: port OpenSFS updates Dec 29, 2021 James Simmons
2021-12-29 14:51 ` [lustre-devel] [PATCH 01/13] lustre: sec: filename encryption - digest support James Simmons
2021-12-29 14:51 ` [lustre-devel] [PATCH 02/13] lnet: Revert "lnet: Lock primary NID logic" James Simmons
2021-12-29 14:51 ` [lustre-devel] [PATCH 03/13] lustre: quota: fallocate send UID/GID for quota James Simmons
2021-12-29 14:51 ` [lustre-devel] [PATCH 04/13] lustre: mdc: add client tunable to disable LSOM update James Simmons
2021-12-29 14:51 ` [lustre-devel] [PATCH 05/13] lustre: dne: dir migration in non-recursive mode James Simmons
2021-12-29 14:51 ` [lustre-devel] [PATCH 06/13] lustre: update version to 2.14.56 James Simmons
2021-12-29 14:51 ` [lustre-devel] [PATCH 07/13] lustre: sec: no encryption key migrate/extend/resync/split James Simmons
2021-12-29 14:51 ` [lustre-devel] [PATCH 08/13] lustre: sec: fix handling of encrypted file with long name James Simmons
2021-12-29 14:51 ` [lustre-devel] [PATCH 09/13] lnet: socklnd: expect two control connections maximum James Simmons
2021-12-29 14:51 ` James Simmons [this message]
2021-12-29 14:51 ` [lustre-devel] [PATCH 11/13] lnet: Race on discovery queue James Simmons
2021-12-29 14:51 ` [lustre-devel] [PATCH 12/13] lnet: o2iblnd: convert ibp_refcount to a kref James Simmons
2021-12-29 14:51 ` [lustre-devel] [PATCH 13/13] lustre: llite: set ra_pages of backing_dev_info with 0 James Simmons
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1640789487-22279-11-git-send-email-jsimmons@infradead.org \
--to=jsimmons@infradead.org \
--cc=adilger@whamcloud.com \
--cc=alexey.lyashkov@hpe.com \
--cc=green@whamcloud.com \
--cc=lustre-devel@lists.lustre.org \
--cc=neilb@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).