linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 6/6] jfs: simplify lmLogSync() via list_last_entry_or_null()
@ 2013-11-15  4:35 Jeff Liu
  2013-11-15  4:50 ` Jeff Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Liu @ 2013-11-15  4:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, xfs, cluster-devel, linux-mtd, jfs-discussion, oleg, jiri, gregkh

From: Jie Liu <jeff.liu@oracle.com>

Simplify the code in lmLogSync() via list_last_entry_or_null().

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
 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);
 
 	}
-- 
1.8.3.2

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

* Re: [PATCH 6/6] jfs: simplify lmLogSync() via list_last_entry_or_null()
  2013-11-15  4:35 [PATCH 6/6] jfs: simplify lmLogSync() via list_last_entry_or_null() Jeff Liu
@ 2013-11-15  4:50 ` Jeff Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Liu @ 2013-11-15  4:50 UTC (permalink / raw)
  To: shaggy
  Cc: jfs-discussion, jiri, gregkh, oleg, xfs, cluster-devel,
	linux-mtd, akpm, linux-kernel

Hi Dave and all,

Please ignore this patch from this series.

On 11/15 2013 12:35 PM, Jeff Liu wrote:
> From: Jie Liu <jeff.liu@oracle.com>
> 
> Simplify the code in lmLogSync() via list_last_entry_or_null().
> 
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
> ---
>  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);
Here it could be simplified via list_first_entry_or_null(), my apology for this mistake.
> +		log->sync = lp ? lp->lsn : log->lsn;
>  		LOGSYNC_UNLOCK(log, flags);
>  
>  	}
> 

Thanks,
-Jeff

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

end of thread, other threads:[~2013-11-15  4:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-15  4:35 [PATCH 6/6] jfs: simplify lmLogSync() via list_last_entry_or_null() Jeff Liu
2013-11-15  4:50 ` Jeff Liu

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).