aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_trans_ail.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2010-12-03 00:42:57 -0500
committerDave Chinner <david@fromorbit.com>2010-12-03 00:42:57 -0500
commiteb3efa1249b6413be930bdf13d10b6238028a440 (patch)
tree7b2d8b9d55d5757236ef90389bc6664784607930 /fs/xfs/xfs_trans_ail.c
parentb199c8a4ba11879df87daad496ceee41fdc6aa82 (diff)
xfs: clean up xfs_ail_delete()
xfs_ail_delete() has a needlessly complex interface. It returns the log item that was passed in for deletion (which the callers then assert is identical to the one passed in), and callers of xfs_ail_delete() still need to invalidate current traversal cursors. Make xfs_ail_delete() return void, move the cursor invalidation inside it, and clean up the callers just to use the log item pointer they passed in. While cleaning up, remove the messy and unnecessary "/* ARGUSED */" comments around all these functions. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_trans_ail.c')
-rw-r--r--fs/xfs/xfs_trans_ail.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index dc9069568ff7..645928cab42d 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -29,7 +29,7 @@
29#include "xfs_error.h" 29#include "xfs_error.h"
30 30
31STATIC void xfs_ail_insert(struct xfs_ail *, xfs_log_item_t *); 31STATIC void xfs_ail_insert(struct xfs_ail *, xfs_log_item_t *);
32STATIC xfs_log_item_t * xfs_ail_delete(struct xfs_ail *, xfs_log_item_t *); 32STATIC void xfs_ail_delete(struct xfs_ail *, xfs_log_item_t *);
33STATIC xfs_log_item_t * xfs_ail_min(struct xfs_ail *); 33STATIC xfs_log_item_t * xfs_ail_min(struct xfs_ail *);
34STATIC xfs_log_item_t * xfs_ail_next(struct xfs_ail *, xfs_log_item_t *); 34STATIC xfs_log_item_t * xfs_ail_next(struct xfs_ail *, xfs_log_item_t *);
35 35
@@ -468,16 +468,13 @@ xfs_trans_ail_update(
468 xfs_log_item_t *lip, 468 xfs_log_item_t *lip,
469 xfs_lsn_t lsn) __releases(ailp->xa_lock) 469 xfs_lsn_t lsn) __releases(ailp->xa_lock)
470{ 470{
471 xfs_log_item_t *dlip = NULL;
472 xfs_log_item_t *mlip; /* ptr to minimum lip */ 471 xfs_log_item_t *mlip; /* ptr to minimum lip */
473 xfs_lsn_t tail_lsn; 472 xfs_lsn_t tail_lsn;
474 473
475 mlip = xfs_ail_min(ailp); 474 mlip = xfs_ail_min(ailp);
476 475
477 if (lip->li_flags & XFS_LI_IN_AIL) { 476 if (lip->li_flags & XFS_LI_IN_AIL) {
478 dlip = xfs_ail_delete(ailp, lip); 477 xfs_ail_delete(ailp, lip);
479 ASSERT(dlip == lip);
480 xfs_trans_ail_cursor_clear(ailp, dlip);
481 } else { 478 } else {
482 lip->li_flags |= XFS_LI_IN_AIL; 479 lip->li_flags |= XFS_LI_IN_AIL;
483 } 480 }
@@ -485,7 +482,7 @@ xfs_trans_ail_update(
485 lip->li_lsn = lsn; 482 lip->li_lsn = lsn;
486 xfs_ail_insert(ailp, lip); 483 xfs_ail_insert(ailp, lip);
487 484
488 if (mlip == dlip) { 485 if (mlip == lip) {
489 mlip = xfs_ail_min(ailp); 486 mlip = xfs_ail_min(ailp);
490 /* 487 /*
491 * It is not safe to access mlip after the AIL lock is 488 * It is not safe to access mlip after the AIL lock is
@@ -524,21 +521,18 @@ xfs_trans_ail_delete(
524 struct xfs_ail *ailp, 521 struct xfs_ail *ailp,
525 xfs_log_item_t *lip) __releases(ailp->xa_lock) 522 xfs_log_item_t *lip) __releases(ailp->xa_lock)
526{ 523{
527 xfs_log_item_t *dlip;
528 xfs_log_item_t *mlip; 524 xfs_log_item_t *mlip;
529 xfs_lsn_t tail_lsn; 525 xfs_lsn_t tail_lsn;
530 526
531 if (lip->li_flags & XFS_LI_IN_AIL) { 527 if (lip->li_flags & XFS_LI_IN_AIL) {
532 mlip = xfs_ail_min(ailp); 528 mlip = xfs_ail_min(ailp);
533 dlip = xfs_ail_delete(ailp, lip); 529 xfs_ail_delete(ailp, lip);
534 ASSERT(dlip == lip);
535 xfs_trans_ail_cursor_clear(ailp, dlip);
536 530
537 531
538 lip->li_flags &= ~XFS_LI_IN_AIL; 532 lip->li_flags &= ~XFS_LI_IN_AIL;
539 lip->li_lsn = 0; 533 lip->li_lsn = 0;
540 534
541 if (mlip == dlip) { 535 if (mlip == lip) {
542 mlip = xfs_ail_min(ailp); 536 mlip = xfs_ail_min(ailp);
543 /* 537 /*
544 * It is not safe to access mlip after the AIL lock 538 * It is not safe to access mlip after the AIL lock
@@ -632,7 +626,6 @@ STATIC void
632xfs_ail_insert( 626xfs_ail_insert(
633 struct xfs_ail *ailp, 627 struct xfs_ail *ailp,
634 xfs_log_item_t *lip) 628 xfs_log_item_t *lip)
635/* ARGSUSED */
636{ 629{
637 xfs_log_item_t *next_lip; 630 xfs_log_item_t *next_lip;
638 631
@@ -661,18 +654,14 @@ xfs_ail_insert(
661/* 654/*
662 * Delete the given item from the AIL. Return a pointer to the item. 655 * Delete the given item from the AIL. Return a pointer to the item.
663 */ 656 */
664/*ARGSUSED*/ 657STATIC void
665STATIC xfs_log_item_t *
666xfs_ail_delete( 658xfs_ail_delete(
667 struct xfs_ail *ailp, 659 struct xfs_ail *ailp,
668 xfs_log_item_t *lip) 660 xfs_log_item_t *lip)
669/* ARGSUSED */
670{ 661{
671 xfs_ail_check(ailp, lip); 662 xfs_ail_check(ailp, lip);
672
673 list_del(&lip->li_ail); 663 list_del(&lip->li_ail);
674 664 xfs_trans_ail_cursor_clear(ailp, lip);
675 return lip;
676} 665}
677 666
678/* 667/*
@@ -682,7 +671,6 @@ xfs_ail_delete(
682STATIC xfs_log_item_t * 671STATIC xfs_log_item_t *
683xfs_ail_min( 672xfs_ail_min(
684 struct xfs_ail *ailp) 673 struct xfs_ail *ailp)
685/* ARGSUSED */
686{ 674{
687 if (list_empty(&ailp->xa_ail)) 675 if (list_empty(&ailp->xa_ail))
688 return NULL; 676 return NULL;
@@ -699,7 +687,6 @@ STATIC xfs_log_item_t *
699xfs_ail_next( 687xfs_ail_next(
700 struct xfs_ail *ailp, 688 struct xfs_ail *ailp,
701 xfs_log_item_t *lip) 689 xfs_log_item_t *lip)
702/* ARGSUSED */
703{ 690{
704 if (lip->li_ail.next == &ailp->xa_ail) 691 if (lip->li_ail.next == &ailp->xa_ail)
705 return NULL; 692 return NULL;