diff options
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 48 |
1 files changed, 23 insertions, 25 deletions
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) && |