aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-04-06 09:17:26 -0400
committerDavid Howells <dhowells@redhat.com>2018-04-09 16:54:48 -0400
commit76a5cb6fc1e22a2a316fb690fc4cdd5121d1c0ff (patch)
tree46916422df7fc81adfdf0eeec0491398cff2d8fb
parent5f702c8e124f967146a735a19f0b00a2469487d1 (diff)
afs: Add stats for data transfer operations
Add statistics to /proc/fs/afs/stats for data transfer RPC operations. New lines are added that look like: file-rd : n=55794 nb=10252282150 file-wr : n=9789 nb=3247763645 where n= indicates the number of ops completed and nb= indicates the number of bytes successfully transferred. file-rd is the counts for read/fetch operations and file-wr the counts for write/store operations. Note that directory and symlink downloading are included in the file-rd stats at the moment. Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--fs/afs/file.c6
-rw-r--r--fs/afs/internal.h4
-rw-r--r--fs/afs/proc.c7
-rw-r--r--fs/afs/write.c6
4 files changed, 23 insertions, 0 deletions
diff --git a/fs/afs/file.c b/fs/afs/file.c
index 91ff1335fd33..e5cac1bc3cf0 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -242,6 +242,12 @@ int afs_fetch_data(struct afs_vnode *vnode, struct key *key, struct afs_read *de
242 ret = afs_end_vnode_operation(&fc); 242 ret = afs_end_vnode_operation(&fc);
243 } 243 }
244 244
245 if (ret == 0) {
246 afs_stat_v(vnode, n_fetches);
247 atomic_long_add(desc->actual_len,
248 &afs_v2net(vnode)->n_fetch_bytes);
249 }
250
245 _leave(" = %d", ret); 251 _leave(" = %d", ret);
246 return ret; 252 return ret;
247} 253}
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 6ae023cbf00e..f6b44f47732d 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -273,6 +273,10 @@ struct afs_net {
273 atomic_t n_read_dir; /* Number of directory pages read */ 273 atomic_t n_read_dir; /* Number of directory pages read */
274 atomic_t n_dir_cr; /* Number of directory entry creation edits */ 274 atomic_t n_dir_cr; /* Number of directory entry creation edits */
275 atomic_t n_dir_rm; /* Number of directory entry removal edits */ 275 atomic_t n_dir_rm; /* Number of directory entry removal edits */
276 atomic_t n_stores; /* Number of store ops */
277 atomic_long_t n_store_bytes; /* Number of bytes stored */
278 atomic_long_t n_fetch_bytes; /* Number of bytes fetched */
279 atomic_t n_fetches; /* Number of data fetch ops */
276}; 280};
277 281
278extern const char afs_init_sysname[]; 282extern const char afs_init_sysname[];
diff --git a/fs/afs/proc.c b/fs/afs/proc.c
index 3212bce0d4fb..839a22280606 100644
--- a/fs/afs/proc.c
+++ b/fs/afs/proc.c
@@ -922,6 +922,13 @@ static int afs_proc_stats_show(struct seq_file *m, void *v)
922 seq_printf(m, "dir-edit: cr=%u rm=%u\n", 922 seq_printf(m, "dir-edit: cr=%u rm=%u\n",
923 atomic_read(&net->n_dir_cr), 923 atomic_read(&net->n_dir_cr),
924 atomic_read(&net->n_dir_rm)); 924 atomic_read(&net->n_dir_rm));
925
926 seq_printf(m, "file-rd : n=%u nb=%lu\n",
927 atomic_read(&net->n_fetches),
928 atomic_long_read(&net->n_fetch_bytes));
929 seq_printf(m, "file-wr : n=%u nb=%lu\n",
930 atomic_read(&net->n_stores),
931 atomic_long_read(&net->n_store_bytes));
925 return 0; 932 return 0;
926} 933}
927 934
diff --git a/fs/afs/write.c b/fs/afs/write.c
index 70a563c14e6f..eccc16198f68 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -356,6 +356,12 @@ found_key:
356 } 356 }
357 357
358 switch (ret) { 358 switch (ret) {
359 case 0:
360 afs_stat_v(vnode, n_stores);
361 atomic_long_add((last * PAGE_SIZE + to) -
362 (first * PAGE_SIZE + offset),
363 &afs_v2net(vnode)->n_store_bytes);
364 break;
359 case -EACCES: 365 case -EACCES:
360 case -EPERM: 366 case -EPERM:
361 case -ENOKEY: 367 case -ENOKEY: