From: "J. Bruce Fields" <bfields@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: "J. Bruce Fields" <bfields@citi.umich.edu>
Subject: [PATCH 06/16] nfsd4: remove separate cb_args struct
Date: Thu, 30 Sep 2010 12:19:03 -0400 [thread overview]
Message-ID: <1285863553-8945-7-git-send-email-bfields@redhat.com> (raw)
In-Reply-To: <1285863553-8945-1-git-send-email-bfields@redhat.com>
From: J. Bruce Fields <bfields@citi.umich.edu>
I don't see the point of the separate struct. It seems to just be
getting in the way.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
---
fs/nfsd/nfs4callback.c | 45 ++++++++++++++++++++++-----------------------
fs/nfsd/state.h | 10 +++-------
2 files changed, 25 insertions(+), 30 deletions(-)
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 3b06212..384a990 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -247,7 +247,7 @@ encode_cb_recall(struct xdr_stream *xdr, struct nfs4_delegation *dp,
}
static void
-encode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_args *args,
+encode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_callback *cb,
struct nfs4_cb_compound_hdr *hdr)
{
__be32 *p;
@@ -258,8 +258,8 @@ encode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_args *args,
RESERVE_SPACE(1 + NFS4_MAX_SESSIONID_LEN + 20);
WRITE32(OP_CB_SEQUENCE);
- WRITEMEM(args->args_clp->cl_sessionid.data, NFS4_MAX_SESSIONID_LEN);
- WRITE32(args->args_clp->cl_cb_seq_nr);
+ WRITEMEM(cb->cb_clp->cl_sessionid.data, NFS4_MAX_SESSIONID_LEN);
+ WRITE32(cb->cb_clp->cl_cb_seq_nr);
WRITE32(0); /* slotid, always 0 */
WRITE32(0); /* highest slotid always 0 */
WRITE32(0); /* cachethis always 0 */
@@ -279,18 +279,18 @@ nfs4_xdr_enc_cb_null(struct rpc_rqst *req, __be32 *p)
static int
nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, __be32 *p,
- struct nfsd4_cb_args *rpc_args)
+ struct nfsd4_callback *cb)
{
struct xdr_stream xdr;
- struct nfs4_delegation *args = rpc_args->args_op;
+ struct nfs4_delegation *args = cb->cb_op;
struct nfs4_cb_compound_hdr hdr = {
.ident = args->dl_ident,
- .minorversion = rpc_args->args_minorversion,
+ .minorversion = cb->cb_minorversion,
};
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_cb_compound_hdr(&xdr, &hdr);
- encode_cb_sequence(&xdr, rpc_args, &hdr);
+ encode_cb_sequence(&xdr, cb, &hdr);
encode_cb_recall(&xdr, args, &hdr);
encode_cb_nops(&hdr);
return 0;
@@ -338,7 +338,7 @@ decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
* with a single slot.
*/
static int
-decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_args *res,
+decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_callback *cb,
struct rpc_rqst *rqstp)
{
struct nfs4_sessionid id;
@@ -346,7 +346,7 @@ decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_args *res,
u32 dummy;
__be32 *p;
- if (res->args_minorversion == 0)
+ if (cb->cb_minorversion == 0)
return 0;
status = decode_cb_op_hdr(xdr, OP_CB_SEQUENCE);
@@ -362,13 +362,13 @@ decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_args *res,
READ_BUF(NFS4_MAX_SESSIONID_LEN + 16);
memcpy(id.data, p, NFS4_MAX_SESSIONID_LEN);
p += XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN);
- if (memcmp(id.data, res->args_clp->cl_sessionid.data,
+ if (memcmp(id.data, cb->cb_clp->cl_sessionid.data,
NFS4_MAX_SESSIONID_LEN)) {
dprintk("%s Invalid session id\n", __func__);
goto out;
}
READ32(dummy);
- if (dummy != res->args_clp->cl_cb_seq_nr) {
+ if (dummy != cb->cb_clp->cl_cb_seq_nr) {
dprintk("%s Invalid sequence number\n", __func__);
goto out;
}
@@ -392,7 +392,7 @@ nfs4_xdr_dec_cb_null(struct rpc_rqst *req, __be32 *p)
static int
nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, __be32 *p,
- struct nfsd4_cb_args *args)
+ struct nfsd4_callback *cb)
{
struct xdr_stream xdr;
struct nfs4_cb_compound_hdr hdr;
@@ -402,8 +402,8 @@ nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, __be32 *p,
status = decode_cb_compound_hdr(&xdr, &hdr);
if (status)
goto out;
- if (args) {
- status = decode_cb_sequence(&xdr, args, rqstp);
+ if (cb) {
+ status = decode_cb_sequence(&xdr, cb, rqstp);
if (status)
goto out;
}
@@ -550,8 +550,8 @@ void do_probe_callback(struct nfs4_client *clp)
{
struct nfsd4_callback *cb = &clp->cl_cb_null;
- cb->cb_args.args_op = NULL;
- cb->cb_args.args_clp = clp;
+ cb->cb_op = NULL;
+ cb->cb_clp = clp;
cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_NULL];
cb->cb_msg.rpc_argp = NULL;
@@ -614,11 +614,10 @@ static void nfsd4_cb_prepare(struct rpc_task *task, void *calldata)
struct nfsd4_callback *cb = calldata;
struct nfs4_delegation *dp = container_of(cb, struct nfs4_delegation, dl_recall);
struct nfs4_client *clp = dp->dl_client;
- struct nfsd4_cb_args *args = task->tk_msg.rpc_argp;
u32 minorversion = clp->cl_cb_conn.cb_minorversion;
int status = 0;
- args->args_minorversion = minorversion;
+ cb->cb_minorversion = minorversion;
if (minorversion) {
status = nfsd41_cb_setup_sequence(clp, task);
if (status) {
@@ -754,7 +753,7 @@ void nfsd4_release_cb(struct nfsd4_callback *cb)
void nfsd4_do_callback_rpc(struct work_struct *w)
{
struct nfsd4_callback *cb = container_of(w, struct nfsd4_callback, cb_work);
- struct nfs4_client *clp = cb->cb_args.args_clp;
+ struct nfs4_client *clp = cb->cb_clp;
struct rpc_clnt *clnt = clp->cl_cb_client;
if (clnt == NULL) {
@@ -770,11 +769,11 @@ void nfsd4_cb_recall(struct nfs4_delegation *dp)
struct nfsd4_callback *cb = &dp->dl_recall;
dp->dl_retries = 1;
- cb->cb_args.args_op = dp;
- cb->cb_args.args_clp = dp->dl_client;
+ cb->cb_op = dp;
+ cb->cb_clp = dp->dl_client;
cb->cb_msg.rpc_proc = &nfs4_cb_procedures[NFSPROC4_CLNT_CB_RECALL];
- cb->cb_msg.rpc_argp = &cb->cb_args;
- cb->cb_msg.rpc_resp = &cb->cb_args;
+ cb->cb_msg.rpc_argp = cb;
+ cb->cb_msg.rpc_resp = cb;
cb->cb_msg.rpc_cred = callback_cred;
cb->cb_ops = &nfsd4_cb_recall_ops;
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 19732d5..2ece6be 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -64,14 +64,10 @@ typedef struct {
(s)->si_fileid, \
(s)->si_generation
-struct nfsd4_cb_args {
- void *args_op;
- struct nfs4_client *args_clp;
- u32 args_minorversion;
-};
-
struct nfsd4_callback {
- struct nfsd4_cb_args cb_args;
+ void *cb_op;
+ struct nfs4_client *cb_clp;
+ u32 cb_minorversion;
struct rpc_message cb_msg;
const struct rpc_call_ops *cb_ops;
struct work_struct cb_work;
--
1.7.0.4
next prev parent reply other threads:[~2010-09-30 16:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-30 16:18 4.1 patches J. Bruce Fields
2010-09-30 16:18 ` [PATCH 01/16] nfsd4: minor variable renaming (cb -> conn) J. Bruce Fields
2010-09-30 16:18 ` [PATCH 02/16] nfsd4: combine nfs4_rpc_args and nfsd4_cb_sequence J. Bruce Fields
2010-09-30 16:19 ` [PATCH 03/16] nfsd4: rename nfs4_rpc_args->nfsd4_cb_args J. Bruce Fields
2010-09-30 16:19 ` [PATCH 04/16] nfsd4: generic callback code J. Bruce Fields
2010-09-30 16:19 ` [PATCH 05/16] nfsd4: use generic callback code in null case J. Bruce Fields
2010-09-30 16:19 ` J. Bruce Fields [this message]
2010-09-30 16:19 ` [PATCH 07/16] nfsd4: Move callback setup to callback queue J. Bruce Fields
2010-09-30 16:19 ` [PATCH 08/16] nfsd4: fix alloc_init_session BUILD_BUG_ON() J. Bruce Fields
2010-09-30 16:19 ` [PATCH 09/16] nfsd4: fix alloc_init_session return type J. Bruce Fields
2010-09-30 16:19 ` [PATCH 10/16] nfsd4: clean up session allocation J. Bruce Fields
2010-09-30 16:19 ` [PATCH 11/16] nfsd4: keep per-session list of connections J. Bruce Fields
2010-09-30 21:21 ` Benny Halevy
2010-09-30 21:38 ` J. Bruce Fields
2010-09-30 16:19 ` [PATCH 12/16] nfsd: provide callbacks on svc_xprt deletion J. Bruce Fields
2010-09-30 16:19 ` [PATCH 13/16] nfsd4: use callbacks on svc_xprt_deletion J. Bruce Fields
2010-09-30 16:19 ` [PATCH 14/16] nfsd4: refactor connection allocation J. Bruce Fields
2010-09-30 16:19 ` [PATCH 15/16] nfsd4: add new connections to session J. Bruce Fields
2010-09-30 21:33 ` Benny Halevy
2010-09-30 21:57 ` J. Bruce Fields
2010-09-30 16:19 ` [PATCH 16/16] nfsd4: enforce DESTROY_SESSION connection requirement J. Bruce Fields
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=1285863553-8945-7-git-send-email-bfields@redhat.com \
--to=bfields@redhat.com \
--cc=bfields@citi.umich.edu \
--cc=linux-nfs@vger.kernel.org \
/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