jfs: simplify lmLogSync() via list_last_entry_or_null()
Subsystems (2)
PATCH 6/6 jfs: simplify lmLogSync() via list_last_entry_or_null()
From: Jie Liu <[email protected]>
Simplify the code in lmLogSync() via list_last_entry_or_null().
Signed-off-by Jie Liu <[email protected]>
--- fs/jfs/jfs_logmgr.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
fs/jfs/jfs_logmgr.c +3 -7
@@ -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); }
Signature · 1 line
1.8.3.2
Hi Dave and all,
Please ignore this patch from this series.
Quoted 16 lines · Jeff Liu
From: Jie Liu <[email protected]>
Simplify the code in
lmLogSync()vialist_last_entry_or_null().Signed-off-by Jie Liu <[email protected]>--- fs/jfs/jfs_logmgr.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)fs/jfs/jfs_logmgr.c +0
-0@@ -963,13 +963,9 @@ static int lmLogSync(struct jfs_log * log, int hard_sync)if (log->sync == log->syncpt) {
fs/jfs/jfs_logmgr.c static int lmLogSync(struct jfs_log * log, int hard_sync) · line 967
Quoted 10 lines
fs/jfs/jfs_logmgr.c +2
-7LOGSYNC_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.
fs/jfs/jfs_logmgr.c static int lmLogSync(struct jfs_log * log, int hard_sync) · line 971
Quoted 5 lines
fs/jfs/jfs_logmgr.c +1
-0+ log->sync = lp ? lp->lsn : log->lsn;LOGSYNC_UNLOCK (log, flags); }
Thanks,
-Jeff