diff options
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 68 |
1 files changed, 26 insertions, 42 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 26d96d1b25cd..00a6b7dc24a0 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include "xfs_trans.h" | 25 | #include "xfs_trans.h" |
26 | #include "xfs_sb.h" | 26 | #include "xfs_sb.h" |
27 | #include "xfs_ag.h" | 27 | #include "xfs_ag.h" |
28 | #include "xfs_dir.h" | ||
29 | #include "xfs_dir2.h" | 28 | #include "xfs_dir2.h" |
30 | #include "xfs_dmapi.h" | 29 | #include "xfs_dmapi.h" |
31 | #include "xfs_mount.h" | 30 | #include "xfs_mount.h" |
@@ -33,13 +32,11 @@ | |||
33 | #include "xfs_bmap_btree.h" | 32 | #include "xfs_bmap_btree.h" |
34 | #include "xfs_alloc_btree.h" | 33 | #include "xfs_alloc_btree.h" |
35 | #include "xfs_ialloc_btree.h" | 34 | #include "xfs_ialloc_btree.h" |
36 | #include "xfs_dir_sf.h" | ||
37 | #include "xfs_dir2_sf.h" | 35 | #include "xfs_dir2_sf.h" |
38 | #include "xfs_attr_sf.h" | 36 | #include "xfs_attr_sf.h" |
39 | #include "xfs_dinode.h" | 37 | #include "xfs_dinode.h" |
40 | #include "xfs_inode.h" | 38 | #include "xfs_inode.h" |
41 | #include "xfs_inode_item.h" | 39 | #include "xfs_inode_item.h" |
42 | #include "xfs_dir_leaf.h" | ||
43 | #include "xfs_itable.h" | 40 | #include "xfs_itable.h" |
44 | #include "xfs_btree.h" | 41 | #include "xfs_btree.h" |
45 | #include "xfs_ialloc.h" | 42 | #include "xfs_ialloc.h" |
@@ -1958,8 +1955,7 @@ xfs_create( | |||
1958 | if (error) | 1955 | if (error) |
1959 | goto error_return; | 1956 | goto error_return; |
1960 | 1957 | ||
1961 | if (resblks == 0 && | 1958 | if (resblks == 0 && (error = xfs_dir_canenter(tp, dp, name, namelen))) |
1962 | (error = XFS_DIR_CANENTER(mp, tp, dp, name, namelen))) | ||
1963 | goto error_return; | 1959 | goto error_return; |
1964 | rdev = (vap->va_mask & XFS_AT_RDEV) ? vap->va_rdev : 0; | 1960 | rdev = (vap->va_mask & XFS_AT_RDEV) ? vap->va_rdev : 0; |
1965 | error = xfs_dir_ialloc(&tp, dp, vap->va_mode, 1, | 1961 | error = xfs_dir_ialloc(&tp, dp, vap->va_mode, 1, |
@@ -1990,9 +1986,9 @@ xfs_create( | |||
1990 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); | 1986 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); |
1991 | dp_joined_to_trans = B_TRUE; | 1987 | dp_joined_to_trans = B_TRUE; |
1992 | 1988 | ||
1993 | error = XFS_DIR_CREATENAME(mp, tp, dp, name, namelen, ip->i_ino, | 1989 | error = xfs_dir_createname(tp, dp, name, namelen, ip->i_ino, |
1994 | &first_block, &free_list, | 1990 | &first_block, &free_list, resblks ? |
1995 | resblks ? resblks - XFS_IALLOC_SPACE_RES(mp) : 0); | 1991 | resblks - XFS_IALLOC_SPACE_RES(mp) : 0); |
1996 | if (error) { | 1992 | if (error) { |
1997 | ASSERT(error != ENOSPC); | 1993 | ASSERT(error != ENOSPC); |
1998 | goto abort_return; | 1994 | goto abort_return; |
@@ -2468,8 +2464,8 @@ xfs_remove( | |||
2468 | * Entry must exist since we did a lookup in xfs_lock_dir_and_entry. | 2464 | * Entry must exist since we did a lookup in xfs_lock_dir_and_entry. |
2469 | */ | 2465 | */ |
2470 | XFS_BMAP_INIT(&free_list, &first_block); | 2466 | XFS_BMAP_INIT(&free_list, &first_block); |
2471 | error = XFS_DIR_REMOVENAME(mp, tp, dp, name, namelen, ip->i_ino, | 2467 | error = xfs_dir_removename(tp, dp, name, namelen, ip->i_ino, |
2472 | &first_block, &free_list, 0); | 2468 | &first_block, &free_list, 0); |
2473 | if (error) { | 2469 | if (error) { |
2474 | ASSERT(error != ENOENT); | 2470 | ASSERT(error != ENOENT); |
2475 | REMOVE_DEBUG_TRACE(__LINE__); | 2471 | REMOVE_DEBUG_TRACE(__LINE__); |
@@ -2688,13 +2684,12 @@ xfs_link( | |||
2688 | } | 2684 | } |
2689 | 2685 | ||
2690 | if (resblks == 0 && | 2686 | if (resblks == 0 && |
2691 | (error = XFS_DIR_CANENTER(mp, tp, tdp, target_name, | 2687 | (error = xfs_dir_canenter(tp, tdp, target_name, target_namelen))) |
2692 | target_namelen))) | ||
2693 | goto error_return; | 2688 | goto error_return; |
2694 | 2689 | ||
2695 | XFS_BMAP_INIT(&free_list, &first_block); | 2690 | XFS_BMAP_INIT(&free_list, &first_block); |
2696 | 2691 | ||
2697 | error = XFS_DIR_CREATENAME(mp, tp, tdp, target_name, target_namelen, | 2692 | error = xfs_dir_createname(tp, tdp, target_name, target_namelen, |
2698 | sip->i_ino, &first_block, &free_list, | 2693 | sip->i_ino, &first_block, &free_list, |
2699 | resblks); | 2694 | resblks); |
2700 | if (error) | 2695 | if (error) |
@@ -2860,7 +2855,7 @@ xfs_mkdir( | |||
2860 | goto error_return; | 2855 | goto error_return; |
2861 | 2856 | ||
2862 | if (resblks == 0 && | 2857 | if (resblks == 0 && |
2863 | (error = XFS_DIR_CANENTER(mp, tp, dp, dir_name, dir_namelen))) | 2858 | (error = xfs_dir_canenter(tp, dp, dir_name, dir_namelen))) |
2864 | goto error_return; | 2859 | goto error_return; |
2865 | /* | 2860 | /* |
2866 | * create the directory inode. | 2861 | * create the directory inode. |
@@ -2887,9 +2882,9 @@ xfs_mkdir( | |||
2887 | 2882 | ||
2888 | XFS_BMAP_INIT(&free_list, &first_block); | 2883 | XFS_BMAP_INIT(&free_list, &first_block); |
2889 | 2884 | ||
2890 | error = XFS_DIR_CREATENAME(mp, tp, dp, dir_name, dir_namelen, | 2885 | error = xfs_dir_createname(tp, dp, dir_name, dir_namelen, cdp->i_ino, |
2891 | cdp->i_ino, &first_block, &free_list, | 2886 | &first_block, &free_list, resblks ? |
2892 | resblks ? resblks - XFS_IALLOC_SPACE_RES(mp) : 0); | 2887 | resblks - XFS_IALLOC_SPACE_RES(mp) : 0); |
2893 | if (error) { | 2888 | if (error) { |
2894 | ASSERT(error != ENOSPC); | 2889 | ASSERT(error != ENOSPC); |
2895 | goto error1; | 2890 | goto error1; |
@@ -2903,16 +2898,14 @@ xfs_mkdir( | |||
2903 | */ | 2898 | */ |
2904 | dp->i_gen++; | 2899 | dp->i_gen++; |
2905 | 2900 | ||
2906 | error = XFS_DIR_INIT(mp, tp, cdp, dp); | 2901 | error = xfs_dir_init(tp, cdp, dp); |
2907 | if (error) { | 2902 | if (error) |
2908 | goto error2; | 2903 | goto error2; |
2909 | } | ||
2910 | 2904 | ||
2911 | cdp->i_gen = 1; | 2905 | cdp->i_gen = 1; |
2912 | error = xfs_bumplink(tp, dp); | 2906 | error = xfs_bumplink(tp, dp); |
2913 | if (error) { | 2907 | if (error) |
2914 | goto error2; | 2908 | goto error2; |
2915 | } | ||
2916 | 2909 | ||
2917 | cvp = XFS_ITOV(cdp); | 2910 | cvp = XFS_ITOV(cdp); |
2918 | 2911 | ||
@@ -3121,16 +3114,15 @@ xfs_rmdir( | |||
3121 | error = XFS_ERROR(ENOTEMPTY); | 3114 | error = XFS_ERROR(ENOTEMPTY); |
3122 | goto error_return; | 3115 | goto error_return; |
3123 | } | 3116 | } |
3124 | if (!XFS_DIR_ISEMPTY(mp, cdp)) { | 3117 | if (!xfs_dir_isempty(cdp)) { |
3125 | error = XFS_ERROR(ENOTEMPTY); | 3118 | error = XFS_ERROR(ENOTEMPTY); |
3126 | goto error_return; | 3119 | goto error_return; |
3127 | } | 3120 | } |
3128 | 3121 | ||
3129 | error = XFS_DIR_REMOVENAME(mp, tp, dp, name, namelen, cdp->i_ino, | 3122 | error = xfs_dir_removename(tp, dp, name, namelen, cdp->i_ino, |
3130 | &first_block, &free_list, resblks); | 3123 | &first_block, &free_list, resblks); |
3131 | if (error) { | 3124 | if (error) |
3132 | goto error1; | 3125 | goto error1; |
3133 | } | ||
3134 | 3126 | ||
3135 | xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 3127 | xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
3136 | 3128 | ||
@@ -3229,8 +3221,6 @@ xfs_rmdir( | |||
3229 | 3221 | ||
3230 | 3222 | ||
3231 | /* | 3223 | /* |
3232 | * xfs_readdir | ||
3233 | * | ||
3234 | * Read dp's entries starting at uiop->uio_offset and translate them into | 3224 | * Read dp's entries starting at uiop->uio_offset and translate them into |
3235 | * bufsize bytes worth of struct dirents starting at bufbase. | 3225 | * bufsize bytes worth of struct dirents starting at bufbase. |
3236 | */ | 3226 | */ |
@@ -3250,21 +3240,16 @@ xfs_readdir( | |||
3250 | (inst_t *)__return_address); | 3240 | (inst_t *)__return_address); |
3251 | dp = XFS_BHVTOI(dir_bdp); | 3241 | dp = XFS_BHVTOI(dir_bdp); |
3252 | 3242 | ||
3253 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) { | 3243 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) |
3254 | return XFS_ERROR(EIO); | 3244 | return XFS_ERROR(EIO); |
3255 | } | ||
3256 | 3245 | ||
3257 | lock_mode = xfs_ilock_map_shared(dp); | 3246 | lock_mode = xfs_ilock_map_shared(dp); |
3258 | error = XFS_DIR_GETDENTS(dp->i_mount, tp, dp, uiop, eofp); | 3247 | error = xfs_dir_getdents(tp, dp, uiop, eofp); |
3259 | xfs_iunlock_map_shared(dp, lock_mode); | 3248 | xfs_iunlock_map_shared(dp, lock_mode); |
3260 | return error; | 3249 | return error; |
3261 | } | 3250 | } |
3262 | 3251 | ||
3263 | 3252 | ||
3264 | /* | ||
3265 | * xfs_symlink | ||
3266 | * | ||
3267 | */ | ||
3268 | STATIC int | 3253 | STATIC int |
3269 | xfs_symlink( | 3254 | xfs_symlink( |
3270 | bhv_desc_t *dir_bdp, | 3255 | bhv_desc_t *dir_bdp, |
@@ -3328,7 +3313,7 @@ xfs_symlink( | |||
3328 | int len, total; | 3313 | int len, total; |
3329 | char *path; | 3314 | char *path; |
3330 | 3315 | ||
3331 | for(total = 0, path = target_path; total < pathlen;) { | 3316 | for (total = 0, path = target_path; total < pathlen;) { |
3332 | /* | 3317 | /* |
3333 | * Skip any slashes. | 3318 | * Skip any slashes. |
3334 | */ | 3319 | */ |
@@ -3422,7 +3407,7 @@ xfs_symlink( | |||
3422 | * Check for ability to enter directory entry, if no space reserved. | 3407 | * Check for ability to enter directory entry, if no space reserved. |
3423 | */ | 3408 | */ |
3424 | if (resblks == 0 && | 3409 | if (resblks == 0 && |
3425 | (error = XFS_DIR_CANENTER(mp, tp, dp, link_name, link_namelen))) | 3410 | (error = xfs_dir_canenter(tp, dp, link_name, link_namelen))) |
3426 | goto error_return; | 3411 | goto error_return; |
3427 | /* | 3412 | /* |
3428 | * Initialize the bmap freelist prior to calling either | 3413 | * Initialize the bmap freelist prior to calling either |
@@ -3509,11 +3494,10 @@ xfs_symlink( | |||
3509 | /* | 3494 | /* |
3510 | * Create the directory entry for the symlink. | 3495 | * Create the directory entry for the symlink. |
3511 | */ | 3496 | */ |
3512 | error = XFS_DIR_CREATENAME(mp, tp, dp, link_name, link_namelen, | 3497 | error = xfs_dir_createname(tp, dp, link_name, link_namelen, ip->i_ino, |
3513 | ip->i_ino, &first_block, &free_list, resblks); | 3498 | &first_block, &free_list, resblks); |
3514 | if (error) { | 3499 | if (error) |
3515 | goto error1; | 3500 | goto error1; |
3516 | } | ||
3517 | xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 3501 | xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
3518 | xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE); | 3502 | xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE); |
3519 | 3503 | ||