diff options
author | Chuck Lever <cel@netapp.com> | 2006-03-20 13:44:14 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:14 -0500 |
commit | 006ea73e5fa82915d0ac7a3f15ee7c688433236d (patch) | |
tree | 0f522982fe3d01a74f1ad9f5f713cbd10a6b09bd | |
parent | 91d5b47023b608227d605d1e916b29dd0215bff7 (diff) |
NFS: add hooks to account for NFSERR_JUKEBOX errors
Make an inode or an nfs_server struct available in the logic that handles
JUKEBOX/DELAY type errors so the NFS client can account for them.
This patch is split out from the main nfs iostat patch to highlight minor
architectural changes required to support this statistic.
Test plan:
None.
Signed-off-by: Chuck Lever <cel@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/iostat.h | 19 | ||||
-rw-r--r-- | fs/nfs/nfs3proc.c | 13 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 5 |
3 files changed, 27 insertions, 10 deletions
diff --git a/fs/nfs/iostat.h b/fs/nfs/iostat.h index dc080e50ec57..7a7495153317 100644 --- a/fs/nfs/iostat.h +++ b/fs/nfs/iostat.h | |||
@@ -103,6 +103,7 @@ enum nfs_stat_eventcounters { | |||
103 | NFSIOS_SILLYRENAME, | 103 | NFSIOS_SILLYRENAME, |
104 | NFSIOS_SHORTREAD, | 104 | NFSIOS_SHORTREAD, |
105 | NFSIOS_SHORTWRITE, | 105 | NFSIOS_SHORTWRITE, |
106 | NFSIOS_DELAY, | ||
106 | __NFSIOS_COUNTSMAX, | 107 | __NFSIOS_COUNTSMAX, |
107 | }; | 108 | }; |
108 | 109 | ||
@@ -116,28 +117,38 @@ struct nfs_iostats { | |||
116 | unsigned long events[__NFSIOS_COUNTSMAX]; | 117 | unsigned long events[__NFSIOS_COUNTSMAX]; |
117 | } ____cacheline_aligned; | 118 | } ____cacheline_aligned; |
118 | 119 | ||
119 | static inline void nfs_inc_stats(struct inode *inode, enum nfs_stat_eventcounters stat) | 120 | static inline void nfs_inc_server_stats(struct nfs_server *server, enum nfs_stat_eventcounters stat) |
120 | { | 121 | { |
121 | struct nfs_iostats *iostats; | 122 | struct nfs_iostats *iostats; |
122 | int cpu; | 123 | int cpu; |
123 | 124 | ||
124 | cpu = get_cpu(); | 125 | cpu = get_cpu(); |
125 | iostats = per_cpu_ptr(NFS_SERVER(inode)->io_stats, cpu); | 126 | iostats = per_cpu_ptr(server->io_stats, cpu); |
126 | iostats->events[stat] ++; | 127 | iostats->events[stat] ++; |
127 | put_cpu_no_resched(); | 128 | put_cpu_no_resched(); |
128 | } | 129 | } |
129 | 130 | ||
130 | static inline void nfs_add_stats(struct inode *inode, enum nfs_stat_bytecounters stat, unsigned long addend) | 131 | static inline void nfs_inc_stats(struct inode *inode, enum nfs_stat_eventcounters stat) |
132 | { | ||
133 | nfs_inc_server_stats(NFS_SERVER(inode), stat); | ||
134 | } | ||
135 | |||
136 | static inline void nfs_add_server_stats(struct nfs_server *server, enum nfs_stat_bytecounters stat, unsigned long addend) | ||
131 | { | 137 | { |
132 | struct nfs_iostats *iostats; | 138 | struct nfs_iostats *iostats; |
133 | int cpu; | 139 | int cpu; |
134 | 140 | ||
135 | cpu = get_cpu(); | 141 | cpu = get_cpu(); |
136 | iostats = per_cpu_ptr(NFS_SERVER(inode)->io_stats, cpu); | 142 | iostats = per_cpu_ptr(server->io_stats, cpu); |
137 | iostats->bytes[stat] += addend; | 143 | iostats->bytes[stat] += addend; |
138 | put_cpu_no_resched(); | 144 | put_cpu_no_resched(); |
139 | } | 145 | } |
140 | 146 | ||
147 | static inline void nfs_add_stats(struct inode *inode, enum nfs_stat_bytecounters stat, unsigned long addend) | ||
148 | { | ||
149 | nfs_add_server_stats(NFS_SERVER(inode), stat, addend); | ||
150 | } | ||
151 | |||
141 | static inline struct nfs_iostats *nfs_alloc_iostats(void) | 152 | static inline struct nfs_iostats *nfs_alloc_iostats(void) |
142 | { | 153 | { |
143 | return alloc_percpu(struct nfs_iostats); | 154 | return alloc_percpu(struct nfs_iostats); |
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index ed67567f0556..7204ba5b2bf8 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
20 | #include <linux/nfs_mount.h> | 20 | #include <linux/nfs_mount.h> |
21 | 21 | ||
22 | #include "iostat.h" | ||
23 | |||
22 | #define NFSDBG_FACILITY NFSDBG_PROC | 24 | #define NFSDBG_FACILITY NFSDBG_PROC |
23 | 25 | ||
24 | extern struct rpc_procinfo nfs3_procedures[]; | 26 | extern struct rpc_procinfo nfs3_procedures[]; |
@@ -58,10 +60,11 @@ nfs3_rpc_call_wrapper(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp, i | |||
58 | nfs3_rpc_wrapper(clnt, msg, flags) | 60 | nfs3_rpc_wrapper(clnt, msg, flags) |
59 | 61 | ||
60 | static int | 62 | static int |
61 | nfs3_async_handle_jukebox(struct rpc_task *task) | 63 | nfs3_async_handle_jukebox(struct rpc_task *task, struct inode *inode) |
62 | { | 64 | { |
63 | if (task->tk_status != -EJUKEBOX) | 65 | if (task->tk_status != -EJUKEBOX) |
64 | return 0; | 66 | return 0; |
67 | nfs_inc_stats(inode, NFSIOS_DELAY); | ||
65 | task->tk_status = 0; | 68 | task->tk_status = 0; |
66 | rpc_restart_call(task); | 69 | rpc_restart_call(task); |
67 | rpc_delay(task, NFS_JUKEBOX_RETRY_TIME); | 70 | rpc_delay(task, NFS_JUKEBOX_RETRY_TIME); |
@@ -447,7 +450,7 @@ nfs3_proc_unlink_done(struct dentry *dir, struct rpc_task *task) | |||
447 | struct rpc_message *msg = &task->tk_msg; | 450 | struct rpc_message *msg = &task->tk_msg; |
448 | struct nfs_fattr *dir_attr; | 451 | struct nfs_fattr *dir_attr; |
449 | 452 | ||
450 | if (nfs3_async_handle_jukebox(task)) | 453 | if (nfs3_async_handle_jukebox(task, dir->d_inode)) |
451 | return 1; | 454 | return 1; |
452 | if (msg->rpc_argp) { | 455 | if (msg->rpc_argp) { |
453 | dir_attr = (struct nfs_fattr*)msg->rpc_resp; | 456 | dir_attr = (struct nfs_fattr*)msg->rpc_resp; |
@@ -748,7 +751,7 @@ static void nfs3_read_done(struct rpc_task *task, void *calldata) | |||
748 | { | 751 | { |
749 | struct nfs_read_data *data = calldata; | 752 | struct nfs_read_data *data = calldata; |
750 | 753 | ||
751 | if (nfs3_async_handle_jukebox(task)) | 754 | if (nfs3_async_handle_jukebox(task, data->inode)) |
752 | return; | 755 | return; |
753 | /* Call back common NFS readpage processing */ | 756 | /* Call back common NFS readpage processing */ |
754 | if (task->tk_status >= 0) | 757 | if (task->tk_status >= 0) |
@@ -786,7 +789,7 @@ static void nfs3_write_done(struct rpc_task *task, void *calldata) | |||
786 | { | 789 | { |
787 | struct nfs_write_data *data = calldata; | 790 | struct nfs_write_data *data = calldata; |
788 | 791 | ||
789 | if (nfs3_async_handle_jukebox(task)) | 792 | if (nfs3_async_handle_jukebox(task, data->inode)) |
790 | return; | 793 | return; |
791 | if (task->tk_status >= 0) | 794 | if (task->tk_status >= 0) |
792 | nfs_post_op_update_inode(data->inode, data->res.fattr); | 795 | nfs_post_op_update_inode(data->inode, data->res.fattr); |
@@ -833,7 +836,7 @@ static void nfs3_commit_done(struct rpc_task *task, void *calldata) | |||
833 | { | 836 | { |
834 | struct nfs_write_data *data = calldata; | 837 | struct nfs_write_data *data = calldata; |
835 | 838 | ||
836 | if (nfs3_async_handle_jukebox(task)) | 839 | if (nfs3_async_handle_jukebox(task, data->inode)) |
837 | return; | 840 | return; |
838 | if (task->tk_status >= 0) | 841 | if (task->tk_status >= 0) |
839 | nfs_post_op_update_inode(data->inode, data->res.fattr); | 842 | nfs_post_op_update_inode(data->inode, data->res.fattr); |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 77a565eba562..f1ff4fa6cce5 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -51,6 +51,7 @@ | |||
51 | 51 | ||
52 | #include "nfs4_fs.h" | 52 | #include "nfs4_fs.h" |
53 | #include "delegation.h" | 53 | #include "delegation.h" |
54 | #include "iostat.h" | ||
54 | 55 | ||
55 | #define NFSDBG_FACILITY NFSDBG_PROC | 56 | #define NFSDBG_FACILITY NFSDBG_PROC |
56 | 57 | ||
@@ -2755,8 +2756,10 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server) | |||
2755 | rpc_wake_up_task(task); | 2756 | rpc_wake_up_task(task); |
2756 | task->tk_status = 0; | 2757 | task->tk_status = 0; |
2757 | return -EAGAIN; | 2758 | return -EAGAIN; |
2758 | case -NFS4ERR_GRACE: | ||
2759 | case -NFS4ERR_DELAY: | 2759 | case -NFS4ERR_DELAY: |
2760 | nfs_inc_server_stats((struct nfs_server *) server, | ||
2761 | NFSIOS_DELAY); | ||
2762 | case -NFS4ERR_GRACE: | ||
2760 | rpc_delay(task, NFS4_POLL_RETRY_MAX); | 2763 | rpc_delay(task, NFS4_POLL_RETRY_MAX); |
2761 | task->tk_status = 0; | 2764 | task->tk_status = 0; |
2762 | return -EAGAIN; | 2765 | return -EAGAIN; |