aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-07-26 02:31:30 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-26 15:05:16 -0400
commitabbede1b3a680e108d61aaa415ce5153296e775d (patch)
tree0fb8b8db864e5919b02f5d7dd2d66474e76a39d5 /fs
parentc46c887744b330795eba55fdb96343c36d481765 (diff)
xfs: get rid of open-coded S_ISREG(), etc.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c4
-rw-r--r--fs/xfs/xfs_bmap.c7
-rw-r--r--fs/xfs/xfs_dir2.c16
-rw-r--r--fs/xfs/xfs_filestream.c2
-rw-r--r--fs/xfs/xfs_inode.c16
-rw-r--r--fs/xfs/xfs_inode.h2
-rw-r--r--fs/xfs/xfs_log_recover.c4
-rw-r--r--fs/xfs/xfs_mount.c2
-rw-r--r--fs/xfs/xfs_rename.c4
-rw-r--r--fs/xfs/xfs_vnodeops.c10
10 files changed, 33 insertions, 34 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index acca2c5ca3fa..14fc00e32f6b 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -850,14 +850,14 @@ xfs_set_diflags(
850 di_flags |= XFS_DIFLAG_NODEFRAG; 850 di_flags |= XFS_DIFLAG_NODEFRAG;
851 if (xflags & XFS_XFLAG_FILESTREAM) 851 if (xflags & XFS_XFLAG_FILESTREAM)
852 di_flags |= XFS_DIFLAG_FILESTREAM; 852 di_flags |= XFS_DIFLAG_FILESTREAM;
853 if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { 853 if (S_ISDIR(ip->i_d.di_mode)) {
854 if (xflags & XFS_XFLAG_RTINHERIT) 854 if (xflags & XFS_XFLAG_RTINHERIT)
855 di_flags |= XFS_DIFLAG_RTINHERIT; 855 di_flags |= XFS_DIFLAG_RTINHERIT;
856 if (xflags & XFS_XFLAG_NOSYMLINKS) 856 if (xflags & XFS_XFLAG_NOSYMLINKS)
857 di_flags |= XFS_DIFLAG_NOSYMLINKS; 857 di_flags |= XFS_DIFLAG_NOSYMLINKS;
858 if (xflags & XFS_XFLAG_EXTSZINHERIT) 858 if (xflags & XFS_XFLAG_EXTSZINHERIT)
859 di_flags |= XFS_DIFLAG_EXTSZINHERIT; 859 di_flags |= XFS_DIFLAG_EXTSZINHERIT;
860 } else if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) { 860 } else if (S_ISREG(ip->i_d.di_mode)) {
861 if (xflags & XFS_XFLAG_REALTIME) 861 if (xflags & XFS_XFLAG_REALTIME)
862 di_flags |= XFS_DIFLAG_REALTIME; 862 di_flags |= XFS_DIFLAG_REALTIME;
863 if (xflags & XFS_XFLAG_EXTSIZE) 863 if (xflags & XFS_XFLAG_EXTSIZE)
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index c51a3f903633..ab3e5c6c4642 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -414,7 +414,7 @@ xfs_bmap_add_attrfork_local(
414 414
415 if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip)) 415 if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip))
416 return 0; 416 return 0;
417 if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { 417 if (S_ISDIR(ip->i_d.di_mode)) {
418 mp = ip->i_mount; 418 mp = ip->i_mount;
419 memset(&dargs, 0, sizeof(dargs)); 419 memset(&dargs, 0, sizeof(dargs));
420 dargs.dp = ip; 420 dargs.dp = ip;
@@ -3344,8 +3344,7 @@ xfs_bmap_local_to_extents(
3344 * We don't want to deal with the case of keeping inode data inline yet. 3344 * We don't want to deal with the case of keeping inode data inline yet.
3345 * So sending the data fork of a regular inode is invalid. 3345 * So sending the data fork of a regular inode is invalid.
3346 */ 3346 */
3347 ASSERT(!((ip->i_d.di_mode & S_IFMT) == S_IFREG && 3347 ASSERT(!(S_ISREG(ip->i_d.di_mode) && whichfork == XFS_DATA_FORK));
3348 whichfork == XFS_DATA_FORK));
3349 ifp = XFS_IFORK_PTR(ip, whichfork); 3348 ifp = XFS_IFORK_PTR(ip, whichfork);
3350 ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL); 3349 ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL);
3351 flags = 0; 3350 flags = 0;
@@ -4052,7 +4051,7 @@ xfs_bmap_one_block(
4052 4051
4053#ifndef DEBUG 4052#ifndef DEBUG
4054 if (whichfork == XFS_DATA_FORK) { 4053 if (whichfork == XFS_DATA_FORK) {
4055 return ((ip->i_d.di_mode & S_IFMT) == S_IFREG) ? 4054 return S_ISREG(ip->i_d.di_mode) ?
4056 (ip->i_size == ip->i_mount->m_sb.sb_blocksize) : 4055 (ip->i_size == ip->i_mount->m_sb.sb_blocksize) :
4057 (ip->i_d.di_size == ip->i_mount->m_sb.sb_blocksize); 4056 (ip->i_d.di_size == ip->i_mount->m_sb.sb_blocksize);
4058 } 4057 }
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c
index 4580ce00aeb4..a2e27010c7fb 100644
--- a/fs/xfs/xfs_dir2.c
+++ b/fs/xfs/xfs_dir2.c
@@ -121,7 +121,7 @@ xfs_dir_isempty(
121{ 121{
122 xfs_dir2_sf_hdr_t *sfp; 122 xfs_dir2_sf_hdr_t *sfp;
123 123
124 ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 124 ASSERT(S_ISDIR(dp->i_d.di_mode));
125 if (dp->i_d.di_size == 0) /* might happen during shutdown. */ 125 if (dp->i_d.di_size == 0) /* might happen during shutdown. */
126 return 1; 126 return 1;
127 if (dp->i_d.di_size > XFS_IFORK_DSIZE(dp)) 127 if (dp->i_d.di_size > XFS_IFORK_DSIZE(dp))
@@ -179,7 +179,7 @@ xfs_dir_init(
179 memset((char *)&args, 0, sizeof(args)); 179 memset((char *)&args, 0, sizeof(args));
180 args.dp = dp; 180 args.dp = dp;
181 args.trans = tp; 181 args.trans = tp;
182 ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 182 ASSERT(S_ISDIR(dp->i_d.di_mode));
183 if ((error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino))) 183 if ((error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino)))
184 return error; 184 return error;
185 return xfs_dir2_sf_create(&args, pdp->i_ino); 185 return xfs_dir2_sf_create(&args, pdp->i_ino);
@@ -202,7 +202,7 @@ xfs_dir_createname(
202 int rval; 202 int rval;
203 int v; /* type-checking value */ 203 int v; /* type-checking value */
204 204
205 ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 205 ASSERT(S_ISDIR(dp->i_d.di_mode));
206 if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) 206 if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum)))
207 return rval; 207 return rval;
208 XFS_STATS_INC(xs_dir_create); 208 XFS_STATS_INC(xs_dir_create);
@@ -278,7 +278,7 @@ xfs_dir_lookup(
278 int rval; 278 int rval;
279 int v; /* type-checking value */ 279 int v; /* type-checking value */
280 280
281 ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 281 ASSERT(S_ISDIR(dp->i_d.di_mode));
282 XFS_STATS_INC(xs_dir_lookup); 282 XFS_STATS_INC(xs_dir_lookup);
283 283
284 memset(&args, 0, sizeof(xfs_da_args_t)); 284 memset(&args, 0, sizeof(xfs_da_args_t));
@@ -333,7 +333,7 @@ xfs_dir_removename(
333 int rval; 333 int rval;
334 int v; /* type-checking value */ 334 int v; /* type-checking value */
335 335
336 ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 336 ASSERT(S_ISDIR(dp->i_d.di_mode));
337 XFS_STATS_INC(xs_dir_remove); 337 XFS_STATS_INC(xs_dir_remove);
338 338
339 memset(&args, 0, sizeof(xfs_da_args_t)); 339 memset(&args, 0, sizeof(xfs_da_args_t));
@@ -382,7 +382,7 @@ xfs_readdir(
382 if (XFS_FORCED_SHUTDOWN(dp->i_mount)) 382 if (XFS_FORCED_SHUTDOWN(dp->i_mount))
383 return XFS_ERROR(EIO); 383 return XFS_ERROR(EIO);
384 384
385 ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 385 ASSERT(S_ISDIR(dp->i_d.di_mode));
386 XFS_STATS_INC(xs_dir_getdents); 386 XFS_STATS_INC(xs_dir_getdents);
387 387
388 if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) 388 if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL)
@@ -414,7 +414,7 @@ xfs_dir_replace(
414 int rval; 414 int rval;
415 int v; /* type-checking value */ 415 int v; /* type-checking value */
416 416
417 ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 417 ASSERT(S_ISDIR(dp->i_d.di_mode));
418 418
419 if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) 419 if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum)))
420 return rval; 420 return rval;
@@ -464,7 +464,7 @@ xfs_dir_canenter(
464 if (resblks) 464 if (resblks)
465 return 0; 465 return 0;
466 466
467 ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR); 467 ASSERT(S_ISDIR(dp->i_d.di_mode));
468 468
469 memset(&args, 0, sizeof(xfs_da_args_t)); 469 memset(&args, 0, sizeof(xfs_da_args_t));
470 args.name = name->name; 470 args.name = name->name;
diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c
index 9124425b7f2f..87fceceee2db 100644
--- a/fs/xfs/xfs_filestream.c
+++ b/fs/xfs/xfs_filestream.c
@@ -344,7 +344,7 @@ _xfs_filestream_update_ag(
344 * Either ip is a regular file and pip is a directory, or ip is a 344 * Either ip is a regular file and pip is a directory, or ip is a
345 * directory and pip is NULL. 345 * directory and pip is NULL.
346 */ 346 */
347 ASSERT(ip && (((ip->i_d.di_mode & S_IFREG) && pip && 347 ASSERT(ip && ((S_ISREG(ip->i_d.di_mode) && pip &&
348 (pip->i_d.di_mode & S_IFDIR)) || 348 (pip->i_d.di_mode & S_IFDIR)) ||
349 ((ip->i_d.di_mode & S_IFDIR) && !pip))); 349 ((ip->i_d.di_mode & S_IFDIR) && !pip)));
350 350
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 3cc21ddf9f7e..2fcca4b03ed3 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -368,7 +368,7 @@ xfs_iformat(
368 /* 368 /*
369 * no local regular files yet 369 * no local regular files yet
370 */ 370 */
371 if (unlikely((be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFREG)) { 371 if (unlikely(S_ISREG(be16_to_cpu(dip->di_mode)))) {
372 xfs_warn(ip->i_mount, 372 xfs_warn(ip->i_mount,
373 "corrupt inode %Lu (local format for regular file).", 373 "corrupt inode %Lu (local format for regular file).",
374 (unsigned long long) ip->i_ino); 374 (unsigned long long) ip->i_ino);
@@ -1040,7 +1040,7 @@ xfs_ialloc(
1040 1040
1041 if (pip && XFS_INHERIT_GID(pip)) { 1041 if (pip && XFS_INHERIT_GID(pip)) {
1042 ip->i_d.di_gid = pip->i_d.di_gid; 1042 ip->i_d.di_gid = pip->i_d.di_gid;
1043 if ((pip->i_d.di_mode & S_ISGID) && (mode & S_IFMT) == S_IFDIR) { 1043 if ((pip->i_d.di_mode & S_ISGID) && S_ISDIR(mode)) {
1044 ip->i_d.di_mode |= S_ISGID; 1044 ip->i_d.di_mode |= S_ISGID;
1045 } 1045 }
1046 } 1046 }
@@ -1097,14 +1097,14 @@ xfs_ialloc(
1097 if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) { 1097 if (pip && (pip->i_d.di_flags & XFS_DIFLAG_ANY)) {
1098 uint di_flags = 0; 1098 uint di_flags = 0;
1099 1099
1100 if ((mode & S_IFMT) == S_IFDIR) { 1100 if (S_ISDIR(mode)) {
1101 if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) 1101 if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT)
1102 di_flags |= XFS_DIFLAG_RTINHERIT; 1102 di_flags |= XFS_DIFLAG_RTINHERIT;
1103 if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { 1103 if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) {
1104 di_flags |= XFS_DIFLAG_EXTSZINHERIT; 1104 di_flags |= XFS_DIFLAG_EXTSZINHERIT;
1105 ip->i_d.di_extsize = pip->i_d.di_extsize; 1105 ip->i_d.di_extsize = pip->i_d.di_extsize;
1106 } 1106 }
1107 } else if ((mode & S_IFMT) == S_IFREG) { 1107 } else if (S_ISREG(mode)) {
1108 if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) 1108 if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT)
1109 di_flags |= XFS_DIFLAG_REALTIME; 1109 di_flags |= XFS_DIFLAG_REALTIME;
1110 if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { 1110 if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) {
@@ -1188,7 +1188,7 @@ xfs_isize_check(
1188 int nimaps; 1188 int nimaps;
1189 xfs_bmbt_irec_t imaps[2]; 1189 xfs_bmbt_irec_t imaps[2];
1190 1190
1191 if ((ip->i_d.di_mode & S_IFMT) != S_IFREG) 1191 if (!S_ISREG(ip->i_d.di_mode))
1192 return; 1192 return;
1193 1193
1194 if (XFS_IS_REALTIME_INODE(ip)) 1194 if (XFS_IS_REALTIME_INODE(ip))
@@ -1828,7 +1828,7 @@ xfs_ifree(
1828 ASSERT(ip->i_d.di_nextents == 0); 1828 ASSERT(ip->i_d.di_nextents == 0);
1829 ASSERT(ip->i_d.di_anextents == 0); 1829 ASSERT(ip->i_d.di_anextents == 0);
1830 ASSERT((ip->i_d.di_size == 0 && ip->i_size == 0) || 1830 ASSERT((ip->i_d.di_size == 0 && ip->i_size == 0) ||
1831 ((ip->i_d.di_mode & S_IFMT) != S_IFREG)); 1831 (!S_ISREG(ip->i_d.di_mode)));
1832 ASSERT(ip->i_d.di_nblocks == 0); 1832 ASSERT(ip->i_d.di_nblocks == 0);
1833 1833
1834 /* 1834 /*
@@ -2671,7 +2671,7 @@ xfs_iflush_int(
2671 __func__, ip->i_ino, ip, ip->i_d.di_magic); 2671 __func__, ip->i_ino, ip, ip->i_d.di_magic);
2672 goto corrupt_out; 2672 goto corrupt_out;
2673 } 2673 }
2674 if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) { 2674 if (S_ISREG(ip->i_d.di_mode)) {
2675 if (XFS_TEST_ERROR( 2675 if (XFS_TEST_ERROR(
2676 (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && 2676 (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) &&
2677 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE), 2677 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE),
@@ -2681,7 +2681,7 @@ xfs_iflush_int(
2681 __func__, ip->i_ino, ip); 2681 __func__, ip->i_ino, ip);
2682 goto corrupt_out; 2682 goto corrupt_out;
2683 } 2683 }
2684 } else if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { 2684 } else if (S_ISDIR(ip->i_d.di_mode)) {
2685 if (XFS_TEST_ERROR( 2685 if (XFS_TEST_ERROR(
2686 (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && 2686 (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) &&
2687 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) && 2687 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) &&
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index a97644ab945a..2380a4bcbece 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -263,7 +263,7 @@ typedef struct xfs_inode {
263 struct inode i_vnode; /* embedded VFS inode */ 263 struct inode i_vnode; /* embedded VFS inode */
264} xfs_inode_t; 264} xfs_inode_t;
265 265
266#define XFS_ISIZE(ip) (((ip)->i_d.di_mode & S_IFMT) == S_IFREG) ? \ 266#define XFS_ISIZE(ip) S_ISREG((ip)->i_d.di_mode) ? \
267 (ip)->i_size : (ip)->i_d.di_size; 267 (ip)->i_size : (ip)->i_d.di_size;
268 268
269/* Convert from vfs inode to xfs inode */ 269/* Convert from vfs inode to xfs inode */
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 8fe4206de057..052a2c0ec5fb 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -2283,7 +2283,7 @@ xlog_recover_inode_pass2(
2283 /* Take the opportunity to reset the flush iteration count */ 2283 /* Take the opportunity to reset the flush iteration count */
2284 dicp->di_flushiter = 0; 2284 dicp->di_flushiter = 0;
2285 2285
2286 if (unlikely((dicp->di_mode & S_IFMT) == S_IFREG)) { 2286 if (unlikely(S_ISREG(dicp->di_mode))) {
2287 if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) && 2287 if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) &&
2288 (dicp->di_format != XFS_DINODE_FMT_BTREE)) { 2288 (dicp->di_format != XFS_DINODE_FMT_BTREE)) {
2289 XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(3)", 2289 XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(3)",
@@ -2296,7 +2296,7 @@ xlog_recover_inode_pass2(
2296 error = EFSCORRUPTED; 2296 error = EFSCORRUPTED;
2297 goto error; 2297 goto error;
2298 } 2298 }
2299 } else if (unlikely((dicp->di_mode & S_IFMT) == S_IFDIR)) { 2299 } else if (unlikely(S_ISDIR(dicp->di_mode))) {
2300 if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) && 2300 if ((dicp->di_format != XFS_DINODE_FMT_EXTENTS) &&
2301 (dicp->di_format != XFS_DINODE_FMT_BTREE) && 2301 (dicp->di_format != XFS_DINODE_FMT_BTREE) &&
2302 (dicp->di_format != XFS_DINODE_FMT_LOCAL)) { 2302 (dicp->di_format != XFS_DINODE_FMT_LOCAL)) {
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 7f25245da289..092e16ae4d9d 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1331,7 +1331,7 @@ xfs_mountfs(
1331 1331
1332 ASSERT(rip != NULL); 1332 ASSERT(rip != NULL);
1333 1333
1334 if (unlikely((rip->i_d.di_mode & S_IFMT) != S_IFDIR)) { 1334 if (unlikely(!S_ISDIR(rip->i_d.di_mode))) {
1335 xfs_warn(mp, "corrupted root inode %llu: not a directory", 1335 xfs_warn(mp, "corrupted root inode %llu: not a directory",
1336 (unsigned long long)rip->i_ino); 1336 (unsigned long long)rip->i_ino);
1337 xfs_iunlock(rip, XFS_ILOCK_EXCL); 1337 xfs_iunlock(rip, XFS_ILOCK_EXCL);
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c
index 77a59891734e..df78c297d1a1 100644
--- a/fs/xfs/xfs_rename.c
+++ b/fs/xfs/xfs_rename.c
@@ -116,7 +116,7 @@ xfs_rename(
116 trace_xfs_rename(src_dp, target_dp, src_name, target_name); 116 trace_xfs_rename(src_dp, target_dp, src_name, target_name);
117 117
118 new_parent = (src_dp != target_dp); 118 new_parent = (src_dp != target_dp);
119 src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR); 119 src_is_directory = S_ISDIR(src_ip->i_d.di_mode);
120 120
121 if (src_is_directory) { 121 if (src_is_directory) {
122 /* 122 /*
@@ -226,7 +226,7 @@ xfs_rename(
226 * target and source are directories and that target can be 226 * target and source are directories and that target can be
227 * destroyed, or that neither is a directory. 227 * destroyed, or that neither is a directory.
228 */ 228 */
229 if ((target_ip->i_d.di_mode & S_IFMT) == S_IFDIR) { 229 if (S_ISDIR(target_ip->i_d.di_mode)) {
230 /* 230 /*
231 * Make sure target dir is empty. 231 * Make sure target dir is empty.
232 */ 232 */
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 88d121486c52..9322e13f0c63 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -121,7 +121,7 @@ xfs_readlink(
121 121
122 xfs_ilock(ip, XFS_ILOCK_SHARED); 122 xfs_ilock(ip, XFS_ILOCK_SHARED);
123 123
124 ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFLNK); 124 ASSERT(S_ISLNK(ip->i_d.di_mode));
125 ASSERT(ip->i_d.di_size <= MAXPATHLEN); 125 ASSERT(ip->i_d.di_size <= MAXPATHLEN);
126 126
127 pathlen = ip->i_d.di_size; 127 pathlen = ip->i_d.di_size;
@@ -529,7 +529,7 @@ xfs_release(
529 if (ip->i_d.di_nlink == 0) 529 if (ip->i_d.di_nlink == 0)
530 return 0; 530 return 0;
531 531
532 if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && 532 if ((S_ISREG(ip->i_d.di_mode) &&
533 ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 || 533 ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 ||
534 ip->i_delayed_blks > 0)) && 534 ip->i_delayed_blks > 0)) &&
535 (ip->i_df.if_flags & XFS_IFEXTENTS)) && 535 (ip->i_df.if_flags & XFS_IFEXTENTS)) &&
@@ -610,7 +610,7 @@ xfs_inactive(
610 truncate = ((ip->i_d.di_nlink == 0) && 610 truncate = ((ip->i_d.di_nlink == 0) &&
611 ((ip->i_d.di_size != 0) || (ip->i_size != 0) || 611 ((ip->i_d.di_size != 0) || (ip->i_size != 0) ||
612 (ip->i_d.di_nextents > 0) || (ip->i_delayed_blks > 0)) && 612 (ip->i_d.di_nextents > 0) || (ip->i_delayed_blks > 0)) &&
613 ((ip->i_d.di_mode & S_IFMT) == S_IFREG)); 613 S_ISREG(ip->i_d.di_mode));
614 614
615 mp = ip->i_mount; 615 mp = ip->i_mount;
616 616
@@ -621,7 +621,7 @@ xfs_inactive(
621 goto out; 621 goto out;
622 622
623 if (ip->i_d.di_nlink != 0) { 623 if (ip->i_d.di_nlink != 0) {
624 if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) && 624 if ((S_ISREG(ip->i_d.di_mode) &&
625 ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 || 625 ((ip->i_size > 0) || (VN_CACHED(VFS_I(ip)) > 0 ||
626 ip->i_delayed_blks > 0)) && 626 ip->i_delayed_blks > 0)) &&
627 (ip->i_df.if_flags & XFS_IFEXTENTS) && 627 (ip->i_df.if_flags & XFS_IFEXTENTS) &&
@@ -669,7 +669,7 @@ xfs_inactive(
669 xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); 669 xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL);
670 return VN_INACTIVE_CACHE; 670 return VN_INACTIVE_CACHE;
671 } 671 }
672 } else if ((ip->i_d.di_mode & S_IFMT) == S_IFLNK) { 672 } else if (S_ISLNK(ip->i_d.di_mode)) {
673 673
674 /* 674 /*
675 * If we get an error while cleaning up a 675 * If we get an error while cleaning up a