Commit 6a7f422d47d4af461704ebb9d7a389d9e59766b2

Authored by Christoph Hellwig
Committed by Lachlan McIlroy
1 parent 4e5dbb3498

[XFS] kill di_mode checks after xfs_iget

Unless XFS_IGET_CREATE is passed xfs_iget will return ENOENT if it
encounters an inode with di_mode == 0. Remove the duplicated checks in the
callers.

(the log recovery case is not touched for now)

SGI-PV: 976035
SGI-Modid: xfs-linux-melb:xfs-kern:30898a

Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>

Showing 5 changed files with 2 additions and 20 deletions Side-by-side Diff

fs/xfs/linux-2.6/xfs_export.c
... ... @@ -133,7 +133,7 @@
133 133 if (!ip)
134 134 return ERR_PTR(-EIO);
135 135  
136   - if (!ip->i_d.di_mode || ip->i_d.di_gen != generation) {
  136 + if (ip->i_d.di_gen != generation) {
137 137 xfs_iput_new(ip, XFS_ILOCK_SHARED);
138 138 return ERR_PTR(-ENOENT);
139 139 }
fs/xfs/linux-2.6/xfs_ioctl.c
... ... @@ -238,7 +238,7 @@
238 238 return error;
239 239 if (ip == NULL)
240 240 return XFS_ERROR(EIO);
241   - if (ip->i_d.di_mode == 0 || ip->i_d.di_gen != igen) {
  241 + if (ip->i_d.di_gen != igen) {
242 242 xfs_iput_new(ip, XFS_ILOCK_SHARED);
243 243 return XFS_ERROR(ENOENT);
244 244 }
fs/xfs/quota/xfs_qm.c
... ... @@ -1737,12 +1737,6 @@
1737 1737 return error;
1738 1738 }
1739 1739  
1740   - if (ip->i_d.di_mode == 0) {
1741   - xfs_iput_new(ip, XFS_ILOCK_EXCL);
1742   - *res = BULKSTAT_RV_NOTHING;
1743   - return XFS_ERROR(ENOENT);
1744   - }
1745   -
1746 1740 /*
1747 1741 * Obtain the locked dquots. In case of an error (eg. allocation
1748 1742 * fails for ENOSPC), we return the negative of the error number
fs/xfs/quota/xfs_qm_syscalls.c
... ... @@ -1366,12 +1366,6 @@
1366 1366 return (error);
1367 1367 }
1368 1368  
1369   - if (ip->i_d.di_mode == 0) {
1370   - xfs_iput_new(ip, lock_flags);
1371   - *res = BULKSTAT_RV_NOTHING;
1372   - return XFS_ERROR(ENOENT);
1373   - }
1374   -
1375 1369 /*
1376 1370 * This inode can have blocks after eof which can get released
1377 1371 * when we send it to inactive. Since we don't check the dquot
... ... @@ -71,11 +71,6 @@
71 71  
72 72 ASSERT(ip != NULL);
73 73 ASSERT(ip->i_blkno != (xfs_daddr_t)0);
74   - if (ip->i_d.di_mode == 0) {
75   - *stat = BULKSTAT_RV_NOTHING;
76   - error = XFS_ERROR(ENOENT);
77   - goto out_iput;
78   - }
79 74  
80 75 vp = XFS_ITOV(ip);
81 76 dic = &ip->i_d;
... ... @@ -124,7 +119,6 @@
124 119 break;
125 120 }
126 121  
127   - out_iput:
128 122 xfs_iput(ip, XFS_ILOCK_SHARED);
129 123 return error;
130 124 }