smb3: display bytes_read and bytes_written in stats as we do for cifs

Message ID CAH2r5mtQ+Xt4qih2b=KSo7CZL7DAjxsyAOirK8bWtM8bVokMmg@mail.gmail.com
State New
Headers show
Series
  • smb3: display bytes_read and bytes_written in stats as we do for cifs
Related show

Commit Message

Steve French July 31, 2018, 6:52 a.m.
From 27a2394b231a2aa633ae1e21d57f0b92b804fbd1 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Tue, 31 Jul 2018 01:46:47 -0500
Subject: [PATCH] smb3: display bytes_read and bytes_written in smb3 stats

We were only displaying bytes_read and bytes_written in cifs
stats, fix smb3 stats to also display them.  Sample output
with this patch:

    cat /proc/fs/cifs/Stats:

CIFS Session: 1
Share (unique mount targets): 2
SMB Request/Response Buffer: 1 Pool size: 5
SMB Small Req/Resp Buffer: 1 Pool size: 30
Operations (MIDs): 0

0 session 0 share reconnects
Total vfs operations: 94 maximum at one time: 2

1) \\localhost\test
SMBs: 214
Bytes read: 502092  Bytes written: 31457286
TreeConnects: 1 total 0 failed
TreeDisconnects: 0 total 0 failed
Creates: 52 total 3 failed
Closes: 48 total 0 failed
Flushes: 0 total 0 failed
Reads: 17 total 0 failed
Writes: 31 total 0 failed
...

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2ops.c | 3 +++
 1 file changed, 3 insertions(+)

     seq_printf(m, "\nTreeConnects: %d total %d failed",
            atomic_read(&sent[SMB2_TREE_CONNECT_HE]),
            atomic_read(&failed[SMB2_TREE_CONNECT_HE]));

Comments

ronnie sahlberg July 31, 2018, 7:01 a.m. | #1
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>

On Tue, Jul 31, 2018 at 4:52 PM, Steve French <smfrench@gmail.com> wrote:
> From 27a2394b231a2aa633ae1e21d57f0b92b804fbd1 Mon Sep 17 00:00:00 2001
> From: Steve French <stfrench@microsoft.com>
> Date: Tue, 31 Jul 2018 01:46:47 -0500
> Subject: [PATCH] smb3: display bytes_read and bytes_written in smb3 stats
>
> We were only displaying bytes_read and bytes_written in cifs
> stats, fix smb3 stats to also display them.  Sample output
> with this patch:
>
>     cat /proc/fs/cifs/Stats:
>
> CIFS Session: 1
> Share (unique mount targets): 2
> SMB Request/Response Buffer: 1 Pool size: 5
> SMB Small Req/Resp Buffer: 1 Pool size: 30
> Operations (MIDs): 0
>
> 0 session 0 share reconnects
> Total vfs operations: 94 maximum at one time: 2
>
> 1) \\localhost\test
> SMBs: 214
> Bytes read: 502092  Bytes written: 31457286
> TreeConnects: 1 total 0 failed
> TreeDisconnects: 0 total 0 failed
> Creates: 52 total 3 failed
> Closes: 48 total 0 failed
> Flushes: 0 total 0 failed
> Reads: 17 total 0 failed
> Writes: 31 total 0 failed
> ...
>
> Signed-off-by: Steve French <stfrench@microsoft.com>
> ---
>  fs/cifs/smb2ops.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> index 831249001384..85e848007f91 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -950,6 +950,9 @@ smb2_print_stats(struct seq_file *m, struct cifs_tcon
> *tcon)
>       *  Can't display SMB2_NEGOTIATE, SESSION_SETUP, LOGOFF, CANCEL and
> ECHO
>       *  totals (requests sent) since those SMBs are per-session not per
> tcon
>       */
> +    seq_printf(m, "\nBytes read: %llu  Bytes written: %llu",
> +           (long long)(tcon->bytes_read),
> +           (long long)(tcon->bytes_written));
>      seq_printf(m, "\nTreeConnects: %d total %d failed",
>             atomic_read(&sent[SMB2_TREE_CONNECT_HE]),
>             atomic_read(&failed[SMB2_TREE_CONNECT_HE]));
> --
> 2.17.1
>
>
> --
> Thanks,
>
> Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

From 27a2394b231a2aa633ae1e21d57f0b92b804fbd1 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Tue, 31 Jul 2018 01:46:47 -0500
Subject: [PATCH] smb3: display bytes_read and bytes_written in smb3 stats

We were only displaying bytes_read and bytes_written in cifs
stats, fix smb3 stats to also display them.  Sample output
with this patch:

    cat /proc/fs/cifs/Stats:

CIFS Session: 1
Share (unique mount targets): 2
SMB Request/Response Buffer: 1 Pool size: 5
SMB Small Req/Resp Buffer: 1 Pool size: 30
Operations (MIDs): 0

0 session 0 share reconnects
Total vfs operations: 94 maximum at one time: 2

1) \\localhost\test
SMBs: 214
Bytes read: 502092  Bytes written: 31457286
TreeConnects: 1 total 0 failed
TreeDisconnects: 0 total 0 failed
Creates: 52 total 3 failed
Closes: 48 total 0 failed
Flushes: 0 total 0 failed
Reads: 17 total 0 failed
Writes: 31 total 0 failed
...

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2ops.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 831249001384..85e848007f91 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -950,6 +950,9 @@  smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
 	 *  Can't display SMB2_NEGOTIATE, SESSION_SETUP, LOGOFF, CANCEL and ECHO
 	 *  totals (requests sent) since those SMBs are per-session not per tcon
 	 */
+	seq_printf(m, "\nBytes read: %llu  Bytes written: %llu",
+		   (long long)(tcon->bytes_read),
+		   (long long)(tcon->bytes_written));
 	seq_printf(m, "\nTreeConnects: %d total %d failed",
 		   atomic_read(&sent[SMB2_TREE_CONNECT_HE]),
 		   atomic_read(&failed[SMB2_TREE_CONNECT_HE]));
-- 
2.17.1