From patchwork Fri Nov 15 04:35:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "jeff.liu" X-Patchwork-Id: 291454 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3479A2C00A6 for ; Fri, 15 Nov 2013 15:35:56 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VhB8I-00027q-2U; Fri, 15 Nov 2013 04:35:50 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VhB8G-00058O-8q; Fri, 15 Nov 2013 04:35:48 +0000 Received: from userp1040.oracle.com ([156.151.31.81]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VhB8E-00056z-IO for linux-mtd@lists.infradead.org; Fri, 15 Nov 2013 04:35:47 +0000 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rAF4ZMmD032303 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Nov 2013 04:35:23 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rAF4ZLmx007373 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 15 Nov 2013 04:35:21 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rAF4ZLUM016267; Fri, 15 Nov 2013 04:35:21 GMT Received: from [192.168.1.103] (/123.119.103.122) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 14 Nov 2013 20:35:20 -0800 Message-ID: <5285A483.3040009@oracle.com> Date: Fri, 15 Nov 2013 12:35:15 +0800 From: Jeff Liu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: linux-kernel@vger.kernel.org Subject: [PATCH 6/6] jfs: simplify lmLogSync() via list_last_entry_or_null() X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131114_233546_951010_6FE5E8DA X-CRM114-Status: GOOD ( 11.17 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [156.151.31.81 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: jfs-discussion@lists.sourceforge.net, jiri@resnulli.us, gregkh@linuxfoundation.org, oleg@redhat.com, "xfs@oss.sgi.com" , cluster-devel@redhat.com, linux-mtd@lists.infradead.org, akpm@linux-foundation.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Jie Liu Simplify the code in lmLogSync() via list_last_entry_or_null(). Signed-off-by: Jie Liu --- fs/jfs/jfs_logmgr.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 7b565d0..2f90779 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c @@ -963,13 +963,9 @@ static int lmLogSync(struct jfs_log * log, int hard_sync) if (log->sync == log->syncpt) { LOGSYNC_LOCK(log, flags); - if (list_empty(&log->synclist)) - log->sync = log->lsn; - else { - lp = list_entry(log->synclist.next, - struct logsyncblk, synclist); - log->sync = lp->lsn; - } + lp = list_last_entry_or_null(&log->synclist, struct logsyncblk, + synclist); + log->sync = lp ? lp->lsn : log->lsn; LOGSYNC_UNLOCK(log, flags); }