xfs: Simplify xfs_ail_min() with list_first_entry_or_null()
PATCH 1/1 xfs: Simplify xfs_ail_min() with list_first_entry_or_null()
From: Jie Liu <[email protected]>
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
--- fs/xfs/xfs_trans_ail.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
fs/xfs/xfs_trans_ail.c +1 -4
@@ -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); }/*
Signature · 6 lines
1.7.9.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 21 lines · Jeff Liu
From: Jie Liu <[email protected]>
At
xfs_ail_min(), we do check if the AIL list is empty or not before returning the first item in it withlist_empty()andlist_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: introducelist_first_entry_or_nullSigned-off-by Jie Liu <[email protected]>--- fs/xfs/xfs_trans_ail.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)fs/xfs/xfs_trans_ail.c +0
-0
fs/xfs/xfs_trans_ail.c xfs_log_item_t * · line 72
Quoted 9 lines
fs/xfs/xfs_trans_ail.c +1
-4@@ -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); }
At this point, it can become a static inline function in xfs_trans_priv.h. And while you are touching this, remove the typedef...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 27 lines · Dave Chinner
Quoted 26 lines · Jeff Liu
From: Jie Liu <[email protected]>
At
xfs_ail_min(), we do check if the AIL list is empty or not before returning the first item in it withlist_empty()andlist_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: introducelist_first_entry_or_nullSigned-off-by Jie Liu <[email protected]>--- fs/xfs/xfs_trans_ail.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)fs/xfs/xfs_trans_ail.c +0
-2@@ -68,10 +68,7 @@ xfs_log_item_t *xfs_ail_min ( struct xfs_ail *ailp) { -if (list_empty (&ailp->xa_ail)) -return NULL ;
Quoted 8 lines
fs/xfs/xfs_trans_ail.c xfs_log_item_t * · line 72
Quoted 4 lines
fs/xfs/xfs_trans_ail.c +1
-2- -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); }At this point, it can become a static inline function in
xfs_trans_priv.h. And while you are touching this, remove the typedef...
Ok, I'll take care of that.
Thanks,
-Jeff
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs