diff options
| author | Andy Adamson <andros@netapp.com> | 2013-06-26 12:21:49 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-06-28 15:55:19 -0400 |
| commit | 18aad3d552c73adf2652a34baf0fe766058018e4 (patch) | |
| tree | c4291710ff620be3ed2935cbd250d33137f84015 | |
| parent | 9111c95b077a81573fb27df3ba8255d0a3a9ebdf (diff) | |
NFSv4.1 Refactor nfs4_init_session and nfs4_init_channel_attrs
nfs4_init_session was originally written to be called prior to
nfs4_init_channel_attrs, setting the session target_max response and request
sizes that nfs4_init_channel_attrs would pay attention to.
In the current code flow, nfs4_init_session, just like nfs4_init_ds_session
for the data server case, is called after the session is all negotiated, and
is actually used in a RECLAIM COMPLETE call to the server.
Remove the un-needed fc_target_max response and request fields from
nfs4_session and just set the max_resp_sz and max_rqst_sz in
nfs4_init_channel_attrs.
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| -rw-r--r-- | fs/nfs/nfs4client.c | 2 | ||||
| -rw-r--r-- | fs/nfs/nfs4proc.c | 17 | ||||
| -rw-r--r-- | fs/nfs/nfs4session.c | 40 | ||||
| -rw-r--r-- | fs/nfs/nfs4session.h | 7 |
4 files changed, 12 insertions, 54 deletions
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 4cbad5d6b276..daecaa94d7ad 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c | |||
| @@ -730,7 +730,7 @@ static int nfs4_server_common_setup(struct nfs_server *server, | |||
| 730 | return -ENOMEM; | 730 | return -ENOMEM; |
| 731 | 731 | ||
| 732 | /* We must ensure the session is initialised first */ | 732 | /* We must ensure the session is initialised first */ |
| 733 | error = nfs4_init_session(server); | 733 | error = nfs4_init_session(server->nfs_client); |
| 734 | if (error < 0) | 734 | if (error < 0) |
| 735 | goto out; | 735 | goto out; |
| 736 | 736 | ||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 83e0e1de7ecf..6d46f966d169 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -5792,17 +5792,14 @@ int nfs4_proc_get_lease_time(struct nfs_client *clp, struct nfs_fsinfo *fsinfo) | |||
| 5792 | */ | 5792 | */ |
| 5793 | static void nfs4_init_channel_attrs(struct nfs41_create_session_args *args) | 5793 | static void nfs4_init_channel_attrs(struct nfs41_create_session_args *args) |
| 5794 | { | 5794 | { |
| 5795 | struct nfs4_session *session = args->client->cl_session; | 5795 | unsigned int max_rqst_sz, max_resp_sz; |
| 5796 | unsigned int mxrqst_sz = session->fc_target_max_rqst_sz, | 5796 | |
| 5797 | mxresp_sz = session->fc_target_max_resp_sz; | 5797 | max_rqst_sz = NFS_MAX_FILE_IO_SIZE + nfs41_maxwrite_overhead; |
| 5798 | 5798 | max_resp_sz = NFS_MAX_FILE_IO_SIZE + nfs41_maxread_overhead; | |
| 5799 | if (mxrqst_sz == 0) | 5799 | |
| 5800 | mxrqst_sz = NFS_MAX_FILE_IO_SIZE; | ||
| 5801 | if (mxresp_sz == 0) | ||
| 5802 | mxresp_sz = NFS_MAX_FILE_IO_SIZE; | ||
| 5803 | /* Fore channel attributes */ | 5800 | /* Fore channel attributes */ |
| 5804 | args->fc_attrs.max_rqst_sz = mxrqst_sz; | 5801 | args->fc_attrs.max_rqst_sz = max_rqst_sz; |
| 5805 | args->fc_attrs.max_resp_sz = mxresp_sz; | 5802 | args->fc_attrs.max_resp_sz = max_resp_sz; |
| 5806 | args->fc_attrs.max_ops = NFS4_MAX_OPS; | 5803 | args->fc_attrs.max_ops = NFS4_MAX_OPS; |
| 5807 | args->fc_attrs.max_reqs = max_session_slots; | 5804 | args->fc_attrs.max_reqs = max_session_slots; |
| 5808 | 5805 | ||
diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c index c4e225e4a9af..36e21cb29d65 100644 --- a/fs/nfs/nfs4session.c +++ b/fs/nfs/nfs4session.c | |||
| @@ -478,48 +478,12 @@ static int nfs41_check_session_ready(struct nfs_client *clp) | |||
| 478 | return 0; | 478 | return 0; |
| 479 | } | 479 | } |
| 480 | 480 | ||
| 481 | int nfs4_init_session(struct nfs_server *server) | 481 | int nfs4_init_session(struct nfs_client *clp) |
| 482 | { | 482 | { |
| 483 | struct nfs_client *clp = server->nfs_client; | ||
| 484 | struct nfs4_session *session; | ||
| 485 | unsigned int target_max_rqst_sz = NFS_MAX_FILE_IO_SIZE; | ||
| 486 | unsigned int target_max_resp_sz = NFS_MAX_FILE_IO_SIZE; | ||
| 487 | |||
| 488 | if (!nfs4_has_session(clp)) | 483 | if (!nfs4_has_session(clp)) |
| 489 | return 0; | 484 | return 0; |
| 490 | 485 | ||
| 491 | if (server->rsize != 0) | 486 | clear_bit(NFS4_SESSION_INITING, &clp->cl_session->session_state); |
| 492 | target_max_resp_sz = server->rsize; | ||
| 493 | target_max_resp_sz += nfs41_maxread_overhead; | ||
| 494 | |||
| 495 | if (server->wsize != 0) | ||
| 496 | target_max_rqst_sz = server->wsize; | ||
| 497 | target_max_rqst_sz += nfs41_maxwrite_overhead; | ||
| 498 | |||
| 499 | session = clp->cl_session; | ||
| 500 | spin_lock(&clp->cl_lock); | ||
| 501 | if (test_and_clear_bit(NFS4_SESSION_INITING, &session->session_state)) { | ||
| 502 | /* Initialise targets and channel attributes */ | ||
| 503 | session->fc_target_max_rqst_sz = target_max_rqst_sz; | ||
| 504 | session->fc_attrs.max_rqst_sz = target_max_rqst_sz; | ||
| 505 | session->fc_target_max_resp_sz = target_max_resp_sz; | ||
| 506 | session->fc_attrs.max_resp_sz = target_max_resp_sz; | ||
| 507 | } else { | ||
| 508 | /* Just adjust the targets */ | ||
| 509 | if (target_max_rqst_sz > session->fc_target_max_rqst_sz) { | ||
| 510 | session->fc_target_max_rqst_sz = target_max_rqst_sz; | ||
| 511 | set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); | ||
| 512 | } | ||
| 513 | if (target_max_resp_sz > session->fc_target_max_resp_sz) { | ||
| 514 | session->fc_target_max_resp_sz = target_max_resp_sz; | ||
| 515 | set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); | ||
| 516 | } | ||
| 517 | } | ||
| 518 | spin_unlock(&clp->cl_lock); | ||
| 519 | |||
| 520 | if (test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state)) | ||
| 521 | nfs4_schedule_lease_recovery(clp); | ||
| 522 | |||
| 523 | return nfs41_check_session_ready(clp); | 487 | return nfs41_check_session_ready(clp); |
| 524 | } | 488 | } |
| 525 | 489 | ||
diff --git a/fs/nfs/nfs4session.h b/fs/nfs/nfs4session.h index ff7d9f0f8a65..3a153d82b90c 100644 --- a/fs/nfs/nfs4session.h +++ b/fs/nfs/nfs4session.h | |||
| @@ -66,9 +66,6 @@ struct nfs4_session { | |||
| 66 | struct nfs4_channel_attrs bc_attrs; | 66 | struct nfs4_channel_attrs bc_attrs; |
| 67 | struct nfs4_slot_table bc_slot_table; | 67 | struct nfs4_slot_table bc_slot_table; |
| 68 | struct nfs_client *clp; | 68 | struct nfs_client *clp; |
| 69 | /* Create session arguments */ | ||
| 70 | unsigned int fc_target_max_rqst_sz; | ||
| 71 | unsigned int fc_target_max_resp_sz; | ||
| 72 | }; | 69 | }; |
| 73 | 70 | ||
| 74 | enum nfs4_session_state { | 71 | enum nfs4_session_state { |
| @@ -89,7 +86,7 @@ extern int nfs4_setup_session_slot_tables(struct nfs4_session *ses); | |||
| 89 | 86 | ||
| 90 | extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp); | 87 | extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp); |
| 91 | extern void nfs4_destroy_session(struct nfs4_session *session); | 88 | extern void nfs4_destroy_session(struct nfs4_session *session); |
| 92 | extern int nfs4_init_session(struct nfs_server *server); | 89 | extern int nfs4_init_session(struct nfs_client *clp); |
| 93 | extern int nfs4_init_ds_session(struct nfs_client *, unsigned long); | 90 | extern int nfs4_init_ds_session(struct nfs_client *, unsigned long); |
| 94 | 91 | ||
| 95 | extern void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl); | 92 | extern void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl); |
| @@ -122,7 +119,7 @@ static inline int nfs4_has_persistent_session(const struct nfs_client *clp) | |||
| 122 | 119 | ||
| 123 | #else /* defined(CONFIG_NFS_V4_1) */ | 120 | #else /* defined(CONFIG_NFS_V4_1) */ |
| 124 | 121 | ||
| 125 | static inline int nfs4_init_session(struct nfs_server *server) | 122 | static inline int nfs4_init_session(struct nfs_client *clp) |
| 126 | { | 123 | { |
| 127 | return 0; | 124 | return 0; |
| 128 | } | 125 | } |
