aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_iget.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-08-31 20:51:52 -0400
committerFelix Blyakher <felixb@sgi.com>2009-09-01 13:46:16 -0400
commitaa72a5cf00001d0b952c7c755be404b9118ceb2e (patch)
tree2100d71c9d697f48f4c868b6631242c7292e5fd4 /fs/xfs/xfs_iget.c
parent13e6d5cdde0e785aa943810f08b801cadd0935df (diff)
xfs: simplify xfs_trans_iget
xfs_trans_iget is a wrapper for xfs_iget that adds the inode to the transaction after it is read. Except when the inode already is in the inode cache, in which case it returns the existing locked inode with increment lock recursion counts. Now, no one in the tree every decrements these lock recursion counts, so any user of this gets a potential double unlock when both the original owner of the inode and the xfs_trans_iget caller unlock it. When looking back in a git bisect in the historic XFS tree there was only one place that decremented these counts, xfs_trans_iput. Introduced in commit ca25df7a840f426eb566d52667b6950b92bb84b5 by Adam Sweeney in 1993, and removed in commit 19f899a3ab155ff6a49c0c79b06f2f61059afaf3 by Steve Lord in 2003. And as long as it didn't slip through git bisects cracks never actually used in that time frame. A quick audit of the callers of xfs_trans_iget shows that no caller really relies on this behaviour fortunately - xfs_ialloc allows this inode from disk so it must not be there before, and all the RT allocator routines only every add each RT bitmap inode once. In addition to removing lots of code and reducing the size of the inode item this patch also avoids the double inode cache lookup in each create/mkdir/mknod transaction. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Elder <aelder@sgi.com> Signed-off-by: Felix Blyakher <felixb@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_iget.c')
-rw-r--r--fs/xfs/xfs_iget.c26
1 files changed, 0 insertions, 26 deletions
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index 3323826274b3..80e526489be5 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -455,32 +455,6 @@ out_error_or_again:
455 return error; 455 return error;
456} 456}
457 457
458
459/*
460 * Look for the inode corresponding to the given ino in the hash table.
461 * If it is there and its i_transp pointer matches tp, return it.
462 * Otherwise, return NULL.
463 */
464xfs_inode_t *
465xfs_inode_incore(xfs_mount_t *mp,
466 xfs_ino_t ino,
467 xfs_trans_t *tp)
468{
469 xfs_inode_t *ip;
470 xfs_perag_t *pag;
471
472 pag = xfs_get_perag(mp, ino);
473 read_lock(&pag->pag_ici_lock);
474 ip = radix_tree_lookup(&pag->pag_ici_root, XFS_INO_TO_AGINO(mp, ino));
475 read_unlock(&pag->pag_ici_lock);
476 xfs_put_perag(mp, pag);
477
478 /* the returned inode must match the transaction */
479 if (ip && (ip->i_transp != tp))
480 return NULL;
481 return ip;
482}
483
484/* 458/*
485 * Decrement reference count of an inode structure and unlock it. 459 * Decrement reference count of an inode structure and unlock it.
486 * 460 *