* [PATCH] xfs: Simplify xfs_ail_min() with list_first_entry_or_null()
@ 2013-08-14 8:27 Jeff Liu
2013-08-14 23:25 ` Dave Chinner
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Liu @ 2013-08-14 8:27 UTC (permalink / raw)
To: xfs@oss.sgi.com
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] xfs: Simplify xfs_ail_min() with list_first_entry_or_null()
2013-08-14 8:27 [PATCH] xfs: Simplify xfs_ail_min() with list_first_entry_or_null() Jeff Liu
@ 2013-08-14 23:25 ` Dave Chinner
2013-08-15 4:47 ` Jeff Liu
0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2013-08-14 23:25 UTC (permalink / raw)
To: Jeff Liu; +Cc: xfs@oss.sgi.com
On Wed, Aug 14, 2013 at 04:27:56PM +0800, Jeff Liu wrote:
> 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);
> }
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.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] xfs: Simplify xfs_ail_min() with list_first_entry_or_null()
2013-08-14 23:25 ` Dave Chinner
@ 2013-08-15 4:47 ` Jeff Liu
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Liu @ 2013-08-15 4:47 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs@oss.sgi.com
On 08/15/2013 07:25 AM, Dave Chinner wrote:
> On Wed, Aug 14, 2013 at 04:27:56PM +0800, Jeff Liu wrote:
>> 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);
>> }
>
> 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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-15 4:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-14 8:27 [PATCH] xfs: Simplify xfs_ail_min() with list_first_entry_or_null() Jeff Liu
2013-08-14 23:25 ` Dave Chinner
2013-08-15 4:47 ` Jeff Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox