From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Liu Date: Fri, 15 Nov 2013 12:33:56 +0800 Subject: [Cluster-devel] [PATCH 4/6] ubifs: simplify drop_last_node() via list_last_entry_or_null() Message-ID: <5285A434.2080608@oracle.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit From: Jie Liu Simplify the code in drop_last_node() via list_last_entry_or_null(). Signed-off-by: Jie Liu --- fs/ubifs/recovery.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 065096e..e46c394 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c @@ -603,12 +603,10 @@ static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs) */ static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs) { - struct ubifs_scan_node *snod; - - if (!list_empty(&sleb->nodes)) { - snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node, - list); + struct ubifs_scan_node *snod = list_last_entry_or_null(&sleb->nodes, + struct ubifs_scan_node, list); + if (snod) { dbg_rcvry("dropping last node at %d:%d", sleb->lnum, snod->offs); *offs = snod->offs; -- 1.8.3.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from aserp1040.oracle.com ([141.146.126.69]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VhB6v-00053t-Q0 for linux-mtd@lists.infradead.org; Fri, 15 Nov 2013 04:34:26 +0000 Message-ID: <5285A434.2080608@oracle.com> Date: Fri, 15 Nov 2013 12:33:56 +0800 From: Jeff Liu MIME-Version: 1.0 To: linux-kernel@vger.kernel.org Subject: [PATCH 4/6] ubifs: simplify drop_last_node() via list_last_entry_or_null() Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Jie Liu Simplify the code in drop_last_node() via list_last_entry_or_null(). Signed-off-by: Jie Liu --- fs/ubifs/recovery.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 065096e..e46c394 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c @@ -603,12 +603,10 @@ static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs) */ static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs) { - struct ubifs_scan_node *snod; - - if (!list_empty(&sleb->nodes)) { - snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node, - list); + struct ubifs_scan_node *snod = list_last_entry_or_null(&sleb->nodes, + struct ubifs_scan_node, list); + if (snod) { dbg_rcvry("dropping last node at %d:%d", sleb->lnum, snod->offs); *offs = snod->offs; -- 1.8.3.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay.sgi.com (relay3.corp.sgi.com [198.149.34.15]) by oss.sgi.com (Postfix) with ESMTP id 545057F72 for ; Thu, 14 Nov 2013 22:34:35 -0600 (CST) Received: from cuda.sgi.com (cuda2.sgi.com [192.48.176.25]) by relay3.corp.sgi.com (Postfix) with ESMTP id DAD79AC00C for ; Thu, 14 Nov 2013 20:34:34 -0800 (PST) Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) by cuda.sgi.com with ESMTP id g90QzApYxXYSspVr (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO) for ; Thu, 14 Nov 2013 20:34:33 -0800 (PST) Message-ID: <5285A434.2080608@oracle.com> Date: Fri, 15 Nov 2013 12:33:56 +0800 From: Jeff Liu MIME-Version: 1.0 Subject: [PATCH 4/6] ubifs: simplify drop_last_node() via list_last_entry_or_null() List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com To: linux-kernel@vger.kernel.org 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 From: Jie Liu Simplify the code in drop_last_node() via list_last_entry_or_null(). Signed-off-by: Jie Liu --- fs/ubifs/recovery.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 065096e..e46c394 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c @@ -603,12 +603,10 @@ static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs) */ static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs) { - struct ubifs_scan_node *snod; - - if (!list_empty(&sleb->nodes)) { - snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node, - list); + struct ubifs_scan_node *snod = list_last_entry_or_null(&sleb->nodes, + struct ubifs_scan_node, list); + if (snod) { dbg_rcvry("dropping last node at %d:%d", sleb->lnum, snod->offs); *offs = snod->offs; -- 1.8.3.2 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757701Ab3KOEek (ORCPT ); Thu, 14 Nov 2013 23:34:40 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:51041 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756703Ab3KOEef (ORCPT ); Thu, 14 Nov 2013 23:34:35 -0500 Message-ID: <5285A434.2080608@oracle.com> Date: Fri, 15 Nov 2013 12:33:56 +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 CC: akpm@linux-foundation.org, "xfs@oss.sgi.com" , cluster-devel@redhat.com, linux-mtd@lists.infradead.org, jfs-discussion@lists.sourceforge.net, oleg@redhat.com, jiri@resnulli.us, gregkh@linuxfoundation.org Subject: [PATCH 4/6] ubifs: simplify drop_last_node() via list_last_entry_or_null() Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jie Liu Simplify the code in drop_last_node() via list_last_entry_or_null(). Signed-off-by: Jie Liu --- fs/ubifs/recovery.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 065096e..e46c394 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c @@ -603,12 +603,10 @@ static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs) */ static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs) { - struct ubifs_scan_node *snod; - - if (!list_empty(&sleb->nodes)) { - snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node, - list); + struct ubifs_scan_node *snod = list_last_entry_or_null(&sleb->nodes, + struct ubifs_scan_node, list); + if (snod) { dbg_rcvry("dropping last node at %d:%d", sleb->lnum, snod->offs); *offs = snod->offs; -- 1.8.3.2