Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754441AbbLRPfM (ORCPT ); Fri, 18 Dec 2015 10:35:12 -0500 Received: from m50-133.163.com ([123.125.50.133]:54258 "EHLO m50-133.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751445AbbLRPfH (ORCPT ); Fri, 18 Dec 2015 10:35:07 -0500 From: Geliang Tang To: "J. Bruce Fields" , Jeff Layton , Trond Myklebust , Anna Schumaker , "David S. Miller" Cc: Geliang Tang , linux-nfs@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/14] sunrpc: use list_for_each_entry_safe Date: Fri, 18 Dec 2015 23:33:37 +0800 Message-Id: X-Mailer: git-send-email 2.5.0 In-Reply-To: References: In-Reply-To: References: X-CM-TRANSID: DdGowECJsFtuJ3RWFO6HAA--.912S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7Zw4UGF1kXw4DJF13ZF1DWrg_yoW8Gw1xpF 4fCa42kF4kZw1xWayrtw1F9rWrXFs5Jw1YkFW2kw1fXr17JFWqqr4xua4vvrZ8ZrWrZayY kF98Kr1Yy39rWaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UxnYwUUUUU= X-Originating-IP: [116.77.150.30] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbiGQ-UmVXlQAJhAQAAsJ Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1637 Lines: 51 Use list_for_each_entry_safe() instead of list_for_each_safe() to simplify the code. Signed-off-by: Geliang Tang --- net/sunrpc/svc_xprt.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index a6cbb21..fe4f628 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c @@ -904,8 +904,7 @@ out: static void svc_age_temp_xprts(unsigned long closure) { struct svc_serv *serv = (struct svc_serv *)closure; - struct svc_xprt *xprt; - struct list_head *le, *next; + struct svc_xprt *xprt, *next; dprintk("svc_age_temp_xprts\n"); @@ -916,9 +915,7 @@ static void svc_age_temp_xprts(unsigned long closure) return; } - list_for_each_safe(le, next, &serv->sv_tempsocks) { - xprt = list_entry(le, struct svc_xprt, xpt_list); - + list_for_each_entry_safe(xprt, next, &serv->sv_tempsocks, xpt_list) { /* First time through, just mark it OLD. Second time * through, close it. */ if (!test_and_set_bit(XPT_OLD, &xprt->xpt_flags)) @@ -926,7 +923,7 @@ static void svc_age_temp_xprts(unsigned long closure) if (atomic_read(&xprt->xpt_ref.refcount) > 1 || test_bit(XPT_BUSY, &xprt->xpt_flags)) continue; - list_del_init(le); + list_del_init(&xprt->xpt_list); set_bit(XPT_CLOSE, &xprt->xpt_flags); dprintk("queuing xprt %p for closing\n", xprt); -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/