diff options
author | Dave Chinner <dchinner@redhat.com> | 2016-02-09 00:54:58 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-02-09 00:54:58 -0500 |
commit | c19b3b05ae440de50fffe2ac2a9b27392a7448e9 (patch) | |
tree | c18e6272503b92cf5397aa25cfe19542c2b45149 | |
parent | 83e06f21b439b7b308eda06332a4feef35739e94 (diff) |
xfs: mode di_mode to vfs inode
Move the di_mode value from the xfs_icdinode to the VFS inode, reducing
the xfs_icdinode byte another 2 bytes and collapsing another 2 byte hole
in the structure.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 6 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_dir2.c | 12 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_inode_buf.c | 8 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_inode_buf.h | 1 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_inode_fork.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap_util.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_readdir.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_file.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_filestream.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_icache.c | 13 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 48 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.h | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_inode_item.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_ioctl.c | 14 | ||||
-rw-r--r-- | fs/xfs/xfs_iops.c | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_itable.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.c | 2 |
18 files changed, 71 insertions, 73 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index ef00156f4f96..6a051662d8f9 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c | |||
@@ -912,7 +912,7 @@ xfs_bmap_local_to_extents( | |||
912 | * We don't want to deal with the case of keeping inode data inline yet. | 912 | * We don't want to deal with the case of keeping inode data inline yet. |
913 | * So sending the data fork of a regular inode is invalid. | 913 | * So sending the data fork of a regular inode is invalid. |
914 | */ | 914 | */ |
915 | ASSERT(!(S_ISREG(ip->i_d.di_mode) && whichfork == XFS_DATA_FORK)); | 915 | ASSERT(!(S_ISREG(VFS_I(ip)->i_mode) && whichfork == XFS_DATA_FORK)); |
916 | ifp = XFS_IFORK_PTR(ip, whichfork); | 916 | ifp = XFS_IFORK_PTR(ip, whichfork); |
917 | ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL); | 917 | ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL); |
918 | 918 | ||
@@ -1079,7 +1079,7 @@ xfs_bmap_add_attrfork_local( | |||
1079 | if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip)) | 1079 | if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip)) |
1080 | return 0; | 1080 | return 0; |
1081 | 1081 | ||
1082 | if (S_ISDIR(ip->i_d.di_mode)) { | 1082 | if (S_ISDIR(VFS_I(ip)->i_mode)) { |
1083 | memset(&dargs, 0, sizeof(dargs)); | 1083 | memset(&dargs, 0, sizeof(dargs)); |
1084 | dargs.geo = ip->i_mount->m_dir_geo; | 1084 | dargs.geo = ip->i_mount->m_dir_geo; |
1085 | dargs.dp = ip; | 1085 | dargs.dp = ip; |
@@ -1091,7 +1091,7 @@ xfs_bmap_add_attrfork_local( | |||
1091 | return xfs_dir2_sf_to_block(&dargs); | 1091 | return xfs_dir2_sf_to_block(&dargs); |
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | if (S_ISLNK(ip->i_d.di_mode)) | 1094 | if (S_ISLNK(VFS_I(ip)->i_mode)) |
1095 | return xfs_bmap_local_to_extents(tp, ip, firstblock, 1, | 1095 | return xfs_bmap_local_to_extents(tp, ip, firstblock, 1, |
1096 | flags, XFS_DATA_FORK, | 1096 | flags, XFS_DATA_FORK, |
1097 | xfs_symlink_local_to_remote); | 1097 | xfs_symlink_local_to_remote); |
diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c index 2fb53a5c0a74..af0f9d171f8a 100644 --- a/fs/xfs/libxfs/xfs_dir2.c +++ b/fs/xfs/libxfs/xfs_dir2.c | |||
@@ -176,7 +176,7 @@ xfs_dir_isempty( | |||
176 | { | 176 | { |
177 | xfs_dir2_sf_hdr_t *sfp; | 177 | xfs_dir2_sf_hdr_t *sfp; |
178 | 178 | ||
179 | ASSERT(S_ISDIR(dp->i_d.di_mode)); | 179 | ASSERT(S_ISDIR(VFS_I(dp)->i_mode)); |
180 | if (dp->i_d.di_size == 0) /* might happen during shutdown. */ | 180 | if (dp->i_d.di_size == 0) /* might happen during shutdown. */ |
181 | return 1; | 181 | return 1; |
182 | if (dp->i_d.di_size > XFS_IFORK_DSIZE(dp)) | 182 | if (dp->i_d.di_size > XFS_IFORK_DSIZE(dp)) |
@@ -231,7 +231,7 @@ xfs_dir_init( | |||
231 | struct xfs_da_args *args; | 231 | struct xfs_da_args *args; |
232 | int error; | 232 | int error; |
233 | 233 | ||
234 | ASSERT(S_ISDIR(dp->i_d.di_mode)); | 234 | ASSERT(S_ISDIR(VFS_I(dp)->i_mode)); |
235 | error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino); | 235 | error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino); |
236 | if (error) | 236 | if (error) |
237 | return error; | 237 | return error; |
@@ -266,7 +266,7 @@ xfs_dir_createname( | |||
266 | int rval; | 266 | int rval; |
267 | int v; /* type-checking value */ | 267 | int v; /* type-checking value */ |
268 | 268 | ||
269 | ASSERT(S_ISDIR(dp->i_d.di_mode)); | 269 | ASSERT(S_ISDIR(VFS_I(dp)->i_mode)); |
270 | if (inum) { | 270 | if (inum) { |
271 | rval = xfs_dir_ino_validate(tp->t_mountp, inum); | 271 | rval = xfs_dir_ino_validate(tp->t_mountp, inum); |
272 | if (rval) | 272 | if (rval) |
@@ -364,7 +364,7 @@ xfs_dir_lookup( | |||
364 | int v; /* type-checking value */ | 364 | int v; /* type-checking value */ |
365 | int lock_mode; | 365 | int lock_mode; |
366 | 366 | ||
367 | ASSERT(S_ISDIR(dp->i_d.di_mode)); | 367 | ASSERT(S_ISDIR(VFS_I(dp)->i_mode)); |
368 | XFS_STATS_INC(dp->i_mount, xs_dir_lookup); | 368 | XFS_STATS_INC(dp->i_mount, xs_dir_lookup); |
369 | 369 | ||
370 | /* | 370 | /* |
@@ -443,7 +443,7 @@ xfs_dir_removename( | |||
443 | int rval; | 443 | int rval; |
444 | int v; /* type-checking value */ | 444 | int v; /* type-checking value */ |
445 | 445 | ||
446 | ASSERT(S_ISDIR(dp->i_d.di_mode)); | 446 | ASSERT(S_ISDIR(VFS_I(dp)->i_mode)); |
447 | XFS_STATS_INC(dp->i_mount, xs_dir_remove); | 447 | XFS_STATS_INC(dp->i_mount, xs_dir_remove); |
448 | 448 | ||
449 | args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS); | 449 | args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS); |
@@ -505,7 +505,7 @@ xfs_dir_replace( | |||
505 | int rval; | 505 | int rval; |
506 | int v; /* type-checking value */ | 506 | int v; /* type-checking value */ |
507 | 507 | ||
508 | ASSERT(S_ISDIR(dp->i_d.di_mode)); | 508 | ASSERT(S_ISDIR(VFS_I(dp)->i_mode)); |
509 | 509 | ||
510 | rval = xfs_dir_ino_validate(tp->t_mountp, inum); | 510 | rval = xfs_dir_ino_validate(tp->t_mountp, inum); |
511 | if (rval) | 511 | if (rval) |
diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c index 05fbefa97fbf..9d9559eb2835 100644 --- a/fs/xfs/libxfs/xfs_inode_buf.c +++ b/fs/xfs/libxfs/xfs_inode_buf.c | |||
@@ -202,13 +202,12 @@ xfs_inode_from_disk( | |||
202 | struct xfs_icdinode *to = &ip->i_d; | 202 | struct xfs_icdinode *to = &ip->i_d; |
203 | struct inode *inode = VFS_I(ip); | 203 | struct inode *inode = VFS_I(ip); |
204 | 204 | ||
205 | to->di_mode = be16_to_cpu(from->di_mode); | ||
206 | to->di_version = from ->di_version; | ||
207 | 205 | ||
208 | /* | 206 | /* |
209 | * Convert v1 inodes immediately to v2 inode format as this is the | 207 | * Convert v1 inodes immediately to v2 inode format as this is the |
210 | * minimum inode version format we support in the rest of the code. | 208 | * minimum inode version format we support in the rest of the code. |
211 | */ | 209 | */ |
210 | to->di_version = from->di_version; | ||
212 | if (to->di_version == 1) { | 211 | if (to->di_version == 1) { |
213 | set_nlink(inode, be16_to_cpu(from->di_onlink)); | 212 | set_nlink(inode, be16_to_cpu(from->di_onlink)); |
214 | to->di_projid_lo = 0; | 213 | to->di_projid_lo = 0; |
@@ -238,6 +237,7 @@ xfs_inode_from_disk( | |||
238 | inode->i_ctime.tv_sec = (int)be32_to_cpu(from->di_ctime.t_sec); | 237 | inode->i_ctime.tv_sec = (int)be32_to_cpu(from->di_ctime.t_sec); |
239 | inode->i_ctime.tv_nsec = (int)be32_to_cpu(from->di_ctime.t_nsec); | 238 | inode->i_ctime.tv_nsec = (int)be32_to_cpu(from->di_ctime.t_nsec); |
240 | inode->i_generation = be32_to_cpu(from->di_gen); | 239 | inode->i_generation = be32_to_cpu(from->di_gen); |
240 | inode->i_mode = be16_to_cpu(from->di_mode); | ||
241 | 241 | ||
242 | to->di_size = be64_to_cpu(from->di_size); | 242 | to->di_size = be64_to_cpu(from->di_size); |
243 | to->di_nblocks = be64_to_cpu(from->di_nblocks); | 243 | to->di_nblocks = be64_to_cpu(from->di_nblocks); |
@@ -270,7 +270,6 @@ xfs_inode_to_disk( | |||
270 | to->di_magic = cpu_to_be16(XFS_DINODE_MAGIC); | 270 | to->di_magic = cpu_to_be16(XFS_DINODE_MAGIC); |
271 | to->di_onlink = 0; | 271 | to->di_onlink = 0; |
272 | 272 | ||
273 | to->di_mode = cpu_to_be16(from->di_mode); | ||
274 | to->di_version = from->di_version; | 273 | to->di_version = from->di_version; |
275 | to->di_format = from->di_format; | 274 | to->di_format = from->di_format; |
276 | to->di_uid = cpu_to_be32(from->di_uid); | 275 | to->di_uid = cpu_to_be32(from->di_uid); |
@@ -287,6 +286,7 @@ xfs_inode_to_disk( | |||
287 | to->di_ctime.t_nsec = cpu_to_be32(inode->i_ctime.tv_nsec); | 286 | to->di_ctime.t_nsec = cpu_to_be32(inode->i_ctime.tv_nsec); |
288 | to->di_nlink = cpu_to_be32(inode->i_nlink); | 287 | to->di_nlink = cpu_to_be32(inode->i_nlink); |
289 | to->di_gen = cpu_to_be32(inode->i_generation); | 288 | to->di_gen = cpu_to_be32(inode->i_generation); |
289 | to->di_mode = cpu_to_be16(inode->i_mode); | ||
290 | 290 | ||
291 | to->di_size = cpu_to_be64(from->di_size); | 291 | to->di_size = cpu_to_be64(from->di_size); |
292 | to->di_nblocks = cpu_to_be64(from->di_nblocks); | 292 | to->di_nblocks = cpu_to_be64(from->di_nblocks); |
@@ -501,7 +501,7 @@ xfs_iread( | |||
501 | * the inode is already free and not try to mess | 501 | * the inode is already free and not try to mess |
502 | * with the uninitialized part of it. | 502 | * with the uninitialized part of it. |
503 | */ | 503 | */ |
504 | ip->i_d.di_mode = 0; | 504 | VFS_I(ip)->i_mode = 0; |
505 | } | 505 | } |
506 | 506 | ||
507 | ASSERT(ip->i_d.di_version >= 2); | 507 | ASSERT(ip->i_d.di_version >= 2); |
diff --git a/fs/xfs/libxfs/xfs_inode_buf.h b/fs/xfs/libxfs/xfs_inode_buf.h index c51bd1213c96..7c4dd321b215 100644 --- a/fs/xfs/libxfs/xfs_inode_buf.h +++ b/fs/xfs/libxfs/xfs_inode_buf.h | |||
@@ -28,7 +28,6 @@ struct xfs_dinode; | |||
28 | * format specific structures at the appropriate time. | 28 | * format specific structures at the appropriate time. |
29 | */ | 29 | */ |
30 | struct xfs_icdinode { | 30 | struct xfs_icdinode { |
31 | __uint16_t di_mode; /* mode and type of file */ | ||
32 | __int8_t di_version; /* inode version */ | 31 | __int8_t di_version; /* inode version */ |
33 | __int8_t di_format; /* format of di_c data */ | 32 | __int8_t di_format; /* format of di_c data */ |
34 | __uint16_t di_flushiter; /* incremented on flush */ | 33 | __uint16_t di_flushiter; /* incremented on flush */ |
diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c index 0defbd02f62d..0bf1c747439d 100644 --- a/fs/xfs/libxfs/xfs_inode_fork.c +++ b/fs/xfs/libxfs/xfs_inode_fork.c | |||
@@ -120,7 +120,7 @@ xfs_iformat_fork( | |||
120 | return -EFSCORRUPTED; | 120 | return -EFSCORRUPTED; |
121 | } | 121 | } |
122 | 122 | ||
123 | switch (ip->i_d.di_mode & S_IFMT) { | 123 | switch (VFS_I(ip)->i_mode & S_IFMT) { |
124 | case S_IFIFO: | 124 | case S_IFIFO: |
125 | case S_IFCHR: | 125 | case S_IFCHR: |
126 | case S_IFBLK: | 126 | case S_IFBLK: |
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 45ec9e40150c..708775613e55 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c | |||
@@ -821,7 +821,7 @@ bool | |||
821 | xfs_can_free_eofblocks(struct xfs_inode *ip, bool force) | 821 | xfs_can_free_eofblocks(struct xfs_inode *ip, bool force) |
822 | { | 822 | { |
823 | /* prealloc/delalloc exists only on regular files */ | 823 | /* prealloc/delalloc exists only on regular files */ |
824 | if (!S_ISREG(ip->i_d.di_mode)) | 824 | if (!S_ISREG(VFS_I(ip)->i_mode)) |
825 | return false; | 825 | return false; |
826 | 826 | ||
827 | /* | 827 | /* |
@@ -1726,7 +1726,7 @@ xfs_swap_extents( | |||
1726 | xfs_lock_two_inodes(ip, tip, XFS_MMAPLOCK_EXCL); | 1726 | xfs_lock_two_inodes(ip, tip, XFS_MMAPLOCK_EXCL); |
1727 | 1727 | ||
1728 | /* Verify that both files have the same format */ | 1728 | /* Verify that both files have the same format */ |
1729 | if ((ip->i_d.di_mode & S_IFMT) != (tip->i_d.di_mode & S_IFMT)) { | 1729 | if ((VFS_I(ip)->i_mode & S_IFMT) != (VFS_I(tip)->i_mode & S_IFMT)) { |
1730 | error = -EINVAL; | 1730 | error = -EINVAL; |
1731 | goto out_unlock; | 1731 | goto out_unlock; |
1732 | } | 1732 | } |
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c index 642d55d10075..93b3ab0c5435 100644 --- a/fs/xfs/xfs_dir2_readdir.c +++ b/fs/xfs/xfs_dir2_readdir.c | |||
@@ -665,7 +665,7 @@ xfs_readdir( | |||
665 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) | 665 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) |
666 | return -EIO; | 666 | return -EIO; |
667 | 667 | ||
668 | ASSERT(S_ISDIR(dp->i_d.di_mode)); | 668 | ASSERT(S_ISDIR(VFS_I(dp)->i_mode)); |
669 | XFS_STATS_INC(dp->i_mount, xs_dir_getdents); | 669 | XFS_STATS_INC(dp->i_mount, xs_dir_getdents); |
670 | 670 | ||
671 | args.dp = dp; | 671 | args.dp = dp; |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 52883ac3cf84..f7333fbba5c2 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -156,9 +156,9 @@ xfs_update_prealloc_flags( | |||
156 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | 156 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
157 | 157 | ||
158 | if (!(flags & XFS_PREALLOC_INVISIBLE)) { | 158 | if (!(flags & XFS_PREALLOC_INVISIBLE)) { |
159 | ip->i_d.di_mode &= ~S_ISUID; | 159 | VFS_I(ip)->i_mode &= ~S_ISUID; |
160 | if (ip->i_d.di_mode & S_IXGRP) | 160 | if (VFS_I(ip)->i_mode & S_IXGRP) |
161 | ip->i_d.di_mode &= ~S_ISGID; | 161 | VFS_I(ip)->i_mode &= ~S_ISGID; |
162 | xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 162 | xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
163 | } | 163 | } |
164 | 164 | ||
diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c index c4c130f9bfb6..a51353a1f87f 100644 --- a/fs/xfs/xfs_filestream.c +++ b/fs/xfs/xfs_filestream.c | |||
@@ -151,7 +151,7 @@ xfs_filestream_pick_ag( | |||
151 | xfs_agnumber_t ag, max_ag = NULLAGNUMBER; | 151 | xfs_agnumber_t ag, max_ag = NULLAGNUMBER; |
152 | int err, trylock, nscan; | 152 | int err, trylock, nscan; |
153 | 153 | ||
154 | ASSERT(S_ISDIR(ip->i_d.di_mode)); | 154 | ASSERT(S_ISDIR(VFS_I(ip)->i_mode)); |
155 | 155 | ||
156 | /* 2% of an AG's blocks must be free for it to be chosen. */ | 156 | /* 2% of an AG's blocks must be free for it to be chosen. */ |
157 | minfree = mp->m_sb.sb_agblocks / 50; | 157 | minfree = mp->m_sb.sb_agblocks / 50; |
@@ -319,7 +319,7 @@ xfs_filestream_lookup_ag( | |||
319 | xfs_agnumber_t startag, ag = NULLAGNUMBER; | 319 | xfs_agnumber_t startag, ag = NULLAGNUMBER; |
320 | struct xfs_mru_cache_elem *mru; | 320 | struct xfs_mru_cache_elem *mru; |
321 | 321 | ||
322 | ASSERT(S_ISREG(ip->i_d.di_mode)); | 322 | ASSERT(S_ISREG(VFS_I(ip)->i_mode)); |
323 | 323 | ||
324 | pip = xfs_filestream_get_parent(ip); | 324 | pip = xfs_filestream_get_parent(ip); |
325 | if (!pip) | 325 | if (!pip) |
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 30eafad7cf19..bf2d60749278 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c | |||
@@ -63,6 +63,9 @@ xfs_inode_alloc( | |||
63 | return NULL; | 63 | return NULL; |
64 | } | 64 | } |
65 | 65 | ||
66 | /* VFS doesn't initialise i_mode! */ | ||
67 | VFS_I(ip)->i_mode = 0; | ||
68 | |||
66 | XFS_STATS_INC(mp, vn_active); | 69 | XFS_STATS_INC(mp, vn_active); |
67 | ASSERT(atomic_read(&ip->i_pincount) == 0); | 70 | ASSERT(atomic_read(&ip->i_pincount) == 0); |
68 | ASSERT(!spin_is_locked(&ip->i_flags_lock)); | 71 | ASSERT(!spin_is_locked(&ip->i_flags_lock)); |
@@ -98,7 +101,7 @@ void | |||
98 | xfs_inode_free( | 101 | xfs_inode_free( |
99 | struct xfs_inode *ip) | 102 | struct xfs_inode *ip) |
100 | { | 103 | { |
101 | switch (ip->i_d.di_mode & S_IFMT) { | 104 | switch (VFS_I(ip)->i_mode & S_IFMT) { |
102 | case S_IFREG: | 105 | case S_IFREG: |
103 | case S_IFDIR: | 106 | case S_IFDIR: |
104 | case S_IFLNK: | 107 | case S_IFLNK: |
@@ -151,12 +154,14 @@ xfs_reinit_inode( | |||
151 | uint32_t nlink = inode->i_nlink; | 154 | uint32_t nlink = inode->i_nlink; |
152 | uint32_t generation = inode->i_generation; | 155 | uint32_t generation = inode->i_generation; |
153 | uint64_t version = inode->i_version; | 156 | uint64_t version = inode->i_version; |
157 | umode_t mode = inode->i_mode; | ||
154 | 158 | ||
155 | error = inode_init_always(mp->m_super, inode); | 159 | error = inode_init_always(mp->m_super, inode); |
156 | 160 | ||
157 | set_nlink(inode, nlink); | 161 | set_nlink(inode, nlink); |
158 | inode->i_generation = generation; | 162 | inode->i_generation = generation; |
159 | inode->i_version = version; | 163 | inode->i_version = version; |
164 | inode->i_mode = mode; | ||
160 | return error; | 165 | return error; |
161 | } | 166 | } |
162 | 167 | ||
@@ -211,7 +216,7 @@ xfs_iget_cache_hit( | |||
211 | /* | 216 | /* |
212 | * If lookup is racing with unlink return an error immediately. | 217 | * If lookup is racing with unlink return an error immediately. |
213 | */ | 218 | */ |
214 | if (ip->i_d.di_mode == 0 && !(flags & XFS_IGET_CREATE)) { | 219 | if (VFS_I(ip)->i_mode == 0 && !(flags & XFS_IGET_CREATE)) { |
215 | error = -ENOENT; | 220 | error = -ENOENT; |
216 | goto out_error; | 221 | goto out_error; |
217 | } | 222 | } |
@@ -321,7 +326,7 @@ xfs_iget_cache_miss( | |||
321 | 326 | ||
322 | trace_xfs_iget_miss(ip); | 327 | trace_xfs_iget_miss(ip); |
323 | 328 | ||
324 | if ((ip->i_d.di_mode == 0) && !(flags & XFS_IGET_CREATE)) { | 329 | if ((VFS_I(ip)->i_mode == 0) && !(flags & XFS_IGET_CREATE)) { |
325 | error = -ENOENT; | 330 | error = -ENOENT; |
326 | goto out_destroy; | 331 | goto out_destroy; |
327 | } | 332 | } |
@@ -470,7 +475,7 @@ again: | |||
470 | * If we have a real type for an on-disk inode, we can setup the inode | 475 | * If we have a real type for an on-disk inode, we can setup the inode |
471 | * now. If it's a new inode being created, xfs_ialloc will handle it. | 476 | * now. If it's a new inode being created, xfs_ialloc will handle it. |
472 | */ | 477 | */ |
473 | if (xfs_iflags_test(ip, XFS_INEW) && ip->i_d.di_mode != 0) | 478 | if (xfs_iflags_test(ip, XFS_INEW) && VFS_I(ip)->i_mode != 0) |
474 | xfs_setup_existing_inode(ip); | 479 | xfs_setup_existing_inode(ip); |
475 | return 0; | 480 | return 0; |
476 | 481 | ||
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 8a970056a2c4..26bac4ab79a3 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -802,7 +802,7 @@ xfs_ialloc( | |||
802 | if (ip->i_d.di_version == 1) | 802 | if (ip->i_d.di_version == 1) |
803 | ip->i_d.di_version = 2; | 803 | ip->i_d.di_version = 2; |
804 | 804 | ||
805 | ip->i_d.di_mode = mode; | 805 | inode->i_mode = mode; |
806 | set_nlink(inode, nlink); | 806 | set_nlink(inode, nlink); |
807 | ip->i_d.di_uid = xfs_kuid_to_uid(current_fsuid()); | 807 | ip->i_d.di_uid = xfs_kuid_to_uid(current_fsuid()); |
808 | ip->i_d.di_gid = xfs_kgid_to_gid(current_fsgid()); | 808 | ip->i_d.di_gid = xfs_kgid_to_gid(current_fsgid()); |
@@ -810,9 +810,8 @@ xfs_ialloc( | |||
810 | 810 | ||
811 | if (pip && XFS_INHERIT_GID(pip)) { | 811 | if (pip && XFS_INHERIT_GID(pip)) { |
812 | ip->i_d.di_gid = pip->i_d.di_gid; | 812 | ip->i_d.di_gid = pip->i_d.di_gid; |
813 | if ((pip->i_d.di_mode & S_ISGID) && S_ISDIR(mode)) { | 813 | if ((VFS_I(pip)->i_mode & S_ISGID) && S_ISDIR(mode)) |
814 | ip->i_d.di_mode |= S_ISGID; | 814 | inode->i_mode |= S_ISGID; |
815 | } | ||
816 | } | 815 | } |
817 | 816 | ||
818 | /* | 817 | /* |
@@ -821,10 +820,9 @@ xfs_ialloc( | |||
821 | * (and only if the irix_sgid_inherit compatibility variable is set). | 820 | * (and only if the irix_sgid_inherit compatibility variable is set). |
822 | */ | 821 | */ |
823 | if ((irix_sgid_inherit) && | 822 | if ((irix_sgid_inherit) && |
824 | (ip->i_d.di_mode & S_ISGID) && | 823 | (inode->i_mode & S_ISGID) && |
825 | (!in_group_p(xfs_gid_to_kgid(ip->i_d.di_gid)))) { | 824 | (!in_group_p(xfs_gid_to_kgid(ip->i_d.di_gid)))) |
826 | ip->i_d.di_mode &= ~S_ISGID; | 825 | inode->i_mode &= ~S_ISGID; |
827 | } | ||
828 | 826 | ||
829 | ip->i_d.di_size = 0; | 827 | ip->i_d.di_size = 0; |
830 | ip->i_d.di_nextents = 0; | 828 | ip->i_d.di_nextents = 0; |
@@ -1421,7 +1419,7 @@ xfs_link( | |||
1421 | 1419 | ||
1422 | trace_xfs_link(tdp, target_name); | 1420 | trace_xfs_link(tdp, target_name); |
1423 | 1421 | ||
1424 | ASSERT(!S_ISDIR(sip->i_d.di_mode)); | 1422 | ASSERT(!S_ISDIR(VFS_I(sip)->i_mode)); |
1425 | 1423 | ||
1426 | if (XFS_FORCED_SHUTDOWN(mp)) | 1424 | if (XFS_FORCED_SHUTDOWN(mp)) |
1427 | return -EIO; | 1425 | return -EIO; |
@@ -1628,7 +1626,7 @@ xfs_release( | |||
1628 | xfs_mount_t *mp = ip->i_mount; | 1626 | xfs_mount_t *mp = ip->i_mount; |
1629 | int error; | 1627 | int error; |
1630 | 1628 | ||
1631 | if (!S_ISREG(ip->i_d.di_mode) || (ip->i_d.di_mode == 0)) | 1629 | if (!S_ISREG(VFS_I(ip)->i_mode) || (VFS_I(ip)->i_mode == 0)) |
1632 | return 0; | 1630 | return 0; |
1633 | 1631 | ||
1634 | /* If this is a read-only mount, don't do this (would generate I/O) */ | 1632 | /* If this is a read-only mount, don't do this (would generate I/O) */ |
@@ -1863,7 +1861,7 @@ xfs_inactive( | |||
1863 | * If the inode is already free, then there can be nothing | 1861 | * If the inode is already free, then there can be nothing |
1864 | * to clean up here. | 1862 | * to clean up here. |
1865 | */ | 1863 | */ |
1866 | if (ip->i_d.di_mode == 0) { | 1864 | if (VFS_I(ip)->i_mode == 0) { |
1867 | ASSERT(ip->i_df.if_real_bytes == 0); | 1865 | ASSERT(ip->i_df.if_real_bytes == 0); |
1868 | ASSERT(ip->i_df.if_broot_bytes == 0); | 1866 | ASSERT(ip->i_df.if_broot_bytes == 0); |
1869 | return; | 1867 | return; |
@@ -1887,7 +1885,7 @@ xfs_inactive( | |||
1887 | return; | 1885 | return; |
1888 | } | 1886 | } |
1889 | 1887 | ||
1890 | if (S_ISREG(ip->i_d.di_mode) && | 1888 | if (S_ISREG(VFS_I(ip)->i_mode) && |
1891 | (ip->i_d.di_size != 0 || XFS_ISIZE(ip) != 0 || | 1889 | (ip->i_d.di_size != 0 || XFS_ISIZE(ip) != 0 || |
1892 | ip->i_d.di_nextents > 0 || ip->i_delayed_blks > 0)) | 1890 | ip->i_d.di_nextents > 0 || ip->i_delayed_blks > 0)) |
1893 | truncate = 1; | 1891 | truncate = 1; |
@@ -1896,7 +1894,7 @@ xfs_inactive( | |||
1896 | if (error) | 1894 | if (error) |
1897 | return; | 1895 | return; |
1898 | 1896 | ||
1899 | if (S_ISLNK(ip->i_d.di_mode)) | 1897 | if (S_ISLNK(VFS_I(ip)->i_mode)) |
1900 | error = xfs_inactive_symlink(ip); | 1898 | error = xfs_inactive_symlink(ip); |
1901 | else if (truncate) | 1899 | else if (truncate) |
1902 | error = xfs_inactive_truncate(ip); | 1900 | error = xfs_inactive_truncate(ip); |
@@ -1956,7 +1954,7 @@ xfs_iunlink( | |||
1956 | int offset; | 1954 | int offset; |
1957 | int error; | 1955 | int error; |
1958 | 1956 | ||
1959 | ASSERT(ip->i_d.di_mode != 0); | 1957 | ASSERT(VFS_I(ip)->i_mode != 0); |
1960 | 1958 | ||
1961 | /* | 1959 | /* |
1962 | * Get the agi buffer first. It ensures lock ordering | 1960 | * Get the agi buffer first. It ensures lock ordering |
@@ -2397,7 +2395,7 @@ xfs_ifree( | |||
2397 | ASSERT(VFS_I(ip)->i_nlink == 0); | 2395 | ASSERT(VFS_I(ip)->i_nlink == 0); |
2398 | ASSERT(ip->i_d.di_nextents == 0); | 2396 | ASSERT(ip->i_d.di_nextents == 0); |
2399 | ASSERT(ip->i_d.di_anextents == 0); | 2397 | ASSERT(ip->i_d.di_anextents == 0); |
2400 | ASSERT(ip->i_d.di_size == 0 || !S_ISREG(ip->i_d.di_mode)); | 2398 | ASSERT(ip->i_d.di_size == 0 || !S_ISREG(VFS_I(ip)->i_mode)); |
2401 | ASSERT(ip->i_d.di_nblocks == 0); | 2399 | ASSERT(ip->i_d.di_nblocks == 0); |
2402 | 2400 | ||
2403 | /* | 2401 | /* |
@@ -2411,7 +2409,7 @@ xfs_ifree( | |||
2411 | if (error) | 2409 | if (error) |
2412 | return error; | 2410 | return error; |
2413 | 2411 | ||
2414 | ip->i_d.di_mode = 0; /* mark incore inode as free */ | 2412 | VFS_I(ip)->i_mode = 0; /* mark incore inode as free */ |
2415 | ip->i_d.di_flags = 0; | 2413 | ip->i_d.di_flags = 0; |
2416 | ip->i_d.di_dmevmask = 0; | 2414 | ip->i_d.di_dmevmask = 0; |
2417 | ip->i_d.di_forkoff = 0; /* mark the attr fork not in use */ | 2415 | ip->i_d.di_forkoff = 0; /* mark the attr fork not in use */ |
@@ -2508,7 +2506,7 @@ xfs_remove( | |||
2508 | { | 2506 | { |
2509 | xfs_mount_t *mp = dp->i_mount; | 2507 | xfs_mount_t *mp = dp->i_mount; |
2510 | xfs_trans_t *tp = NULL; | 2508 | xfs_trans_t *tp = NULL; |
2511 | int is_dir = S_ISDIR(ip->i_d.di_mode); | 2509 | int is_dir = S_ISDIR(VFS_I(ip)->i_mode); |
2512 | int error = 0; | 2510 | int error = 0; |
2513 | xfs_bmap_free_t free_list; | 2511 | xfs_bmap_free_t free_list; |
2514 | xfs_fsblock_t first_block; | 2512 | xfs_fsblock_t first_block; |
@@ -2753,7 +2751,7 @@ xfs_cross_rename( | |||
2753 | if (dp1 != dp2) { | 2751 | if (dp1 != dp2) { |
2754 | dp2_flags = XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG; | 2752 | dp2_flags = XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG; |
2755 | 2753 | ||
2756 | if (S_ISDIR(ip2->i_d.di_mode)) { | 2754 | if (S_ISDIR(VFS_I(ip2)->i_mode)) { |
2757 | error = xfs_dir_replace(tp, ip2, &xfs_name_dotdot, | 2755 | error = xfs_dir_replace(tp, ip2, &xfs_name_dotdot, |
2758 | dp1->i_ino, first_block, | 2756 | dp1->i_ino, first_block, |
2759 | free_list, spaceres); | 2757 | free_list, spaceres); |
@@ -2761,7 +2759,7 @@ xfs_cross_rename( | |||
2761 | goto out_trans_abort; | 2759 | goto out_trans_abort; |
2762 | 2760 | ||
2763 | /* transfer ip2 ".." reference to dp1 */ | 2761 | /* transfer ip2 ".." reference to dp1 */ |
2764 | if (!S_ISDIR(ip1->i_d.di_mode)) { | 2762 | if (!S_ISDIR(VFS_I(ip1)->i_mode)) { |
2765 | error = xfs_droplink(tp, dp2); | 2763 | error = xfs_droplink(tp, dp2); |
2766 | if (error) | 2764 | if (error) |
2767 | goto out_trans_abort; | 2765 | goto out_trans_abort; |
@@ -2780,7 +2778,7 @@ xfs_cross_rename( | |||
2780 | ip2_flags |= XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG; | 2778 | ip2_flags |= XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG; |
2781 | } | 2779 | } |
2782 | 2780 | ||
2783 | if (S_ISDIR(ip1->i_d.di_mode)) { | 2781 | if (S_ISDIR(VFS_I(ip1)->i_mode)) { |
2784 | error = xfs_dir_replace(tp, ip1, &xfs_name_dotdot, | 2782 | error = xfs_dir_replace(tp, ip1, &xfs_name_dotdot, |
2785 | dp2->i_ino, first_block, | 2783 | dp2->i_ino, first_block, |
2786 | free_list, spaceres); | 2784 | free_list, spaceres); |
@@ -2788,7 +2786,7 @@ xfs_cross_rename( | |||
2788 | goto out_trans_abort; | 2786 | goto out_trans_abort; |
2789 | 2787 | ||
2790 | /* transfer ip1 ".." reference to dp2 */ | 2788 | /* transfer ip1 ".." reference to dp2 */ |
2791 | if (!S_ISDIR(ip2->i_d.di_mode)) { | 2789 | if (!S_ISDIR(VFS_I(ip2)->i_mode)) { |
2792 | error = xfs_droplink(tp, dp1); | 2790 | error = xfs_droplink(tp, dp1); |
2793 | if (error) | 2791 | if (error) |
2794 | goto out_trans_abort; | 2792 | goto out_trans_abort; |
@@ -2885,7 +2883,7 @@ xfs_rename( | |||
2885 | struct xfs_inode *inodes[__XFS_SORT_INODES]; | 2883 | struct xfs_inode *inodes[__XFS_SORT_INODES]; |
2886 | int num_inodes = __XFS_SORT_INODES; | 2884 | int num_inodes = __XFS_SORT_INODES; |
2887 | bool new_parent = (src_dp != target_dp); | 2885 | bool new_parent = (src_dp != target_dp); |
2888 | bool src_is_directory = S_ISDIR(src_ip->i_d.di_mode); | 2886 | bool src_is_directory = S_ISDIR(VFS_I(src_ip)->i_mode); |
2889 | int spaceres; | 2887 | int spaceres; |
2890 | int error; | 2888 | int error; |
2891 | 2889 | ||
@@ -3014,7 +3012,7 @@ xfs_rename( | |||
3014 | * target and source are directories and that target can be | 3012 | * target and source are directories and that target can be |
3015 | * destroyed, or that neither is a directory. | 3013 | * destroyed, or that neither is a directory. |
3016 | */ | 3014 | */ |
3017 | if (S_ISDIR(target_ip->i_d.di_mode)) { | 3015 | if (S_ISDIR(VFS_I(target_ip)->i_mode)) { |
3018 | /* | 3016 | /* |
3019 | * Make sure target dir is empty. | 3017 | * Make sure target dir is empty. |
3020 | */ | 3018 | */ |
@@ -3444,7 +3442,7 @@ xfs_iflush_int( | |||
3444 | __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip); | 3442 | __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip); |
3445 | goto corrupt_out; | 3443 | goto corrupt_out; |
3446 | } | 3444 | } |
3447 | if (S_ISREG(ip->i_d.di_mode)) { | 3445 | if (S_ISREG(VFS_I(ip)->i_mode)) { |
3448 | if (XFS_TEST_ERROR( | 3446 | if (XFS_TEST_ERROR( |
3449 | (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && | 3447 | (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && |
3450 | (ip->i_d.di_format != XFS_DINODE_FMT_BTREE), | 3448 | (ip->i_d.di_format != XFS_DINODE_FMT_BTREE), |
@@ -3454,7 +3452,7 @@ xfs_iflush_int( | |||
3454 | __func__, ip->i_ino, ip); | 3452 | __func__, ip->i_ino, ip); |
3455 | goto corrupt_out; | 3453 | goto corrupt_out; |
3456 | } | 3454 | } |
3457 | } else if (S_ISDIR(ip->i_d.di_mode)) { | 3455 | } else if (S_ISDIR(VFS_I(ip)->i_mode)) { |
3458 | if (XFS_TEST_ERROR( | 3456 | if (XFS_TEST_ERROR( |
3459 | (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && | 3457 | (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && |
3460 | (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) && | 3458 | (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) && |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index e74d13d3076b..d6277494e606 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -88,7 +88,7 @@ static inline struct inode *VFS_I(struct xfs_inode *ip) | |||
88 | */ | 88 | */ |
89 | static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip) | 89 | static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip) |
90 | { | 90 | { |
91 | if (S_ISREG(ip->i_d.di_mode)) | 91 | if (S_ISREG(VFS_I(ip)->i_mode)) |
92 | return i_size_read(VFS_I(ip)); | 92 | return i_size_read(VFS_I(ip)); |
93 | return ip->i_d.di_size; | 93 | return ip->i_d.di_size; |
94 | } | 94 | } |
@@ -369,7 +369,7 @@ static inline int xfs_isiflocked(struct xfs_inode *ip) | |||
369 | */ | 369 | */ |
370 | #define XFS_INHERIT_GID(pip) \ | 370 | #define XFS_INHERIT_GID(pip) \ |
371 | (((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \ | 371 | (((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \ |
372 | ((pip)->i_d.di_mode & S_ISGID)) | 372 | (VFS_I(pip)->i_mode & S_ISGID)) |
373 | 373 | ||
374 | int xfs_release(struct xfs_inode *ip); | 374 | int xfs_release(struct xfs_inode *ip); |
375 | void xfs_inactive(struct xfs_inode *ip); | 375 | void xfs_inactive(struct xfs_inode *ip); |
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index 3415c63bc843..c48b5b18d771 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c | |||
@@ -333,7 +333,6 @@ xfs_inode_to_log_dinode( | |||
333 | 333 | ||
334 | to->di_magic = XFS_DINODE_MAGIC; | 334 | to->di_magic = XFS_DINODE_MAGIC; |
335 | 335 | ||
336 | to->di_mode = from->di_mode; | ||
337 | to->di_version = from->di_version; | 336 | to->di_version = from->di_version; |
338 | to->di_format = from->di_format; | 337 | to->di_format = from->di_format; |
339 | to->di_uid = from->di_uid; | 338 | to->di_uid = from->di_uid; |
@@ -351,6 +350,7 @@ xfs_inode_to_log_dinode( | |||
351 | to->di_ctime.t_nsec = inode->i_ctime.tv_nsec; | 350 | to->di_ctime.t_nsec = inode->i_ctime.tv_nsec; |
352 | to->di_nlink = inode->i_nlink; | 351 | to->di_nlink = inode->i_nlink; |
353 | to->di_gen = inode->i_generation; | 352 | to->di_gen = inode->i_generation; |
353 | to->di_mode = inode->i_mode; | ||
354 | 354 | ||
355 | to->di_size = from->di_size; | 355 | to->di_size = from->di_size; |
356 | to->di_nblocks = from->di_nblocks; | 356 | to->di_nblocks = from->di_nblocks; |
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index cdd6c3156d53..81d6d6218803 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c | |||
@@ -963,7 +963,7 @@ xfs_set_diflags( | |||
963 | di_flags |= XFS_DIFLAG_NODEFRAG; | 963 | di_flags |= XFS_DIFLAG_NODEFRAG; |
964 | if (xflags & FS_XFLAG_FILESTREAM) | 964 | if (xflags & FS_XFLAG_FILESTREAM) |
965 | di_flags |= XFS_DIFLAG_FILESTREAM; | 965 | di_flags |= XFS_DIFLAG_FILESTREAM; |
966 | if (S_ISDIR(ip->i_d.di_mode)) { | 966 | if (S_ISDIR(VFS_I(ip)->i_mode)) { |
967 | if (xflags & FS_XFLAG_RTINHERIT) | 967 | if (xflags & FS_XFLAG_RTINHERIT) |
968 | di_flags |= XFS_DIFLAG_RTINHERIT; | 968 | di_flags |= XFS_DIFLAG_RTINHERIT; |
969 | if (xflags & FS_XFLAG_NOSYMLINKS) | 969 | if (xflags & FS_XFLAG_NOSYMLINKS) |
@@ -972,7 +972,7 @@ xfs_set_diflags( | |||
972 | di_flags |= XFS_DIFLAG_EXTSZINHERIT; | 972 | di_flags |= XFS_DIFLAG_EXTSZINHERIT; |
973 | if (xflags & FS_XFLAG_PROJINHERIT) | 973 | if (xflags & FS_XFLAG_PROJINHERIT) |
974 | di_flags |= XFS_DIFLAG_PROJINHERIT; | 974 | di_flags |= XFS_DIFLAG_PROJINHERIT; |
975 | } else if (S_ISREG(ip->i_d.di_mode)) { | 975 | } else if (S_ISREG(VFS_I(ip)->i_mode)) { |
976 | if (xflags & FS_XFLAG_REALTIME) | 976 | if (xflags & FS_XFLAG_REALTIME) |
977 | di_flags |= XFS_DIFLAG_REALTIME; | 977 | di_flags |= XFS_DIFLAG_REALTIME; |
978 | if (xflags & FS_XFLAG_EXTSIZE) | 978 | if (xflags & FS_XFLAG_EXTSIZE) |
@@ -1128,14 +1128,14 @@ xfs_ioctl_setattr_check_extsize( | |||
1128 | { | 1128 | { |
1129 | struct xfs_mount *mp = ip->i_mount; | 1129 | struct xfs_mount *mp = ip->i_mount; |
1130 | 1130 | ||
1131 | if ((fa->fsx_xflags & FS_XFLAG_EXTSIZE) && !S_ISREG(ip->i_d.di_mode)) | 1131 | if ((fa->fsx_xflags & FS_XFLAG_EXTSIZE) && !S_ISREG(VFS_I(ip)->i_mode)) |
1132 | return -EINVAL; | 1132 | return -EINVAL; |
1133 | 1133 | ||
1134 | if ((fa->fsx_xflags & FS_XFLAG_EXTSZINHERIT) && | 1134 | if ((fa->fsx_xflags & FS_XFLAG_EXTSZINHERIT) && |
1135 | !S_ISDIR(ip->i_d.di_mode)) | 1135 | !S_ISDIR(VFS_I(ip)->i_mode)) |
1136 | return -EINVAL; | 1136 | return -EINVAL; |
1137 | 1137 | ||
1138 | if (S_ISREG(ip->i_d.di_mode) && ip->i_d.di_nextents && | 1138 | if (S_ISREG(VFS_I(ip)->i_mode) && ip->i_d.di_nextents && |
1139 | ((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) != fa->fsx_extsize)) | 1139 | ((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) != fa->fsx_extsize)) |
1140 | return -EINVAL; | 1140 | return -EINVAL; |
1141 | 1141 | ||
@@ -1256,9 +1256,9 @@ xfs_ioctl_setattr( | |||
1256 | * successful return from chown() | 1256 | * successful return from chown() |
1257 | */ | 1257 | */ |
1258 | 1258 | ||
1259 | if ((ip->i_d.di_mode & (S_ISUID|S_ISGID)) && | 1259 | if ((VFS_I(ip)->i_mode & (S_ISUID|S_ISGID)) && |
1260 | !capable_wrt_inode_uidgid(VFS_I(ip), CAP_FSETID)) | 1260 | !capable_wrt_inode_uidgid(VFS_I(ip), CAP_FSETID)) |
1261 | ip->i_d.di_mode &= ~(S_ISUID|S_ISGID); | 1261 | VFS_I(ip)->i_mode &= ~(S_ISUID|S_ISGID); |
1262 | 1262 | ||
1263 | /* Change the ownerships and register project quota modifications */ | 1263 | /* Change the ownerships and register project quota modifications */ |
1264 | if (xfs_get_projid(ip) != fa->fsx_projid) { | 1264 | if (xfs_get_projid(ip) != fa->fsx_projid) { |
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index a4daa3fd3ae9..0d38b1d2c420 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -459,7 +459,7 @@ xfs_vn_getattr( | |||
459 | 459 | ||
460 | stat->size = XFS_ISIZE(ip); | 460 | stat->size = XFS_ISIZE(ip); |
461 | stat->dev = inode->i_sb->s_dev; | 461 | stat->dev = inode->i_sb->s_dev; |
462 | stat->mode = ip->i_d.di_mode; | 462 | stat->mode = inode->i_mode; |
463 | stat->nlink = inode->i_nlink; | 463 | stat->nlink = inode->i_nlink; |
464 | stat->uid = inode->i_uid; | 464 | stat->uid = inode->i_uid; |
465 | stat->gid = inode->i_gid; | 465 | stat->gid = inode->i_gid; |
@@ -506,9 +506,6 @@ xfs_setattr_mode( | |||
506 | 506 | ||
507 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); | 507 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); |
508 | 508 | ||
509 | ip->i_d.di_mode &= S_IFMT; | ||
510 | ip->i_d.di_mode |= mode & ~S_IFMT; | ||
511 | |||
512 | inode->i_mode &= S_IFMT; | 509 | inode->i_mode &= S_IFMT; |
513 | inode->i_mode |= mode & ~S_IFMT; | 510 | inode->i_mode |= mode & ~S_IFMT; |
514 | } | 511 | } |
@@ -652,9 +649,9 @@ xfs_setattr_nonsize( | |||
652 | * The set-user-ID and set-group-ID bits of a file will be | 649 | * The set-user-ID and set-group-ID bits of a file will be |
653 | * cleared upon successful return from chown() | 650 | * cleared upon successful return from chown() |
654 | */ | 651 | */ |
655 | if ((ip->i_d.di_mode & (S_ISUID|S_ISGID)) && | 652 | if ((inode->i_mode & (S_ISUID|S_ISGID)) && |
656 | !capable(CAP_FSETID)) | 653 | !capable(CAP_FSETID)) |
657 | ip->i_d.di_mode &= ~(S_ISUID|S_ISGID); | 654 | inode->i_mode &= ~(S_ISUID|S_ISGID); |
658 | 655 | ||
659 | /* | 656 | /* |
660 | * Change the ownerships and register quota modifications | 657 | * Change the ownerships and register quota modifications |
@@ -764,7 +761,7 @@ xfs_setattr_size( | |||
764 | 761 | ||
765 | ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL)); | 762 | ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL)); |
766 | ASSERT(xfs_isilocked(ip, XFS_MMAPLOCK_EXCL)); | 763 | ASSERT(xfs_isilocked(ip, XFS_MMAPLOCK_EXCL)); |
767 | ASSERT(S_ISREG(ip->i_d.di_mode)); | 764 | ASSERT(S_ISREG(inode->i_mode)); |
768 | ASSERT((iattr->ia_valid & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET| | 765 | ASSERT((iattr->ia_valid & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET| |
769 | ATTR_MTIME_SET|ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0); | 766 | ATTR_MTIME_SET|ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0); |
770 | 767 | ||
@@ -1215,7 +1212,6 @@ xfs_setup_inode( | |||
1215 | /* make the inode look hashed for the writeback code */ | 1212 | /* make the inode look hashed for the writeback code */ |
1216 | hlist_add_fake(&inode->i_hash); | 1213 | hlist_add_fake(&inode->i_hash); |
1217 | 1214 | ||
1218 | inode->i_mode = ip->i_d.di_mode; | ||
1219 | inode->i_uid = xfs_uid_to_kuid(ip->i_d.di_uid); | 1215 | inode->i_uid = xfs_uid_to_kuid(ip->i_d.di_uid); |
1220 | inode->i_gid = xfs_gid_to_kgid(ip->i_d.di_gid); | 1216 | inode->i_gid = xfs_gid_to_kgid(ip->i_d.di_gid); |
1221 | 1217 | ||
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c index 6162e65f10b6..ce73eb34620d 100644 --- a/fs/xfs/xfs_itable.c +++ b/fs/xfs/xfs_itable.c | |||
@@ -88,7 +88,6 @@ xfs_bulkstat_one_int( | |||
88 | buf->bs_projid_lo = dic->di_projid_lo; | 88 | buf->bs_projid_lo = dic->di_projid_lo; |
89 | buf->bs_projid_hi = dic->di_projid_hi; | 89 | buf->bs_projid_hi = dic->di_projid_hi; |
90 | buf->bs_ino = ino; | 90 | buf->bs_ino = ino; |
91 | buf->bs_mode = dic->di_mode; | ||
92 | buf->bs_uid = dic->di_uid; | 91 | buf->bs_uid = dic->di_uid; |
93 | buf->bs_gid = dic->di_gid; | 92 | buf->bs_gid = dic->di_gid; |
94 | buf->bs_size = dic->di_size; | 93 | buf->bs_size = dic->di_size; |
@@ -101,6 +100,7 @@ xfs_bulkstat_one_int( | |||
101 | buf->bs_ctime.tv_sec = inode->i_ctime.tv_sec; | 100 | buf->bs_ctime.tv_sec = inode->i_ctime.tv_sec; |
102 | buf->bs_ctime.tv_nsec = inode->i_ctime.tv_nsec; | 101 | buf->bs_ctime.tv_nsec = inode->i_ctime.tv_nsec; |
103 | buf->bs_gen = inode->i_generation; | 102 | buf->bs_gen = inode->i_generation; |
103 | buf->bs_mode = inode->i_mode; | ||
104 | 104 | ||
105 | buf->bs_xflags = xfs_ip2xflags(ip); | 105 | buf->bs_xflags = xfs_ip2xflags(ip); |
106 | buf->bs_extsize = dic->di_extsize << mp->m_sb.sb_blocklog; | 106 | buf->bs_extsize = dic->di_extsize << mp->m_sb.sb_blocklog; |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 611c25cdb15c..bd6f23b952a5 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -4338,7 +4338,7 @@ xlog_recover_process_one_iunlink( | |||
4338 | goto fail_iput; | 4338 | goto fail_iput; |
4339 | 4339 | ||
4340 | ASSERT(VFS_I(ip)->i_nlink == 0); | 4340 | ASSERT(VFS_I(ip)->i_nlink == 0); |
4341 | ASSERT(ip->i_d.di_mode != 0); | 4341 | ASSERT(VFS_I(ip)->i_mode != 0); |
4342 | 4342 | ||
4343 | /* setup for the next pass */ | 4343 | /* setup for the next pass */ |
4344 | agino = be32_to_cpu(dip->di_next_unlinked); | 4344 | agino = be32_to_cpu(dip->di_next_unlinked); |
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index bb753b359bee..d3061054bad2 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -865,7 +865,7 @@ xfs_mountfs( | |||
865 | 865 | ||
866 | ASSERT(rip != NULL); | 866 | ASSERT(rip != NULL); |
867 | 867 | ||
868 | if (unlikely(!S_ISDIR(rip->i_d.di_mode))) { | 868 | if (unlikely(!S_ISDIR(VFS_I(rip)->i_mode))) { |
869 | xfs_warn(mp, "corrupted root inode %llu: not a directory", | 869 | xfs_warn(mp, "corrupted root inode %llu: not a directory", |
870 | (unsigned long long)rip->i_ino); | 870 | (unsigned long long)rip->i_ino); |
871 | xfs_iunlock(rip, XFS_ILOCK_EXCL); | 871 | xfs_iunlock(rip, XFS_ILOCK_EXCL); |