aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_vnodeops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r--fs/xfs/xfs_vnodeops.c52
1 files changed, 22 insertions, 30 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 603459229904..0116ce1ad59e 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -337,7 +337,7 @@ xfs_setattr(
337 } 337 }
338 } 338 }
339 } else { 339 } else {
340 if (DM_EVENT_ENABLED (vp->v_vfsp, ip, DM_EVENT_TRUNCATE) && 340 if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) &&
341 !(flags & ATTR_DMI)) { 341 !(flags & ATTR_DMI)) {
342 int dmflags = AT_DELAY_FLAG(flags) | DM_SEM_FLAG_WR; 342 int dmflags = AT_DELAY_FLAG(flags) | DM_SEM_FLAG_WR;
343 code = XFS_SEND_DATA(mp, DM_EVENT_TRUNCATE, vp, 343 code = XFS_SEND_DATA(mp, DM_EVENT_TRUNCATE, vp,
@@ -896,7 +896,7 @@ xfs_setattr(
896 return code; 896 return code;
897 } 897 }
898 898
899 if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_ATTRIBUTE) && 899 if (DM_EVENT_ENABLED(ip, DM_EVENT_ATTRIBUTE) &&
900 !(flags & ATTR_DMI)) { 900 !(flags & ATTR_DMI)) {
901 (void) XFS_SEND_NAMESP(mp, DM_EVENT_ATTRIBUTE, vp, DM_RIGHT_NULL, 901 (void) XFS_SEND_NAMESP(mp, DM_EVENT_ATTRIBUTE, vp, DM_RIGHT_NULL,
902 NULL, DM_RIGHT_NULL, NULL, NULL, 902 NULL, DM_RIGHT_NULL, NULL, NULL,
@@ -1666,8 +1666,7 @@ xfs_inactive(
1666 1666
1667 mp = ip->i_mount; 1667 mp = ip->i_mount;
1668 1668
1669 if (ip->i_d.di_nlink == 0 && 1669 if (ip->i_d.di_nlink == 0 && DM_EVENT_ENABLED(ip, DM_EVENT_DESTROY)) {
1670 DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_DESTROY)) {
1671 (void) XFS_SEND_DESTROY(mp, vp, DM_RIGHT_NULL); 1670 (void) XFS_SEND_DESTROY(mp, vp, DM_RIGHT_NULL);
1672 } 1671 }
1673 1672
@@ -1922,7 +1921,7 @@ xfs_create(
1922 dm_di_mode = vap->va_mode; 1921 dm_di_mode = vap->va_mode;
1923 namelen = VNAMELEN(dentry); 1922 namelen = VNAMELEN(dentry);
1924 1923
1925 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_CREATE)) { 1924 if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
1926 error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, 1925 error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE,
1927 dir_vp, DM_RIGHT_NULL, NULL, 1926 dir_vp, DM_RIGHT_NULL, NULL,
1928 DM_RIGHT_NULL, name, NULL, 1927 DM_RIGHT_NULL, name, NULL,
@@ -2087,9 +2086,8 @@ xfs_create(
2087 /* Fallthrough to std_return with error = 0 */ 2086 /* Fallthrough to std_return with error = 0 */
2088 2087
2089std_return: 2088std_return:
2090 if ( (*vpp || (error != 0 && dm_event_sent != 0)) && 2089 if ((*vpp || (error != 0 && dm_event_sent != 0)) &&
2091 DM_EVENT_ENABLED(dir_vp->v_vfsp, XFS_BHVTOI(dir_bdp), 2090 DM_EVENT_ENABLED(XFS_BHVTOI(dir_bdp), DM_EVENT_POSTCREATE)) {
2092 DM_EVENT_POSTCREATE)) {
2093 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, 2091 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE,
2094 dir_vp, DM_RIGHT_NULL, 2092 dir_vp, DM_RIGHT_NULL,
2095 *vpp ? vp:NULL, 2093 *vpp ? vp:NULL,
@@ -2423,7 +2421,7 @@ xfs_remove(
2423 IRELE(ip); 2421 IRELE(ip);
2424 } 2422 }
2425 2423
2426 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) { 2424 if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) {
2427 error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dir_vp, 2425 error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dir_vp,
2428 DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, 2426 DM_RIGHT_NULL, NULL, DM_RIGHT_NULL,
2429 name, NULL, dm_di_mode, 0, 0); 2427 name, NULL, dm_di_mode, 0, 0);
@@ -2599,8 +2597,7 @@ xfs_remove(
2599 2597
2600/* Fall through to std_return with error = 0 */ 2598/* Fall through to std_return with error = 0 */
2601 std_return: 2599 std_return:
2602 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, 2600 if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTREMOVE)) {
2603 DM_EVENT_POSTREMOVE)) {
2604 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, 2601 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE,
2605 dir_vp, DM_RIGHT_NULL, 2602 dir_vp, DM_RIGHT_NULL,
2606 NULL, DM_RIGHT_NULL, 2603 NULL, DM_RIGHT_NULL,
@@ -2677,7 +2674,7 @@ xfs_link(
2677 if (XFS_FORCED_SHUTDOWN(mp)) 2674 if (XFS_FORCED_SHUTDOWN(mp))
2678 return XFS_ERROR(EIO); 2675 return XFS_ERROR(EIO);
2679 2676
2680 if (DM_EVENT_ENABLED(src_vp->v_vfsp, tdp, DM_EVENT_LINK)) { 2677 if (DM_EVENT_ENABLED(tdp, DM_EVENT_LINK)) {
2681 error = XFS_SEND_NAMESP(mp, DM_EVENT_LINK, 2678 error = XFS_SEND_NAMESP(mp, DM_EVENT_LINK,
2682 target_dir_vp, DM_RIGHT_NULL, 2679 target_dir_vp, DM_RIGHT_NULL,
2683 src_vp, DM_RIGHT_NULL, 2680 src_vp, DM_RIGHT_NULL,
@@ -2788,8 +2785,7 @@ xfs_link(
2788 2785
2789 /* Fall through to std_return with error = 0. */ 2786 /* Fall through to std_return with error = 0. */
2790std_return: 2787std_return:
2791 if (DM_EVENT_ENABLED(src_vp->v_vfsp, sip, 2788 if (DM_EVENT_ENABLED(sip, DM_EVENT_POSTLINK)) {
2792 DM_EVENT_POSTLINK)) {
2793 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTLINK, 2789 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTLINK,
2794 target_dir_vp, DM_RIGHT_NULL, 2790 target_dir_vp, DM_RIGHT_NULL,
2795 src_vp, DM_RIGHT_NULL, 2791 src_vp, DM_RIGHT_NULL,
@@ -2853,7 +2849,7 @@ xfs_mkdir(
2853 dp_joined_to_trans = B_FALSE; 2849 dp_joined_to_trans = B_FALSE;
2854 dm_di_mode = vap->va_mode; 2850 dm_di_mode = vap->va_mode;
2855 2851
2856 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_CREATE)) { 2852 if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
2857 error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE, 2853 error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE,
2858 dir_vp, DM_RIGHT_NULL, NULL, 2854 dir_vp, DM_RIGHT_NULL, NULL,
2859 DM_RIGHT_NULL, dir_name, NULL, 2855 DM_RIGHT_NULL, dir_name, NULL,
@@ -3010,9 +3006,8 @@ xfs_mkdir(
3010 * xfs_trans_commit. */ 3006 * xfs_trans_commit. */
3011 3007
3012std_return: 3008std_return:
3013 if ( (created || (error != 0 && dm_event_sent != 0)) && 3009 if ((created || (error != 0 && dm_event_sent != 0)) &&
3014 DM_EVENT_ENABLED(dir_vp->v_vfsp, XFS_BHVTOI(dir_bdp), 3010 DM_EVENT_ENABLED(XFS_BHVTOI(dir_bdp), DM_EVENT_POSTCREATE)) {
3015 DM_EVENT_POSTCREATE)) {
3016 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, 3011 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE,
3017 dir_vp, DM_RIGHT_NULL, 3012 dir_vp, DM_RIGHT_NULL,
3018 created ? XFS_ITOV(cdp):NULL, 3013 created ? XFS_ITOV(cdp):NULL,
@@ -3081,7 +3076,7 @@ xfs_rmdir(
3081 IRELE(cdp); 3076 IRELE(cdp);
3082 } 3077 }
3083 3078
3084 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) { 3079 if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) {
3085 error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, 3080 error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE,
3086 dir_vp, DM_RIGHT_NULL, 3081 dir_vp, DM_RIGHT_NULL,
3087 NULL, DM_RIGHT_NULL, 3082 NULL, DM_RIGHT_NULL,
@@ -3270,7 +3265,7 @@ xfs_rmdir(
3270 /* Fall through to std_return with error = 0 or the errno 3265 /* Fall through to std_return with error = 0 or the errno
3271 * from xfs_trans_commit. */ 3266 * from xfs_trans_commit. */
3272 std_return: 3267 std_return:
3273 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_POSTREMOVE)) { 3268 if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTREMOVE)) {
3274 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, 3269 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE,
3275 dir_vp, DM_RIGHT_NULL, 3270 dir_vp, DM_RIGHT_NULL,
3276 NULL, DM_RIGHT_NULL, 3271 NULL, DM_RIGHT_NULL,
@@ -3405,7 +3400,7 @@ xfs_symlink(
3405 } 3400 }
3406 } 3401 }
3407 3402
3408 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_SYMLINK)) { 3403 if (DM_EVENT_ENABLED(dp, DM_EVENT_SYMLINK)) {
3409 error = XFS_SEND_NAMESP(mp, DM_EVENT_SYMLINK, dir_vp, 3404 error = XFS_SEND_NAMESP(mp, DM_EVENT_SYMLINK, dir_vp,
3410 DM_RIGHT_NULL, NULL, DM_RIGHT_NULL, 3405 DM_RIGHT_NULL, NULL, DM_RIGHT_NULL,
3411 link_name, target_path, 0, 0, 0); 3406 link_name, target_path, 0, 0, 0);
@@ -3605,8 +3600,7 @@ xfs_symlink(
3605 /* Fall through to std_return with error = 0 or errno from 3600 /* Fall through to std_return with error = 0 or errno from
3606 * xfs_trans_commit */ 3601 * xfs_trans_commit */
3607std_return: 3602std_return:
3608 if (DM_EVENT_ENABLED(dir_vp->v_vfsp, XFS_BHVTOI(dir_bdp), 3603 if (DM_EVENT_ENABLED(XFS_BHVTOI(dir_bdp), DM_EVENT_POSTSYMLINK)) {
3609 DM_EVENT_POSTSYMLINK)) {
3610 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTSYMLINK, 3604 (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTSYMLINK,
3611 dir_vp, DM_RIGHT_NULL, 3605 dir_vp, DM_RIGHT_NULL,
3612 error ? NULL : XFS_ITOV(ip), 3606 error ? NULL : XFS_ITOV(ip),
@@ -4109,7 +4103,7 @@ xfs_alloc_file_space(
4109 /* Generate a DMAPI event if needed. */ 4103 /* Generate a DMAPI event if needed. */
4110 if (alloc_type != 0 && offset < ip->i_size && 4104 if (alloc_type != 0 && offset < ip->i_size &&
4111 (attr_flags&ATTR_DMI) == 0 && 4105 (attr_flags&ATTR_DMI) == 0 &&
4112 DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) { 4106 DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) {
4113 xfs_off_t end_dmi_offset; 4107 xfs_off_t end_dmi_offset;
4114 4108
4115 end_dmi_offset = offset+len; 4109 end_dmi_offset = offset+len;
@@ -4223,9 +4217,8 @@ retry:
4223 allocatesize_fsb -= allocated_fsb; 4217 allocatesize_fsb -= allocated_fsb;
4224 } 4218 }
4225dmapi_enospc_check: 4219dmapi_enospc_check:
4226 if (error == ENOSPC && (attr_flags&ATTR_DMI) == 0 && 4220 if (error == ENOSPC && (attr_flags & ATTR_DMI) == 0 &&
4227 DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_NOSPACE)) { 4221 DM_EVENT_ENABLED(ip, DM_EVENT_NOSPACE)) {
4228
4229 error = XFS_SEND_NAMESP(mp, DM_EVENT_NOSPACE, 4222 error = XFS_SEND_NAMESP(mp, DM_EVENT_NOSPACE,
4230 XFS_ITOV(ip), DM_RIGHT_NULL, 4223 XFS_ITOV(ip), DM_RIGHT_NULL,
4231 XFS_ITOV(ip), DM_RIGHT_NULL, 4224 XFS_ITOV(ip), DM_RIGHT_NULL,
@@ -4369,9 +4362,8 @@ xfs_free_file_space(
4369 end_dmi_offset = offset + len; 4362 end_dmi_offset = offset + len;
4370 endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset); 4363 endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset);
4371 4364
4372 if (offset < ip->i_size && 4365 if (offset < ip->i_size && (attr_flags & ATTR_DMI) == 0 &&
4373 (attr_flags & ATTR_DMI) == 0 && 4366 DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) {
4374 DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) {
4375 if (end_dmi_offset > ip->i_size) 4367 if (end_dmi_offset > ip->i_size)
4376 end_dmi_offset = ip->i_size; 4368 end_dmi_offset = ip->i_size;
4377 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp, 4369 error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp,