[Top] [All Lists]

Re: [PATCH 3/4] xfs: simplify xfs_ail_max

To: Jeff Liu <jeff.liu@xxxxxxxxxx>
Subject: Re: [PATCH 3/4] xfs: simplify xfs_ail_max
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Mon, 30 Dec 2013 09:07:24 -0600
Cc: "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <52B9829A.10804@xxxxxxxxxx>
References: <52B9829A.10804@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120122 Thunderbird/9.0
On 12/24/13 06:48, Jeff Liu wrote:
From: Jie Liu<jeff.liu@xxxxxxxxxx>

We have already simplified xfs_ail_min() with a new list helper, i.e,
list_first_entry_or_null(), but xfs_ail_max() still remains as same
as there is no corresponding list helper we can use for now.  It's
fairly easy to simulate the list behavior of getting the last item
in the AIL, therefore we can simplify xfs_ail_max() and move it to
the header file to make this pair of AIL routines looks symmetrical.

Signed-off-by: Jie Liu<jeff.liu@xxxxxxxxxx>

+ * Return a pointer to the last item in the AIL.  If the AIL is empty, then
+ * return NULL.
+ */
+static inline struct xfs_log_item *
+       struct xfs_ail  *ailp)
+       return list_empty(&ailp->xa_ail) ? NULL :
+               list_last_entry(&ailp->xa_ail, struct xfs_log_item, li_ail);
  static inline void
        struct xfs_ail          *ailp,

Looks good.

Reviewed-by: Mark Tinguely <tinguely@xxxxxxx>

<Prev in Thread] Current Thread [Next in Thread>