diff options
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 121 |
1 files changed, 52 insertions, 69 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index bc0a4707189a..ca38fb9a9937 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -1764,7 +1764,7 @@ xfs_inactive( | |||
1764 | int | 1764 | int |
1765 | xfs_lookup( | 1765 | xfs_lookup( |
1766 | xfs_inode_t *dp, | 1766 | xfs_inode_t *dp, |
1767 | bhv_vname_t *dentry, | 1767 | struct xfs_name *name, |
1768 | xfs_inode_t **ipp) | 1768 | xfs_inode_t **ipp) |
1769 | { | 1769 | { |
1770 | xfs_inode_t *ip; | 1770 | xfs_inode_t *ip; |
@@ -1778,7 +1778,7 @@ xfs_lookup( | |||
1778 | return XFS_ERROR(EIO); | 1778 | return XFS_ERROR(EIO); |
1779 | 1779 | ||
1780 | lock_mode = xfs_ilock_map_shared(dp); | 1780 | lock_mode = xfs_ilock_map_shared(dp); |
1781 | error = xfs_dir_lookup_int(dp, lock_mode, dentry, &e_inum, &ip); | 1781 | error = xfs_dir_lookup_int(dp, lock_mode, name, &e_inum, &ip); |
1782 | if (!error) { | 1782 | if (!error) { |
1783 | *ipp = ip; | 1783 | *ipp = ip; |
1784 | xfs_itrace_ref(ip); | 1784 | xfs_itrace_ref(ip); |
@@ -1790,17 +1790,16 @@ xfs_lookup( | |||
1790 | int | 1790 | int |
1791 | xfs_create( | 1791 | xfs_create( |
1792 | xfs_inode_t *dp, | 1792 | xfs_inode_t *dp, |
1793 | bhv_vname_t *dentry, | 1793 | struct xfs_name *name, |
1794 | mode_t mode, | 1794 | mode_t mode, |
1795 | xfs_dev_t rdev, | 1795 | xfs_dev_t rdev, |
1796 | xfs_inode_t **ipp, | 1796 | xfs_inode_t **ipp, |
1797 | cred_t *credp) | 1797 | cred_t *credp) |
1798 | { | 1798 | { |
1799 | char *name = VNAME(dentry); | 1799 | xfs_mount_t *mp = dp->i_mount; |
1800 | xfs_mount_t *mp = dp->i_mount; | ||
1801 | xfs_inode_t *ip; | 1800 | xfs_inode_t *ip; |
1802 | xfs_trans_t *tp; | 1801 | xfs_trans_t *tp; |
1803 | int error; | 1802 | int error; |
1804 | xfs_bmap_free_t free_list; | 1803 | xfs_bmap_free_t free_list; |
1805 | xfs_fsblock_t first_block; | 1804 | xfs_fsblock_t first_block; |
1806 | boolean_t unlock_dp_on_error = B_FALSE; | 1805 | boolean_t unlock_dp_on_error = B_FALSE; |
@@ -1810,17 +1809,14 @@ xfs_create( | |||
1810 | xfs_prid_t prid; | 1809 | xfs_prid_t prid; |
1811 | struct xfs_dquot *udqp, *gdqp; | 1810 | struct xfs_dquot *udqp, *gdqp; |
1812 | uint resblks; | 1811 | uint resblks; |
1813 | int namelen; | ||
1814 | 1812 | ||
1815 | ASSERT(!*ipp); | 1813 | ASSERT(!*ipp); |
1816 | xfs_itrace_entry(dp); | 1814 | xfs_itrace_entry(dp); |
1817 | 1815 | ||
1818 | namelen = VNAMELEN(dentry); | ||
1819 | |||
1820 | if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) { | 1816 | if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) { |
1821 | error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, | 1817 | error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, |
1822 | dp, DM_RIGHT_NULL, NULL, | 1818 | dp, DM_RIGHT_NULL, NULL, |
1823 | DM_RIGHT_NULL, name, NULL, | 1819 | DM_RIGHT_NULL, name->name, NULL, |
1824 | mode, 0, 0); | 1820 | mode, 0, 0); |
1825 | 1821 | ||
1826 | if (error) | 1822 | if (error) |
@@ -1852,7 +1848,7 @@ xfs_create( | |||
1852 | 1848 | ||
1853 | tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE); | 1849 | tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE); |
1854 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; | 1850 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; |
1855 | resblks = XFS_CREATE_SPACE_RES(mp, namelen); | 1851 | resblks = XFS_CREATE_SPACE_RES(mp, name->len); |
1856 | /* | 1852 | /* |
1857 | * Initially assume that the file does not exist and | 1853 | * Initially assume that the file does not exist and |
1858 | * reserve the resources for that case. If that is not | 1854 | * reserve the resources for that case. If that is not |
@@ -1885,7 +1881,8 @@ xfs_create( | |||
1885 | if (error) | 1881 | if (error) |
1886 | goto error_return; | 1882 | goto error_return; |
1887 | 1883 | ||
1888 | if (resblks == 0 && (error = xfs_dir_canenter(tp, dp, name, namelen))) | 1884 | error = xfs_dir_canenter(tp, dp, name, resblks); |
1885 | if (error) | ||
1889 | goto error_return; | 1886 | goto error_return; |
1890 | error = xfs_dir_ialloc(&tp, dp, mode, 1, | 1887 | error = xfs_dir_ialloc(&tp, dp, mode, 1, |
1891 | rdev, credp, prid, resblks > 0, | 1888 | rdev, credp, prid, resblks > 0, |
@@ -1915,7 +1912,7 @@ xfs_create( | |||
1915 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); | 1912 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); |
1916 | unlock_dp_on_error = B_FALSE; | 1913 | unlock_dp_on_error = B_FALSE; |
1917 | 1914 | ||
1918 | error = xfs_dir_createname(tp, dp, name, namelen, ip->i_ino, | 1915 | error = xfs_dir_createname(tp, dp, name, ip->i_ino, |
1919 | &first_block, &free_list, resblks ? | 1916 | &first_block, &free_list, resblks ? |
1920 | resblks - XFS_IALLOC_SPACE_RES(mp) : 0); | 1917 | resblks - XFS_IALLOC_SPACE_RES(mp) : 0); |
1921 | if (error) { | 1918 | if (error) { |
@@ -1976,7 +1973,7 @@ std_return: | |||
1976 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, | 1973 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, |
1977 | dp, DM_RIGHT_NULL, | 1974 | dp, DM_RIGHT_NULL, |
1978 | *ipp ? ip : NULL, | 1975 | *ipp ? ip : NULL, |
1979 | DM_RIGHT_NULL, name, NULL, | 1976 | DM_RIGHT_NULL, name->name, NULL, |
1980 | mode, error, 0); | 1977 | mode, error, 0); |
1981 | } | 1978 | } |
1982 | return error; | 1979 | return error; |
@@ -2268,12 +2265,10 @@ int remove_which_error_return = 0; | |||
2268 | int | 2265 | int |
2269 | xfs_remove( | 2266 | xfs_remove( |
2270 | xfs_inode_t *dp, | 2267 | xfs_inode_t *dp, |
2271 | bhv_vname_t *dentry) | 2268 | struct xfs_name *name, |
2269 | xfs_inode_t *ip) | ||
2272 | { | 2270 | { |
2273 | char *name = VNAME(dentry); | ||
2274 | xfs_mount_t *mp = dp->i_mount; | 2271 | xfs_mount_t *mp = dp->i_mount; |
2275 | xfs_inode_t *ip = VNAME_TO_INODE(dentry); | ||
2276 | int namelen = VNAMELEN(dentry); | ||
2277 | xfs_trans_t *tp = NULL; | 2272 | xfs_trans_t *tp = NULL; |
2278 | int error = 0; | 2273 | int error = 0; |
2279 | xfs_bmap_free_t free_list; | 2274 | xfs_bmap_free_t free_list; |
@@ -2289,9 +2284,9 @@ xfs_remove( | |||
2289 | return XFS_ERROR(EIO); | 2284 | return XFS_ERROR(EIO); |
2290 | 2285 | ||
2291 | if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) { | 2286 | if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) { |
2292 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dp, | 2287 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dp, DM_RIGHT_NULL, |
2293 | DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, | 2288 | NULL, DM_RIGHT_NULL, name->name, NULL, |
2294 | name, NULL, ip->i_d.di_mode, 0, 0); | 2289 | ip->i_d.di_mode, 0, 0); |
2295 | if (error) | 2290 | if (error) |
2296 | return error; | 2291 | return error; |
2297 | } | 2292 | } |
@@ -2376,7 +2371,7 @@ xfs_remove( | |||
2376 | * Entry must exist since we did a lookup in xfs_lock_dir_and_entry. | 2371 | * Entry must exist since we did a lookup in xfs_lock_dir_and_entry. |
2377 | */ | 2372 | */ |
2378 | XFS_BMAP_INIT(&free_list, &first_block); | 2373 | XFS_BMAP_INIT(&free_list, &first_block); |
2379 | error = xfs_dir_removename(tp, dp, name, namelen, ip->i_ino, | 2374 | error = xfs_dir_removename(tp, dp, name, ip->i_ino, |
2380 | &first_block, &free_list, 0); | 2375 | &first_block, &free_list, 0); |
2381 | if (error) { | 2376 | if (error) { |
2382 | ASSERT(error != ENOENT); | 2377 | ASSERT(error != ENOENT); |
@@ -2444,7 +2439,7 @@ xfs_remove( | |||
2444 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, | 2439 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, |
2445 | dp, DM_RIGHT_NULL, | 2440 | dp, DM_RIGHT_NULL, |
2446 | NULL, DM_RIGHT_NULL, | 2441 | NULL, DM_RIGHT_NULL, |
2447 | name, NULL, ip->i_d.di_mode, error, 0); | 2442 | name->name, NULL, ip->i_d.di_mode, error, 0); |
2448 | } | 2443 | } |
2449 | return error; | 2444 | return error; |
2450 | 2445 | ||
@@ -2474,7 +2469,7 @@ int | |||
2474 | xfs_link( | 2469 | xfs_link( |
2475 | xfs_inode_t *tdp, | 2470 | xfs_inode_t *tdp, |
2476 | xfs_inode_t *sip, | 2471 | xfs_inode_t *sip, |
2477 | bhv_vname_t *dentry) | 2472 | struct xfs_name *target_name) |
2478 | { | 2473 | { |
2479 | xfs_mount_t *mp = tdp->i_mount; | 2474 | xfs_mount_t *mp = tdp->i_mount; |
2480 | xfs_trans_t *tp; | 2475 | xfs_trans_t *tp; |
@@ -2485,13 +2480,10 @@ xfs_link( | |||
2485 | int cancel_flags; | 2480 | int cancel_flags; |
2486 | int committed; | 2481 | int committed; |
2487 | int resblks; | 2482 | int resblks; |
2488 | char *target_name = VNAME(dentry); | ||
2489 | int target_namelen; | ||
2490 | 2483 | ||
2491 | xfs_itrace_entry(tdp); | 2484 | xfs_itrace_entry(tdp); |
2492 | xfs_itrace_entry(sip); | 2485 | xfs_itrace_entry(sip); |
2493 | 2486 | ||
2494 | target_namelen = VNAMELEN(dentry); | ||
2495 | ASSERT(!S_ISDIR(sip->i_d.di_mode)); | 2487 | ASSERT(!S_ISDIR(sip->i_d.di_mode)); |
2496 | 2488 | ||
2497 | if (XFS_FORCED_SHUTDOWN(mp)) | 2489 | if (XFS_FORCED_SHUTDOWN(mp)) |
@@ -2501,7 +2493,7 @@ xfs_link( | |||
2501 | error = XFS_SEND_NAMESP(mp, DM_EVENT_LINK, | 2493 | error = XFS_SEND_NAMESP(mp, DM_EVENT_LINK, |
2502 | tdp, DM_RIGHT_NULL, | 2494 | tdp, DM_RIGHT_NULL, |
2503 | sip, DM_RIGHT_NULL, | 2495 | sip, DM_RIGHT_NULL, |
2504 | target_name, NULL, 0, 0, 0); | 2496 | target_name->name, NULL, 0, 0, 0); |
2505 | if (error) | 2497 | if (error) |
2506 | return error; | 2498 | return error; |
2507 | } | 2499 | } |
@@ -2516,7 +2508,7 @@ xfs_link( | |||
2516 | 2508 | ||
2517 | tp = xfs_trans_alloc(mp, XFS_TRANS_LINK); | 2509 | tp = xfs_trans_alloc(mp, XFS_TRANS_LINK); |
2518 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; | 2510 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; |
2519 | resblks = XFS_LINK_SPACE_RES(mp, target_namelen); | 2511 | resblks = XFS_LINK_SPACE_RES(mp, target_name->len); |
2520 | error = xfs_trans_reserve(tp, resblks, XFS_LINK_LOG_RES(mp), 0, | 2512 | error = xfs_trans_reserve(tp, resblks, XFS_LINK_LOG_RES(mp), 0, |
2521 | XFS_TRANS_PERM_LOG_RES, XFS_LINK_LOG_COUNT); | 2513 | XFS_TRANS_PERM_LOG_RES, XFS_LINK_LOG_COUNT); |
2522 | if (error == ENOSPC) { | 2514 | if (error == ENOSPC) { |
@@ -2568,15 +2560,14 @@ xfs_link( | |||
2568 | goto error_return; | 2560 | goto error_return; |
2569 | } | 2561 | } |
2570 | 2562 | ||
2571 | if (resblks == 0 && | 2563 | error = xfs_dir_canenter(tp, tdp, target_name, resblks); |
2572 | (error = xfs_dir_canenter(tp, tdp, target_name, target_namelen))) | 2564 | if (error) |
2573 | goto error_return; | 2565 | goto error_return; |
2574 | 2566 | ||
2575 | XFS_BMAP_INIT(&free_list, &first_block); | 2567 | XFS_BMAP_INIT(&free_list, &first_block); |
2576 | 2568 | ||
2577 | error = xfs_dir_createname(tp, tdp, target_name, target_namelen, | 2569 | error = xfs_dir_createname(tp, tdp, target_name, sip->i_ino, |
2578 | sip->i_ino, &first_block, &free_list, | 2570 | &first_block, &free_list, resblks); |
2579 | resblks); | ||
2580 | if (error) | 2571 | if (error) |
2581 | goto abort_return; | 2572 | goto abort_return; |
2582 | xfs_ichgtime(tdp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 2573 | xfs_ichgtime(tdp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
@@ -2612,7 +2603,7 @@ std_return: | |||
2612 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTLINK, | 2603 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTLINK, |
2613 | tdp, DM_RIGHT_NULL, | 2604 | tdp, DM_RIGHT_NULL, |
2614 | sip, DM_RIGHT_NULL, | 2605 | sip, DM_RIGHT_NULL, |
2615 | target_name, NULL, 0, error, 0); | 2606 | target_name->name, NULL, 0, error, 0); |
2616 | } | 2607 | } |
2617 | return error; | 2608 | return error; |
2618 | 2609 | ||
@@ -2629,13 +2620,11 @@ std_return: | |||
2629 | int | 2620 | int |
2630 | xfs_mkdir( | 2621 | xfs_mkdir( |
2631 | xfs_inode_t *dp, | 2622 | xfs_inode_t *dp, |
2632 | bhv_vname_t *dentry, | 2623 | struct xfs_name *dir_name, |
2633 | mode_t mode, | 2624 | mode_t mode, |
2634 | xfs_inode_t **ipp, | 2625 | xfs_inode_t **ipp, |
2635 | cred_t *credp) | 2626 | cred_t *credp) |
2636 | { | 2627 | { |
2637 | char *dir_name = VNAME(dentry); | ||
2638 | int dir_namelen = VNAMELEN(dentry); | ||
2639 | xfs_mount_t *mp = dp->i_mount; | 2628 | xfs_mount_t *mp = dp->i_mount; |
2640 | xfs_inode_t *cdp; /* inode of created dir */ | 2629 | xfs_inode_t *cdp; /* inode of created dir */ |
2641 | xfs_trans_t *tp; | 2630 | xfs_trans_t *tp; |
@@ -2659,7 +2648,7 @@ xfs_mkdir( | |||
2659 | if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) { | 2648 | if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) { |
2660 | error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, | 2649 | error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, |
2661 | dp, DM_RIGHT_NULL, NULL, | 2650 | dp, DM_RIGHT_NULL, NULL, |
2662 | DM_RIGHT_NULL, dir_name, NULL, | 2651 | DM_RIGHT_NULL, dir_name->name, NULL, |
2663 | mode, 0, 0); | 2652 | mode, 0, 0); |
2664 | if (error) | 2653 | if (error) |
2665 | return error; | 2654 | return error; |
@@ -2688,7 +2677,7 @@ xfs_mkdir( | |||
2688 | 2677 | ||
2689 | tp = xfs_trans_alloc(mp, XFS_TRANS_MKDIR); | 2678 | tp = xfs_trans_alloc(mp, XFS_TRANS_MKDIR); |
2690 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; | 2679 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES; |
2691 | resblks = XFS_MKDIR_SPACE_RES(mp, dir_namelen); | 2680 | resblks = XFS_MKDIR_SPACE_RES(mp, dir_name->len); |
2692 | error = xfs_trans_reserve(tp, resblks, XFS_MKDIR_LOG_RES(mp), 0, | 2681 | error = xfs_trans_reserve(tp, resblks, XFS_MKDIR_LOG_RES(mp), 0, |
2693 | XFS_TRANS_PERM_LOG_RES, XFS_MKDIR_LOG_COUNT); | 2682 | XFS_TRANS_PERM_LOG_RES, XFS_MKDIR_LOG_COUNT); |
2694 | if (error == ENOSPC) { | 2683 | if (error == ENOSPC) { |
@@ -2720,8 +2709,8 @@ xfs_mkdir( | |||
2720 | if (error) | 2709 | if (error) |
2721 | goto error_return; | 2710 | goto error_return; |
2722 | 2711 | ||
2723 | if (resblks == 0 && | 2712 | error = xfs_dir_canenter(tp, dp, dir_name, resblks); |
2724 | (error = xfs_dir_canenter(tp, dp, dir_name, dir_namelen))) | 2713 | if (error) |
2725 | goto error_return; | 2714 | goto error_return; |
2726 | /* | 2715 | /* |
2727 | * create the directory inode. | 2716 | * create the directory inode. |
@@ -2750,9 +2739,9 @@ xfs_mkdir( | |||
2750 | 2739 | ||
2751 | XFS_BMAP_INIT(&free_list, &first_block); | 2740 | XFS_BMAP_INIT(&free_list, &first_block); |
2752 | 2741 | ||
2753 | error = xfs_dir_createname(tp, dp, dir_name, dir_namelen, cdp->i_ino, | 2742 | error = xfs_dir_createname(tp, dp, dir_name, cdp->i_ino, |
2754 | &first_block, &free_list, resblks ? | 2743 | &first_block, &free_list, resblks ? |
2755 | resblks - XFS_IALLOC_SPACE_RES(mp) : 0); | 2744 | resblks - XFS_IALLOC_SPACE_RES(mp) : 0); |
2756 | if (error) { | 2745 | if (error) { |
2757 | ASSERT(error != ENOSPC); | 2746 | ASSERT(error != ENOSPC); |
2758 | goto error1; | 2747 | goto error1; |
@@ -2817,7 +2806,7 @@ std_return: | |||
2817 | dp, DM_RIGHT_NULL, | 2806 | dp, DM_RIGHT_NULL, |
2818 | created ? cdp : NULL, | 2807 | created ? cdp : NULL, |
2819 | DM_RIGHT_NULL, | 2808 | DM_RIGHT_NULL, |
2820 | dir_name, NULL, | 2809 | dir_name->name, NULL, |
2821 | mode, error, 0); | 2810 | mode, error, 0); |
2822 | } | 2811 | } |
2823 | return error; | 2812 | return error; |
@@ -2841,13 +2830,11 @@ std_return: | |||
2841 | int | 2830 | int |
2842 | xfs_rmdir( | 2831 | xfs_rmdir( |
2843 | xfs_inode_t *dp, | 2832 | xfs_inode_t *dp, |
2844 | bhv_vname_t *dentry) | 2833 | struct xfs_name *name, |
2834 | xfs_inode_t *cdp) | ||
2845 | { | 2835 | { |
2846 | bhv_vnode_t *dir_vp = XFS_ITOV(dp); | 2836 | bhv_vnode_t *dir_vp = XFS_ITOV(dp); |
2847 | char *name = VNAME(dentry); | ||
2848 | int namelen = VNAMELEN(dentry); | ||
2849 | xfs_mount_t *mp = dp->i_mount; | 2837 | xfs_mount_t *mp = dp->i_mount; |
2850 | xfs_inode_t *cdp = VNAME_TO_INODE(dentry); | ||
2851 | xfs_trans_t *tp; | 2838 | xfs_trans_t *tp; |
2852 | int error; | 2839 | int error; |
2853 | xfs_bmap_free_t free_list; | 2840 | xfs_bmap_free_t free_list; |
@@ -2865,8 +2852,8 @@ xfs_rmdir( | |||
2865 | if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) { | 2852 | if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) { |
2866 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, | 2853 | error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, |
2867 | dp, DM_RIGHT_NULL, | 2854 | dp, DM_RIGHT_NULL, |
2868 | NULL, DM_RIGHT_NULL, | 2855 | NULL, DM_RIGHT_NULL, name->name, |
2869 | name, NULL, cdp->i_d.di_mode, 0, 0); | 2856 | NULL, cdp->i_d.di_mode, 0, 0); |
2870 | if (error) | 2857 | if (error) |
2871 | return XFS_ERROR(error); | 2858 | return XFS_ERROR(error); |
2872 | } | 2859 | } |
@@ -2960,7 +2947,7 @@ xfs_rmdir( | |||
2960 | goto error_return; | 2947 | goto error_return; |
2961 | } | 2948 | } |
2962 | 2949 | ||
2963 | error = xfs_dir_removename(tp, dp, name, namelen, cdp->i_ino, | 2950 | error = xfs_dir_removename(tp, dp, name, cdp->i_ino, |
2964 | &first_block, &free_list, resblks); | 2951 | &first_block, &free_list, resblks); |
2965 | if (error) | 2952 | if (error) |
2966 | goto error1; | 2953 | goto error1; |
@@ -3040,7 +3027,7 @@ xfs_rmdir( | |||
3040 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, | 3027 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, |
3041 | dp, DM_RIGHT_NULL, | 3028 | dp, DM_RIGHT_NULL, |
3042 | NULL, DM_RIGHT_NULL, | 3029 | NULL, DM_RIGHT_NULL, |
3043 | name, NULL, cdp->i_d.di_mode, | 3030 | name->name, NULL, cdp->i_d.di_mode, |
3044 | error, 0); | 3031 | error, 0); |
3045 | } | 3032 | } |
3046 | return error; | 3033 | return error; |
@@ -3058,8 +3045,8 @@ xfs_rmdir( | |||
3058 | int | 3045 | int |
3059 | xfs_symlink( | 3046 | xfs_symlink( |
3060 | xfs_inode_t *dp, | 3047 | xfs_inode_t *dp, |
3061 | bhv_vname_t *dentry, | 3048 | struct xfs_name *link_name, |
3062 | char *target_path, | 3049 | const char *target_path, |
3063 | mode_t mode, | 3050 | mode_t mode, |
3064 | xfs_inode_t **ipp, | 3051 | xfs_inode_t **ipp, |
3065 | cred_t *credp) | 3052 | cred_t *credp) |
@@ -3079,15 +3066,13 @@ xfs_symlink( | |||
3079 | int nmaps; | 3066 | int nmaps; |
3080 | xfs_bmbt_irec_t mval[SYMLINK_MAPS]; | 3067 | xfs_bmbt_irec_t mval[SYMLINK_MAPS]; |
3081 | xfs_daddr_t d; | 3068 | xfs_daddr_t d; |
3082 | char *cur_chunk; | 3069 | const char *cur_chunk; |
3083 | int byte_cnt; | 3070 | int byte_cnt; |
3084 | int n; | 3071 | int n; |
3085 | xfs_buf_t *bp; | 3072 | xfs_buf_t *bp; |
3086 | xfs_prid_t prid; | 3073 | xfs_prid_t prid; |
3087 | struct xfs_dquot *udqp, *gdqp; | 3074 | struct xfs_dquot *udqp, *gdqp; |
3088 | uint resblks; | 3075 | uint resblks; |
3089 | char *link_name = VNAME(dentry); | ||
3090 | int link_namelen; | ||
3091 | 3076 | ||
3092 | *ipp = NULL; | 3077 | *ipp = NULL; |
3093 | error = 0; | 3078 | error = 0; |
@@ -3099,8 +3084,6 @@ xfs_symlink( | |||
3099 | if (XFS_FORCED_SHUTDOWN(mp)) | 3084 | if (XFS_FORCED_SHUTDOWN(mp)) |
3100 | return XFS_ERROR(EIO); | 3085 | return XFS_ERROR(EIO); |
3101 | 3086 | ||
3102 | link_namelen = VNAMELEN(dentry); | ||
3103 | |||
3104 | /* | 3087 | /* |
3105 | * Check component lengths of the target path name. | 3088 | * Check component lengths of the target path name. |
3106 | */ | 3089 | */ |
@@ -3111,7 +3094,7 @@ xfs_symlink( | |||
3111 | if (DM_EVENT_ENABLED(dp, DM_EVENT_SYMLINK)) { | 3094 | if (DM_EVENT_ENABLED(dp, DM_EVENT_SYMLINK)) { |
3112 | error = XFS_SEND_NAMESP(mp, DM_EVENT_SYMLINK, dp, | 3095 | error = XFS_SEND_NAMESP(mp, DM_EVENT_SYMLINK, dp, |
3113 | DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, | 3096 | DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, |
3114 | link_name, target_path, 0, 0, 0); | 3097 | link_name->name, target_path, 0, 0, 0); |
3115 | if (error) | 3098 | if (error) |
3116 | return error; | 3099 | return error; |
3117 | } | 3100 | } |
@@ -3143,7 +3126,7 @@ xfs_symlink( | |||
3143 | fs_blocks = 0; | 3126 | fs_blocks = 0; |
3144 | else | 3127 | else |
3145 | fs_blocks = XFS_B_TO_FSB(mp, pathlen); | 3128 | fs_blocks = XFS_B_TO_FSB(mp, pathlen); |
3146 | resblks = XFS_SYMLINK_SPACE_RES(mp, link_namelen, fs_blocks); | 3129 | resblks = XFS_SYMLINK_SPACE_RES(mp, link_name->len, fs_blocks); |
3147 | error = xfs_trans_reserve(tp, resblks, XFS_SYMLINK_LOG_RES(mp), 0, | 3130 | error = xfs_trans_reserve(tp, resblks, XFS_SYMLINK_LOG_RES(mp), 0, |
3148 | XFS_TRANS_PERM_LOG_RES, XFS_SYMLINK_LOG_COUNT); | 3131 | XFS_TRANS_PERM_LOG_RES, XFS_SYMLINK_LOG_COUNT); |
3149 | if (error == ENOSPC && fs_blocks == 0) { | 3132 | if (error == ENOSPC && fs_blocks == 0) { |
@@ -3177,8 +3160,8 @@ xfs_symlink( | |||
3177 | /* | 3160 | /* |
3178 | * Check for ability to enter directory entry, if no space reserved. | 3161 | * Check for ability to enter directory entry, if no space reserved. |
3179 | */ | 3162 | */ |
3180 | if (resblks == 0 && | 3163 | error = xfs_dir_canenter(tp, dp, link_name, resblks); |
3181 | (error = xfs_dir_canenter(tp, dp, link_name, link_namelen))) | 3164 | if (error) |
3182 | goto error_return; | 3165 | goto error_return; |
3183 | /* | 3166 | /* |
3184 | * Initialize the bmap freelist prior to calling either | 3167 | * Initialize the bmap freelist prior to calling either |
@@ -3270,8 +3253,8 @@ xfs_symlink( | |||
3270 | /* | 3253 | /* |
3271 | * Create the directory entry for the symlink. | 3254 | * Create the directory entry for the symlink. |
3272 | */ | 3255 | */ |
3273 | error = xfs_dir_createname(tp, dp, link_name, link_namelen, ip->i_ino, | 3256 | error = xfs_dir_createname(tp, dp, link_name, ip->i_ino, |
3274 | &first_block, &free_list, resblks); | 3257 | &first_block, &free_list, resblks); |
3275 | if (error) | 3258 | if (error) |
3276 | goto error1; | 3259 | goto error1; |
3277 | xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 3260 | xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
@@ -3315,8 +3298,8 @@ std_return: | |||
3315 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTSYMLINK, | 3298 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTSYMLINK, |
3316 | dp, DM_RIGHT_NULL, | 3299 | dp, DM_RIGHT_NULL, |
3317 | error ? NULL : ip, | 3300 | error ? NULL : ip, |
3318 | DM_RIGHT_NULL, link_name, target_path, | 3301 | DM_RIGHT_NULL, link_name->name, |
3319 | 0, error, 0); | 3302 | target_path, 0, error, 0); |
3320 | } | 3303 | } |
3321 | 3304 | ||
3322 | if (!error) | 3305 | if (!error) |