diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-06-23 21:51:19 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-07-26 14:16:44 -0400 |
commit | ef35e9255d4ed12522e836fbcec861e7306d794a (patch) | |
tree | 4ae5b2aef3f8dac9dd44490f6952e359239aa117 | |
parent | d2e078c33c24f97411b0fdd7cd2173e68125e7e3 (diff) |
xfs: remove xfs_iput_new
We never get an i_mode of 0 or a locked VFS inode until we pass in the
XFS_IGET_CREATE flag to xfs_iget, which makes xfs_iput_new equivalent to
xfs_iput for the only caller. In addition to that xfs_nfs_get_inode
does not even need to lock the inode given that the generation never changes
for a life inode, so just pass a 0 lock_flags to xfs_iget and release
the inode using IRELE in the error path.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
-rw-r--r-- | fs/xfs/linux-2.6/xfs_export.c | 7 | ||||
-rw-r--r-- | fs/xfs/xfs_iget.c | 23 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.h | 1 |
3 files changed, 3 insertions, 28 deletions
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c index 09c91325f727..3764d74790ec 100644 --- a/fs/xfs/linux-2.6/xfs_export.c +++ b/fs/xfs/linux-2.6/xfs_export.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "xfs_bmap_btree.h" | 29 | #include "xfs_bmap_btree.h" |
30 | #include "xfs_inode.h" | 30 | #include "xfs_inode.h" |
31 | #include "xfs_inode_item.h" | 31 | #include "xfs_inode_item.h" |
32 | #include "xfs_trace.h" | ||
32 | 33 | ||
33 | /* | 34 | /* |
34 | * Note that we only accept fileids which are long enough rather than allow | 35 | * Note that we only accept fileids which are long enough rather than allow |
@@ -131,8 +132,7 @@ xfs_nfs_get_inode( | |||
131 | * fine and not an indication of a corrupted filesystem as clients can | 132 | * fine and not an indication of a corrupted filesystem as clients can |
132 | * send invalid file handles and we have to handle it gracefully.. | 133 | * send invalid file handles and we have to handle it gracefully.. |
133 | */ | 134 | */ |
134 | error = xfs_iget(mp, NULL, ino, XFS_IGET_UNTRUSTED, | 135 | error = xfs_iget(mp, NULL, ino, XFS_IGET_UNTRUSTED, 0, &ip); |
135 | XFS_ILOCK_SHARED, &ip); | ||
136 | if (error) { | 136 | if (error) { |
137 | /* | 137 | /* |
138 | * EINVAL means the inode cluster doesn't exist anymore. | 138 | * EINVAL means the inode cluster doesn't exist anymore. |
@@ -147,11 +147,10 @@ xfs_nfs_get_inode( | |||
147 | } | 147 | } |
148 | 148 | ||
149 | if (ip->i_d.di_gen != generation) { | 149 | if (ip->i_d.di_gen != generation) { |
150 | xfs_iput_new(ip, XFS_ILOCK_SHARED); | 150 | IRELE(ip); |
151 | return ERR_PTR(-ENOENT); | 151 | return ERR_PTR(-ENOENT); |
152 | } | 152 | } |
153 | 153 | ||
154 | xfs_iunlock(ip, XFS_ILOCK_SHARED); | ||
155 | return VFS_I(ip); | 154 | return VFS_I(ip); |
156 | } | 155 | } |
157 | 156 | ||
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 75664d1b9f59..b460e62bcf86 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -435,29 +435,6 @@ xfs_iput(xfs_inode_t *ip, | |||
435 | } | 435 | } |
436 | 436 | ||
437 | /* | 437 | /* |
438 | * Special iput for brand-new inodes that are still locked | ||
439 | */ | ||
440 | void | ||
441 | xfs_iput_new( | ||
442 | xfs_inode_t *ip, | ||
443 | uint lock_flags) | ||
444 | { | ||
445 | struct inode *inode = VFS_I(ip); | ||
446 | |||
447 | xfs_itrace_entry(ip); | ||
448 | |||
449 | if ((ip->i_d.di_mode == 0)) { | ||
450 | ASSERT(!xfs_iflags_test(ip, XFS_IRECLAIMABLE)); | ||
451 | make_bad_inode(inode); | ||
452 | } | ||
453 | if (inode->i_state & I_NEW) | ||
454 | unlock_new_inode(inode); | ||
455 | if (lock_flags) | ||
456 | xfs_iunlock(ip, lock_flags); | ||
457 | IRELE(ip); | ||
458 | } | ||
459 | |||
460 | /* | ||
461 | * This is called free all the memory associated with an inode. | 438 | * This is called free all the memory associated with an inode. |
462 | * It must free the inode itself and any buffers allocated for | 439 | * It must free the inode itself and any buffers allocated for |
463 | * if_extents/if_data and if_broot. It must also free the lock | 440 | * if_extents/if_data and if_broot. It must also free the lock |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 78550df13cd6..7a19d5237656 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -444,7 +444,6 @@ static inline void xfs_ifunlock(xfs_inode_t *ip) | |||
444 | int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, | 444 | int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, |
445 | uint, uint, xfs_inode_t **); | 445 | uint, uint, xfs_inode_t **); |
446 | void xfs_iput(xfs_inode_t *, uint); | 446 | void xfs_iput(xfs_inode_t *, uint); |
447 | void xfs_iput_new(xfs_inode_t *, uint); | ||
448 | void xfs_ilock(xfs_inode_t *, uint); | 447 | void xfs_ilock(xfs_inode_t *, uint); |
449 | int xfs_ilock_nowait(xfs_inode_t *, uint); | 448 | int xfs_ilock_nowait(xfs_inode_t *, uint); |
450 | void xfs_iunlock(xfs_inode_t *, uint); | 449 | void xfs_iunlock(xfs_inode_t *, uint); |