forked from Minki/linux
NFS: Generic client side changes from Chuck
These patches fixes for iostats and SETCLIENTID in addition to cleaning up the nfs4_init_callback() function. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJUdfhQAAoJENfLVL+wpUDr9x4QANWmG6xjEU7RuIBLalOoxit6 eXnEDNZlwYp6NCkYktHVWaTqXdwq7fdGX+3p4eiwNg3C3SrJHkpWvjeFd4KT/SyP B/w3vYG3o5H01i3Mb5kCD2uW0gbS9soZXpIg+uHHOl43yZzneC0vPTLhQ/h+9zPc B32XcgQhvLIHR3LWrC/+uolsa31lcyya0W45PX+iCpzHF7i9qRBrNLODkTlw1hNQ eEnYIvVy5oW00zlHJUYiTHP3e+0EJn5PAngdYbqiboJ9mK7DbB0QDwqyvJbIT7ql WAip6cNcJnSv1eiVYqDwlR1ok8drK5X7yQCT3lcLzAMDznLsSAL1Itu0h2Ay3z61 f8XCyTwI0izq0DbdrMcPoqPSitqyM8nkPElnOuitXwzEroPaG40OF67yss3+ixbl JeQZ+u35pnpCkKUaZdCK3Pn83StxmUaBcFx8eg30NBc0SN13Eiz6aZcGEperClrR RwMLDUhUtAMcMRunRRxiN9lHafPqqeDeJre7uky0p0sU9CsH+1n5qIKLmk+Ber2d ZS29TobdR7ktfjQ52XazMAIFzI7r1v4Zn7ziH/WRbvKoKw9ICcyoUGNy9CS5LyWu BxWCZAJmby5H1i7V7ituJK8TImb81L4aPW06hHX9k+0SoTrgFjas//4jZYfysJ9N PvR0MRNfMFhuBlsTj7Gy =PMdS -----END PGP SIGNATURE----- Merge tag 'nfs-cel-for-3.19' of git://git.linux-nfs.org/projects/anna/nfs-rdma into linux-next Pull pull additional NFS client changes for 3.19 from Anna Schumaker: "NFS: Generic client side changes from Chuck These patches fixes for iostats and SETCLIENTID in addition to cleaning up the nfs4_init_callback() function. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>" * tag 'nfs-cel-for-3.19' of git://git.linux-nfs.org/projects/anna/nfs-rdma: NFS: Clean up nfs4_init_callback() NFS: SETCLIENTID XDR buffer sizes are incorrect SUNRPC: serialize iostats updates
This commit is contained in:
commit
1702562db4
@ -241,28 +241,25 @@ void nfs4_free_client(struct nfs_client *clp)
|
||||
*/
|
||||
static int nfs4_init_callback(struct nfs_client *clp)
|
||||
{
|
||||
struct rpc_xprt *xprt;
|
||||
int error;
|
||||
|
||||
if (clp->rpc_ops->version == 4) {
|
||||
struct rpc_xprt *xprt;
|
||||
xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt);
|
||||
|
||||
xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt);
|
||||
|
||||
if (nfs4_has_session(clp)) {
|
||||
error = xprt_setup_backchannel(xprt,
|
||||
NFS41_BC_MIN_CALLBACKS);
|
||||
if (error < 0)
|
||||
return error;
|
||||
}
|
||||
|
||||
error = nfs_callback_up(clp->cl_mvops->minor_version, xprt);
|
||||
if (error < 0) {
|
||||
dprintk("%s: failed to start callback. Error = %d\n",
|
||||
__func__, error);
|
||||
if (nfs4_has_session(clp)) {
|
||||
error = xprt_setup_backchannel(xprt, NFS41_BC_MIN_CALLBACKS);
|
||||
if (error < 0)
|
||||
return error;
|
||||
}
|
||||
__set_bit(NFS_CS_CALLBACK, &clp->cl_res_state);
|
||||
}
|
||||
|
||||
error = nfs_callback_up(clp->cl_mvops->minor_version, xprt);
|
||||
if (error < 0) {
|
||||
dprintk("%s: failed to start callback. Error = %d\n",
|
||||
__func__, error);
|
||||
return error;
|
||||
}
|
||||
__set_bit(NFS_CS_CALLBACK, &clp->cl_res_state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -141,13 +141,15 @@ static int nfs4_stat_to_errno(int);
|
||||
XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \
|
||||
XDR_QUADLEN(NFS4_SETCLIENTID_NAMELEN) + \
|
||||
1 /* sc_prog */ + \
|
||||
XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \
|
||||
XDR_QUADLEN(RPCBIND_MAXUADDRLEN) + \
|
||||
1 + XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \
|
||||
1 + XDR_QUADLEN(RPCBIND_MAXUADDRLEN) + \
|
||||
1) /* sc_cb_ident */
|
||||
#define decode_setclientid_maxsz \
|
||||
(op_decode_hdr_maxsz + \
|
||||
2 + \
|
||||
1024) /* large value for CLID_INUSE */
|
||||
2 /* clientid */ + \
|
||||
XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \
|
||||
1 + XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \
|
||||
1 + XDR_QUADLEN(RPCBIND_MAXUADDRLEN))
|
||||
#define encode_setclientid_confirm_maxsz \
|
||||
(op_encode_hdr_maxsz + \
|
||||
3 + (NFS4_VERIFIER_SIZE >> 2))
|
||||
|
@ -27,10 +27,13 @@
|
||||
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
#define RPC_IOSTATS_VERS "1.0"
|
||||
|
||||
struct rpc_iostats {
|
||||
spinlock_t om_lock;
|
||||
|
||||
/*
|
||||
* These counters give an idea about how many request
|
||||
* transmissions are required, on average, to complete that
|
||||
|
@ -116,7 +116,15 @@ EXPORT_SYMBOL_GPL(svc_seq_show);
|
||||
*/
|
||||
struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt)
|
||||
{
|
||||
return kcalloc(clnt->cl_maxproc, sizeof(struct rpc_iostats), GFP_KERNEL);
|
||||
struct rpc_iostats *stats;
|
||||
int i;
|
||||
|
||||
stats = kcalloc(clnt->cl_maxproc, sizeof(*stats), GFP_KERNEL);
|
||||
if (stats) {
|
||||
for (i = 0; i < clnt->cl_maxproc; i++)
|
||||
spin_lock_init(&stats[i].om_lock);
|
||||
}
|
||||
return stats;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rpc_alloc_iostats);
|
||||
|
||||
@ -135,20 +143,21 @@ EXPORT_SYMBOL_GPL(rpc_free_iostats);
|
||||
* rpc_count_iostats - tally up per-task stats
|
||||
* @task: completed rpc_task
|
||||
* @stats: array of stat structures
|
||||
*
|
||||
* Relies on the caller for serialization.
|
||||
*/
|
||||
void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats)
|
||||
{
|
||||
struct rpc_rqst *req = task->tk_rqstp;
|
||||
struct rpc_iostats *op_metrics;
|
||||
ktime_t delta;
|
||||
ktime_t delta, now;
|
||||
|
||||
if (!stats || !req)
|
||||
return;
|
||||
|
||||
now = ktime_get();
|
||||
op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx];
|
||||
|
||||
spin_lock(&op_metrics->om_lock);
|
||||
|
||||
op_metrics->om_ops++;
|
||||
op_metrics->om_ntrans += req->rq_ntrans;
|
||||
op_metrics->om_timeouts += task->tk_timeouts;
|
||||
@ -161,8 +170,10 @@ void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats)
|
||||
|
||||
op_metrics->om_rtt = ktime_add(op_metrics->om_rtt, req->rq_rtt);
|
||||
|
||||
delta = ktime_sub(ktime_get(), task->tk_start);
|
||||
delta = ktime_sub(now, task->tk_start);
|
||||
op_metrics->om_execute = ktime_add(op_metrics->om_execute, delta);
|
||||
|
||||
spin_unlock(&op_metrics->om_lock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rpc_count_iostats);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user