From: Jeff Liu <jeff.liu@oracle.com>
To: "xfs@oss.sgi.com" <xfs@oss.sgi.com>
Subject: [PATCH] xfs: Simplify xfs_ail_min() with list_first_entry_or_null()
Date: Wed, 14 Aug 2013 16:27:56 +0800 [thread overview]
Message-ID: <520B3F8C.5020405@oracle.com> (raw)
From: Jie Liu <jeff.liu@oracle.com>
At xfs_ail_min(), we do check if the AIL list is empty or not before
returning the first item in it with list_empty() and list_first_entry().
This can be simplified a bit with a new list operation routine that is
the list_first_entry_or_null() which has been introduced by:
commit 6d7581e62f8be462440d7b22c6361f7c9fa4902b
list: introduce list_first_entry_or_null
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
fs/xfs/xfs_trans_ail.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 0eda725..e91d160 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -68,10 +68,7 @@ xfs_log_item_t *
xfs_ail_min(
struct xfs_ail *ailp)
{
- if (list_empty(&ailp->xa_ail))
- return NULL;
-
- return list_first_entry(&ailp->xa_ail, xfs_log_item_t, li_ail);
+ return list_first_entry_or_null(&ailp->xa_ail, xfs_log_item_t, li_ail);
}
/*
--
1.7.9.5
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2013-08-14 8:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 8:27 Jeff Liu [this message]
2013-08-14 23:25 ` [PATCH] xfs: Simplify xfs_ail_min() with list_first_entry_or_null() Dave Chinner
2013-08-15 4:47 ` Jeff Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=520B3F8C.5020405@oracle.com \
--to=jeff.liu@oracle.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox