aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_trans_ail.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2011-07-17 23:40:17 -0400
committerAlex Elder <aelder@sgi.com>2011-07-20 19:37:37 -0400
commit16b5902943c793e632cf8c9526619f59893bdc29 (patch)
tree84769a5a36744ab7ad9288d8359c520ec2f8e101 /fs/xfs/xfs_trans_ail.c
parent1d8c95a363bf8cd4d4182dd19c01693b635311c2 (diff)
xfs: remove confusing ail cursor wrapper
xfs_trans_ail_cursor_set() doesn't set the cursor to the current log item, it sets it to the next item. There is already a function for doing this - xfs_trans_ail_cursor_next() - and the _set function is simply a two line wrapper. Remove it and open code the setting of the cursor in the two locations that call it to remove the confusion. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_trans_ail.c')
-rw-r--r--fs/xfs/xfs_trans_ail.c50
1 files changed, 19 insertions, 31 deletions
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 9a69dc06ea86..7908c798a02b 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -189,20 +189,6 @@ xfs_trans_ail_cursor_init(
189} 189}
190 190
191/* 191/*
192 * Set the cursor to the next item, because when we look
193 * up the cursor the current item may have been freed.
194 */
195STATIC void
196xfs_trans_ail_cursor_set(
197 struct xfs_ail *ailp,
198 struct xfs_ail_cursor *cur,
199 struct xfs_log_item *lip)
200{
201 if (lip)
202 cur->item = xfs_ail_next(ailp, lip);
203}
204
205/*
206 * Get the next item in the traversal and advance the cursor. 192 * Get the next item in the traversal and advance the cursor.
207 * If the cursor was invalidated (inidicated by a lip of 1), 193 * If the cursor was invalidated (inidicated by a lip of 1),
208 * restart the traversal. 194 * restart the traversal.
@@ -216,7 +202,8 @@ xfs_trans_ail_cursor_next(
216 202
217 if ((__psint_t)lip & 1) 203 if ((__psint_t)lip & 1)
218 lip = xfs_ail_min(ailp); 204 lip = xfs_ail_min(ailp);
219 xfs_trans_ail_cursor_set(ailp, cur, lip); 205 if (lip)
206 cur->item = xfs_ail_next(ailp, lip);
220 return lip; 207 return lip;
221} 208}
222 209
@@ -272,9 +259,10 @@ xfs_trans_ail_cursor_clear(
272} 259}
273 260
274/* 261/*
275 * Initialise the cursor to the first item in the AIL with the given @lsn. 262 * Find the first item in the AIL with the given @lsn by searching in ascending
276 * This searches the list from lowest LSN to highest. Pass a @lsn of zero 263 * LSN order and initialise the cursor to point to the next item for a
277 * to initialise the cursor to the first item in the AIL. 264 * ascending traversal. Pass a @lsn of zero to initialise the cursor to the
265 * first item in the AIL. Returns NULL if the list is empty.
278 */ 266 */
279xfs_log_item_t * 267xfs_log_item_t *
280xfs_trans_ail_cursor_first( 268xfs_trans_ail_cursor_first(
@@ -285,26 +273,24 @@ xfs_trans_ail_cursor_first(
285 xfs_log_item_t *lip; 273 xfs_log_item_t *lip;
286 274
287 xfs_trans_ail_cursor_init(ailp, cur); 275 xfs_trans_ail_cursor_init(ailp, cur);
288 lip = xfs_ail_min(ailp); 276
289 if (lsn == 0) 277 if (lsn == 0) {
278 lip = xfs_ail_min(ailp);
290 goto out; 279 goto out;
280 }
291 281
292 list_for_each_entry(lip, &ailp->xa_ail, li_ail) { 282 list_for_each_entry(lip, &ailp->xa_ail, li_ail) {
293 if (XFS_LSN_CMP(lip->li_lsn, lsn) >= 0) 283 if (XFS_LSN_CMP(lip->li_lsn, lsn) >= 0)
294 goto out; 284 goto out;
295 } 285 }
296 lip = NULL; 286 return NULL;
287
297out: 288out:
298 xfs_trans_ail_cursor_set(ailp, cur, lip); 289 if (lip)
290 cur->item = xfs_ail_next(ailp, lip);
299 return lip; 291 return lip;
300} 292}
301 293
302/*
303 * Initialise the cursor to the last item in the AIL with the given @lsn.
304 * This searches the list from highest LSN to lowest. If there is no item with
305 * the value of @lsn, then it sets the cursor to the last item with an LSN lower
306 * than @lsn.
307 */
308static struct xfs_log_item * 294static struct xfs_log_item *
309__xfs_trans_ail_cursor_last( 295__xfs_trans_ail_cursor_last(
310 struct xfs_ail *ailp, 296 struct xfs_ail *ailp,
@@ -320,8 +306,10 @@ __xfs_trans_ail_cursor_last(
320} 306}
321 307
322/* 308/*
323 * Initialise the cursor to the last item in the AIL with the given @lsn. 309 * Find the last item in the AIL with the given @lsn by searching in descending
324 * This searches the list from highest LSN to lowest. 310 * LSN order and initialise the cursor to point to that item. If there is no
311 * item with the value of @lsn, then it sets the cursor to the last item with an
312 * LSN lower than @lsn. Returns NULL if the list is empty.
325 */ 313 */
326struct xfs_log_item * 314struct xfs_log_item *
327xfs_trans_ail_cursor_last( 315xfs_trans_ail_cursor_last(
@@ -335,7 +323,7 @@ xfs_trans_ail_cursor_last(
335} 323}
336 324
337/* 325/*
338 * splice the log item list into the AIL at the given LSN. We splice to the 326 * Splice the log item list into the AIL at the given LSN. We splice to the
339 * tail of the given LSN to maintain insert order for push traversals. The 327 * tail of the given LSN to maintain insert order for push traversals. The
340 * cursor is optional, allowing repeated updates to the same LSN to avoid 328 * cursor is optional, allowing repeated updates to the same LSN to avoid
341 * repeated traversals. 329 * repeated traversals.