[1/2] cifs: dump channel info in DebugData
diff mbox series

Message ID 20191120161559.30295-1-aaptel@suse.com
State New
Headers show
Series
  • [1/2] cifs: dump channel info in DebugData
Related show

Commit Message

Aurelien Aptel Nov. 20, 2019, 4:15 p.m. UTC
* show server&TCP states for extra channels
* mention if an interface has a channel connected to it

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
---
 fs/cifs/cifs_debug.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

Comments

Steve French Nov. 21, 2019, 9:54 p.m. UTC | #1
With current for-next got:

  CHECK   /home/smfrench/cifs-2.6/fs/cifs/cifs_debug.c
/home/smfrench/cifs-2.6/fs/cifs/cifs_debug.c:141:39: error: no member
'in_send' in struct TCP_Server_Info
  CC [M]  /home/smfrench/cifs-2.6/fs/cifs/cifs_debug.o
/home/smfrench/cifs-2.6/fs/cifs/cifs_debug.c: In function ‘cifs_dump_channel’:
/home/smfrench/cifs-2.6/fs/cifs/cifs_debug.c:141:25: error: ‘struct
TCP_Server_Info’ has no member named ‘in_send’
  141 |      atomic_read(&server->in_send),
      |                         ^~
/home/smfrench/cifs-2.6/fs/cifs/cifs_debug.c:142:25: error: ‘struct
TCP_Server_Info’ has no member named ‘num_waiters’
  142 |      atomic_read(&server->num_waiters));

On Wed, Nov 20, 2019 at 10:16 AM Aurelien Aptel <aaptel@suse.com> wrote:
>
> * show server&TCP states for extra channels
> * mention if an interface has a channel connected to it
>
> Signed-off-by: Aurelien Aptel <aaptel@suse.com>
> ---
>  fs/cifs/cifs_debug.c | 35 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
> index efb2928ff6c8..c2dd07903d56 100644
> --- a/fs/cifs/cifs_debug.c
> +++ b/fs/cifs/cifs_debug.c
> @@ -121,6 +121,27 @@ static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon)
>         seq_putc(m, '\n');
>  }
>
> +static void
> +cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
> +{
> +       struct TCP_Server_Info *server = chan->server;
> +
> +       seq_printf(m, "\t\tChannel %d Number of credits: %d Dialect 0x%x "
> +                  "TCP status: %d Instance: %d Local Users To Server: %d "
> +                  "SecMode: 0x%x Req On Wire: %d In Send: %d "
> +                  "In MaxReq Wait: %d\n",
> +                  i+1,
> +                  server->credits,
> +                  server->dialect,
> +                  server->tcpStatus,
> +                  server->reconnect_instance,
> +                  server->srv_count,
> +                  server->sec_mode,
> +                  in_flight(server),
> +                  atomic_read(&server->in_send),
> +                  atomic_read(&server->num_waiters));
> +}
> +
>  static void
>  cifs_dump_iface(struct seq_file *m, struct cifs_server_iface *iface)
>  {
> @@ -377,6 +398,13 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
>                         if (ses->sign)
>                                 seq_puts(m, " signed");
>
> +                       if (ses->chan_count > 1) {
> +                               seq_printf(m, "\n\n\tExtra Channels: %lu\n",
> +                                          ses->chan_count-1);
> +                               for (j = 1; j < ses->chan_count; j++)
> +                                       cifs_dump_channel(m, j, &ses->chans[j]);
> +                       }
> +
>                         seq_puts(m, "\n\tShares:");
>                         j = 0;
>
> @@ -415,8 +443,13 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
>                                 seq_printf(m, "\n\tServer interfaces: %zu\n",
>                                            ses->iface_count);
>                         for (j = 0; j < ses->iface_count; j++) {
> +                               struct cifs_server_iface *iface;
> +
> +                               iface = &ses->iface_list[j];
>                                 seq_printf(m, "\t%d)", j);
> -                               cifs_dump_iface(m, &ses->iface_list[j]);
> +                               cifs_dump_iface(m, iface);
> +                               if (is_ses_using_iface(ses, iface))
> +                                       seq_puts(m, "\t\t[CONNECTED]\n");
>                         }
>                         spin_unlock(&ses->iface_lock);
>                 }
> --
> 2.16.4
>
Steve French Nov. 21, 2019, 11:44 p.m. UTC | #2
This wouldn't build due to CONFIG_CIFS_STATS2 but I merged it and
fixed the build break by adding a followon patch which enables in_send
and num_waiters by default (not requiring CONFIG_CIFS_STATS2 for those
two counters)

On Wed, Nov 20, 2019 at 10:16 AM Aurelien Aptel <aaptel@suse.com> wrote:
>
> * show server&TCP states for extra channels
> * mention if an interface has a channel connected to it
>
> Signed-off-by: Aurelien Aptel <aaptel@suse.com>
> ---
>  fs/cifs/cifs_debug.c | 35 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
> index efb2928ff6c8..c2dd07903d56 100644
> --- a/fs/cifs/cifs_debug.c
> +++ b/fs/cifs/cifs_debug.c
> @@ -121,6 +121,27 @@ static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon)
>         seq_putc(m, '\n');
>  }
>
> +static void
> +cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
> +{
> +       struct TCP_Server_Info *server = chan->server;
> +
> +       seq_printf(m, "\t\tChannel %d Number of credits: %d Dialect 0x%x "
> +                  "TCP status: %d Instance: %d Local Users To Server: %d "
> +                  "SecMode: 0x%x Req On Wire: %d In Send: %d "
> +                  "In MaxReq Wait: %d\n",
> +                  i+1,
> +                  server->credits,
> +                  server->dialect,
> +                  server->tcpStatus,
> +                  server->reconnect_instance,
> +                  server->srv_count,
> +                  server->sec_mode,
> +                  in_flight(server),
> +                  atomic_read(&server->in_send),
> +                  atomic_read(&server->num_waiters));
> +}
> +
>  static void
>  cifs_dump_iface(struct seq_file *m, struct cifs_server_iface *iface)
>  {
> @@ -377,6 +398,13 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
>                         if (ses->sign)
>                                 seq_puts(m, " signed");
>
> +                       if (ses->chan_count > 1) {
> +                               seq_printf(m, "\n\n\tExtra Channels: %lu\n",
> +                                          ses->chan_count-1);
> +                               for (j = 1; j < ses->chan_count; j++)
> +                                       cifs_dump_channel(m, j, &ses->chans[j]);
> +                       }
> +
>                         seq_puts(m, "\n\tShares:");
>                         j = 0;
>
> @@ -415,8 +443,13 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
>                                 seq_printf(m, "\n\tServer interfaces: %zu\n",
>                                            ses->iface_count);
>                         for (j = 0; j < ses->iface_count; j++) {
> +                               struct cifs_server_iface *iface;
> +
> +                               iface = &ses->iface_list[j];
>                                 seq_printf(m, "\t%d)", j);
> -                               cifs_dump_iface(m, &ses->iface_list[j]);
> +                               cifs_dump_iface(m, iface);
> +                               if (is_ses_using_iface(ses, iface))
> +                                       seq_puts(m, "\t\t[CONNECTED]\n");
>                         }
>                         spin_unlock(&ses->iface_lock);
>                 }
> --
> 2.16.4
>

Patch
diff mbox series

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index efb2928ff6c8..c2dd07903d56 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -121,6 +121,27 @@  static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon)
 	seq_putc(m, '\n');
 }
 
+static void
+cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
+{
+	struct TCP_Server_Info *server = chan->server;
+
+	seq_printf(m, "\t\tChannel %d Number of credits: %d Dialect 0x%x "
+		   "TCP status: %d Instance: %d Local Users To Server: %d "
+		   "SecMode: 0x%x Req On Wire: %d In Send: %d "
+		   "In MaxReq Wait: %d\n",
+		   i+1,
+		   server->credits,
+		   server->dialect,
+		   server->tcpStatus,
+		   server->reconnect_instance,
+		   server->srv_count,
+		   server->sec_mode,
+		   in_flight(server),
+		   atomic_read(&server->in_send),
+		   atomic_read(&server->num_waiters));
+}
+
 static void
 cifs_dump_iface(struct seq_file *m, struct cifs_server_iface *iface)
 {
@@ -377,6 +398,13 @@  static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 			if (ses->sign)
 				seq_puts(m, " signed");
 
+			if (ses->chan_count > 1) {
+				seq_printf(m, "\n\n\tExtra Channels: %lu\n",
+					   ses->chan_count-1);
+				for (j = 1; j < ses->chan_count; j++)
+					cifs_dump_channel(m, j, &ses->chans[j]);
+			}
+
 			seq_puts(m, "\n\tShares:");
 			j = 0;
 
@@ -415,8 +443,13 @@  static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 				seq_printf(m, "\n\tServer interfaces: %zu\n",
 					   ses->iface_count);
 			for (j = 0; j < ses->iface_count; j++) {
+				struct cifs_server_iface *iface;
+
+				iface = &ses->iface_list[j];
 				seq_printf(m, "\t%d)", j);
-				cifs_dump_iface(m, &ses->iface_list[j]);
+				cifs_dump_iface(m, iface);
+				if (is_ses_using_iface(ses, iface))
+					seq_puts(m, "\t\t[CONNECTED]\n");
 			}
 			spin_unlock(&ses->iface_lock);
 		}