From patchwork Fri Nov 15 04:31:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "jeff.liu" X-Patchwork-Id: 291450 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 0D1852C00CA for ; Fri, 15 Nov 2013 15:32:09 +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 1VhB4c-00019X-H8; Fri, 15 Nov 2013 04:32:02 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VhB4Y-0004yz-74; Fri, 15 Nov 2013 04:31:58 +0000 Received: from aserp1040.oracle.com ([141.146.126.69]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VhB4W-0004xy-Bo for linux-mtd@lists.infradead.org; Fri, 15 Nov 2013 04:31:56 +0000 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rAF4VWid011805 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Nov 2013 04:31:33 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rAF4VVf0027460 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 15 Nov 2013 04:31:32 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rAF4VVTi027440; Fri, 15 Nov 2013 04:31:31 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:31:29 -0800 Message-ID: <5285A39C.4030507@oracle.com> Date: Fri, 15 Nov 2013 12:31:24 +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 2/6] xfs: simplify xfs_ail_max() 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_233156_508027_693BABCA X-CRM114-Status: GOOD ( 12.10 ) 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 [141.146.126.69 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 xfs_ail_max() with list_last_entry_or_null(), and move it to xfs_trans_priv.h as an inline function as now it is one line. Signed-off-by: Jie Liu --- fs/xfs/xfs_trans_ail.c | 14 -------------- fs/xfs/xfs_trans_priv.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c index a728735..af605d0 100644 --- a/fs/xfs/xfs_trans_ail.c +++ b/fs/xfs/xfs_trans_ail.c @@ -62,20 +62,6 @@ xfs_ail_check( #endif /* DEBUG */ /* - * Return a pointer to the last item in the AIL. If the AIL is empty, then - * return NULL. - */ -static xfs_log_item_t * -xfs_ail_max( - struct xfs_ail *ailp) -{ - if (list_empty(&ailp->xa_ail)) - return NULL; - - return list_entry(ailp->xa_ail.prev, xfs_log_item_t, li_ail); -} - -/* * Return a pointer to the item which follows the given item in the AIL. If * the given item is the last item in the list, then return NULL. */ diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h index 12e86af..b1d93ae 100644 --- a/fs/xfs/xfs_trans_priv.h +++ b/fs/xfs/xfs_trans_priv.h @@ -97,6 +97,18 @@ xfs_ail_min( li_ail); } +/* + * Return a pointer to the last item in the AIL. If the AIL is empty, then + * return NULL. + */ +static inline struct xfs_log_item * +xfs_ail_max( + struct xfs_ail *ailp) +{ + return list_last_entry_or_null(&ailp->xa_ail, struct xfs_log_item, + li_ail); +} + static inline void xfs_trans_ail_update( struct xfs_ail *ailp,