kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] cifs: convert list_for_each to entry variant in cifs_debug.c
@ 2021-06-17 11:36 Baokun Li
  2021-06-18  4:18 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: Baokun Li @ 2021-06-17 11:36 UTC (permalink / raw)
  To: libaokun1, Steve French
  Cc: linux-cifs, samba-technical, kernel-janitors, Hulk Robot

convert list_for_each() to list_for_each_entry() where
applicable.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
 fs/cifs/cifs_debug.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 68e8e5b27841..8857ac7e7a14 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -50,7 +50,6 @@ void cifs_dump_detail(void *buf, struct TCP_Server_Info *server)
 void cifs_dump_mids(struct TCP_Server_Info *server)
 {
 #ifdef CONFIG_CIFS_DEBUG2
-	struct list_head *tmp;
 	struct mid_q_entry *mid_entry;
 
 	if (server == NULL)
@@ -58,8 +57,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
 
 	cifs_dbg(VFS, "Dump pending requests:\n");
 	spin_lock(&GlobalMid_Lock);
-	list_for_each(tmp, &server->pending_mid_q) {
-		mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
+	list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) {
 		cifs_dbg(VFS, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %llu\n",
 			 mid_entry->mid_state,
 			 le16_to_cpu(mid_entry->command),
@@ -168,7 +166,7 @@ cifs_dump_iface(struct seq_file *m, struct cifs_server_iface *iface)
 
 static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
 {
-	struct list_head *stmp, *tmp, *tmp1, *tmp2;
+	struct list_head *tmp, *tmp1, *tmp2;
 	struct TCP_Server_Info *server;
 	struct cifs_ses *ses;
 	struct cifs_tcon *tcon;
@@ -183,9 +181,7 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
 	seq_printf(m, " <filename>\n");
 #endif /* CIFS_DEBUG2 */
 	spin_lock(&cifs_tcp_ses_lock);
-	list_for_each(stmp, &cifs_tcp_ses_list) {
-		server = list_entry(stmp, struct TCP_Server_Info,
-				    tcp_ses_list);
+	list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
 		list_for_each(tmp, &server->smb_ses_list) {
 			ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
 			list_for_each(tmp1, &ses->tcon_list) {
@@ -220,7 +216,7 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
 
 static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 {
-	struct list_head *tmp1, *tmp2, *tmp3;
+	struct list_head *tmp2, *tmp3;
 	struct mid_q_entry *mid_entry;
 	struct TCP_Server_Info *server;
 	struct cifs_ses *ses;
@@ -278,11 +274,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 
 	c = 0;
 	spin_lock(&cifs_tcp_ses_lock);
-	list_for_each(tmp1, &cifs_tcp_ses_list) {
-		server = list_entry(tmp1, struct TCP_Server_Info,
-				    tcp_ses_list);
-
-		/* channel info will be printed as a part of sessions below */
+	list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
 		if (server->is_channel)
 			continue;
 
@@ -563,7 +555,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
 #ifdef CONFIG_CIFS_STATS2
 	int j;
 #endif /* STATS2 */
-	struct list_head *tmp1, *tmp2, *tmp3;
+	struct list_head *tmp2, *tmp3;
 	struct TCP_Server_Info *server;
 	struct cifs_ses *ses;
 	struct cifs_tcon *tcon;
@@ -594,9 +586,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
 
 	i = 0;
 	spin_lock(&cifs_tcp_ses_lock);
-	list_for_each(tmp1, &cifs_tcp_ses_list) {
-		server = list_entry(tmp1, struct TCP_Server_Info,
-				    tcp_ses_list);
+	list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
 		seq_printf(m, "\nMax requests in flight: %d", server->max_in_flight);
 #ifdef CONFIG_CIFS_STATS2
 		seq_puts(m, "\nTotal time spent processing by command. Time ");


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] cifs: convert list_for_each to entry variant in cifs_debug.c
  2021-06-17 11:36 [PATCH -next] cifs: convert list_for_each to entry variant in cifs_debug.c Baokun Li
@ 2021-06-18  4:18 ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2021-06-18  4:18 UTC (permalink / raw)
  To: Baokun Li
  Cc: Steve French, CIFS, samba-technical, kernel-janitors, Hulk Robot

tentatively merged into cifs-2.6.git for-next

On Thu, Jun 17, 2021 at 6:40 AM Baokun Li <libaokun1@huawei.com> wrote:
>
> convert list_for_each() to list_for_each_entry() where
> applicable.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
> ---
>  fs/cifs/cifs_debug.c | 24 +++++++-----------------
>  1 file changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
> index 68e8e5b27841..8857ac7e7a14 100644
> --- a/fs/cifs/cifs_debug.c
> +++ b/fs/cifs/cifs_debug.c
> @@ -50,7 +50,6 @@ void cifs_dump_detail(void *buf, struct TCP_Server_Info *server)
>  void cifs_dump_mids(struct TCP_Server_Info *server)
>  {
>  #ifdef CONFIG_CIFS_DEBUG2
> -       struct list_head *tmp;
>         struct mid_q_entry *mid_entry;
>
>         if (server == NULL)
> @@ -58,8 +57,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
>
>         cifs_dbg(VFS, "Dump pending requests:\n");
>         spin_lock(&GlobalMid_Lock);
> -       list_for_each(tmp, &server->pending_mid_q) {
> -               mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
> +       list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) {
>                 cifs_dbg(VFS, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %llu\n",
>                          mid_entry->mid_state,
>                          le16_to_cpu(mid_entry->command),
> @@ -168,7 +166,7 @@ cifs_dump_iface(struct seq_file *m, struct cifs_server_iface *iface)
>
>  static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
>  {
> -       struct list_head *stmp, *tmp, *tmp1, *tmp2;
> +       struct list_head *tmp, *tmp1, *tmp2;
>         struct TCP_Server_Info *server;
>         struct cifs_ses *ses;
>         struct cifs_tcon *tcon;
> @@ -183,9 +181,7 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
>         seq_printf(m, " <filename>\n");
>  #endif /* CIFS_DEBUG2 */
>         spin_lock(&cifs_tcp_ses_lock);
> -       list_for_each(stmp, &cifs_tcp_ses_list) {
> -               server = list_entry(stmp, struct TCP_Server_Info,
> -                                   tcp_ses_list);
> +       list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
>                 list_for_each(tmp, &server->smb_ses_list) {
>                         ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
>                         list_for_each(tmp1, &ses->tcon_list) {
> @@ -220,7 +216,7 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
>
>  static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
>  {
> -       struct list_head *tmp1, *tmp2, *tmp3;
> +       struct list_head *tmp2, *tmp3;
>         struct mid_q_entry *mid_entry;
>         struct TCP_Server_Info *server;
>         struct cifs_ses *ses;
> @@ -278,11 +274,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
>
>         c = 0;
>         spin_lock(&cifs_tcp_ses_lock);
> -       list_for_each(tmp1, &cifs_tcp_ses_list) {
> -               server = list_entry(tmp1, struct TCP_Server_Info,
> -                                   tcp_ses_list);
> -
> -               /* channel info will be printed as a part of sessions below */
> +       list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
>                 if (server->is_channel)
>                         continue;
>
> @@ -563,7 +555,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
>  #ifdef CONFIG_CIFS_STATS2
>         int j;
>  #endif /* STATS2 */
> -       struct list_head *tmp1, *tmp2, *tmp3;
> +       struct list_head *tmp2, *tmp3;
>         struct TCP_Server_Info *server;
>         struct cifs_ses *ses;
>         struct cifs_tcon *tcon;
> @@ -594,9 +586,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
>
>         i = 0;
>         spin_lock(&cifs_tcp_ses_lock);
> -       list_for_each(tmp1, &cifs_tcp_ses_list) {
> -               server = list_entry(tmp1, struct TCP_Server_Info,
> -                                   tcp_ses_list);
> +       list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
>                 seq_printf(m, "\nMax requests in flight: %d", server->max_in_flight);
>  #ifdef CONFIG_CIFS_STATS2
>                 seq_puts(m, "\nTotal time spent processing by command. Time ");
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-18  4:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 11:36 [PATCH -next] cifs: convert list_for_each to entry variant in cifs_debug.c Baokun Li
2021-06-18  4:18 ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).