diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-06-23 21:36:58 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-07-26 14:16:36 -0400 |
commit | 898621d5a72c6799a9a13fce20443b4b6699899c (patch) | |
tree | 6cd994bd8d24f4f4f6ac5b5b57e0b99ee02d4ba6 /fs/xfs/xfs_inode_item.c | |
parent | 4d16e9246fc3b3cf7bc95609eff66929a39daa06 (diff) |
xfs: simplify inode to transaction joining
Currently we need to either call IHOLD or xfs_trans_ihold on an inode when
joining it to a transaction via xfs_trans_ijoin.
This patches instead makes xfs_trans_ijoin usable on it's own by doing
an implicity xfs_trans_ihold, which also allows us to drop the third
argument. For the case where we want to hold a reference on the inode
a xfs_trans_ijoin_ref wrapper is added which does the IHOLD and marks
the inode for needing an xfs_iput. In addition to the cleaner interface
to the caller this also simplifies the implementation.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_inode_item.c')
-rw-r--r-- | fs/xfs/xfs_inode_item.c | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index c7e70d70834..ad050c618e6 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c | |||
@@ -628,19 +628,10 @@ xfs_inode_item_unlock( | |||
628 | { | 628 | { |
629 | struct xfs_inode_log_item *iip = INODE_ITEM(lip); | 629 | struct xfs_inode_log_item *iip = INODE_ITEM(lip); |
630 | struct xfs_inode *ip = iip->ili_inode; | 630 | struct xfs_inode *ip = iip->ili_inode; |
631 | uint hold; | 631 | unsigned short lock_flags; |
632 | uint iolocked; | ||
633 | uint lock_flags; | ||
634 | 632 | ||
635 | ASSERT(iip != NULL); | ||
636 | ASSERT(iip->ili_inode->i_itemp != NULL); | 633 | ASSERT(iip->ili_inode->i_itemp != NULL); |
637 | ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL)); | 634 | ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL)); |
638 | ASSERT((!(iip->ili_inode->i_itemp->ili_flags & | ||
639 | XFS_ILI_IOLOCKED_EXCL)) || | ||
640 | xfs_isilocked(iip->ili_inode, XFS_IOLOCK_EXCL)); | ||
641 | ASSERT((!(iip->ili_inode->i_itemp->ili_flags & | ||
642 | XFS_ILI_IOLOCKED_SHARED)) || | ||
643 | xfs_isilocked(iip->ili_inode, XFS_IOLOCK_SHARED)); | ||
644 | 635 | ||
645 | /* | 636 | /* |
646 | * Clear the transaction pointer in the inode. | 637 | * Clear the transaction pointer in the inode. |
@@ -668,35 +659,10 @@ xfs_inode_item_unlock( | |||
668 | iip->ili_aextents_buf = NULL; | 659 | iip->ili_aextents_buf = NULL; |
669 | } | 660 | } |
670 | 661 | ||
671 | /* | 662 | lock_flags = iip->ili_lock_flags; |
672 | * Figure out if we should unlock the inode or not. | 663 | iip->ili_lock_flags = 0; |
673 | */ | 664 | if (lock_flags) |
674 | hold = iip->ili_flags & XFS_ILI_HOLD; | ||
675 | |||
676 | /* | ||
677 | * Before clearing out the flags, remember whether we | ||
678 | * are holding the inode's IO lock. | ||
679 | */ | ||
680 | iolocked = iip->ili_flags & XFS_ILI_IOLOCKED_ANY; | ||
681 | |||
682 | /* | ||
683 | * Clear out the fields of the inode log item particular | ||
684 | * to the current transaction. | ||
685 | */ | ||
686 | iip->ili_flags = 0; | ||
687 | |||
688 | /* | ||
689 | * Unlock the inode if XFS_ILI_HOLD was not set. | ||
690 | */ | ||
691 | if (!hold) { | ||
692 | lock_flags = XFS_ILOCK_EXCL; | ||
693 | if (iolocked & XFS_ILI_IOLOCKED_EXCL) { | ||
694 | lock_flags |= XFS_IOLOCK_EXCL; | ||
695 | } else if (iolocked & XFS_ILI_IOLOCKED_SHARED) { | ||
696 | lock_flags |= XFS_IOLOCK_SHARED; | ||
697 | } | ||
698 | xfs_iput(iip->ili_inode, lock_flags); | 665 | xfs_iput(iip->ili_inode, lock_flags); |
699 | } | ||
700 | } | 666 | } |
701 | 667 | ||
702 | /* | 668 | /* |