xfs: drop dmapi hooks
[deliverable/linux.git] / fs / xfs / xfs_vnodeops.c
index c1646838898f45120767046f0b62d43cca92dd54..f6fd7502fc0e87ade94294bddc486789505548b0 100644 (file)
@@ -26,7 +26,6 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_dir2.h"
-#include "xfs_dmapi.h"
 #include "xfs_mount.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
@@ -143,16 +142,6 @@ xfs_setattr(
                        goto error_return;
                }
        } else {
-               if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) &&
-                   !(flags & XFS_ATTR_DMI)) {
-                       int dmflags = AT_DELAY_FLAG(flags) | DM_SEM_FLAG_WR;
-                       code = XFS_SEND_DATA(mp, DM_EVENT_TRUNCATE, ip,
-                               iattr->ia_size, 0, dmflags, NULL);
-                       if (code) {
-                               lock_flags = 0;
-                               goto error_return;
-                       }
-               }
                if (need_iolock)
                        lock_flags |= XFS_IOLOCK_EXCL;
        }
@@ -470,17 +459,10 @@ xfs_setattr(
                        return XFS_ERROR(code);
        }
 
-       if (DM_EVENT_ENABLED(ip, DM_EVENT_ATTRIBUTE) &&
-           !(flags & XFS_ATTR_DMI)) {
-               (void) XFS_SEND_NAMESP(mp, DM_EVENT_ATTRIBUTE, ip, DM_RIGHT_NULL,
-                                       NULL, DM_RIGHT_NULL, NULL, NULL,
-                                       0, 0, AT_DELAY_FLAG(flags));
-       }
        return 0;
 
  abort_return:
        commit_flags |= XFS_TRANS_ABORT;
-       /* FALLTHROUGH */
  error_return:
        xfs_qm_dqrele(udqp);
        xfs_qm_dqrele(gdqp);
@@ -1060,9 +1042,6 @@ xfs_inactive(
 
        mp = ip->i_mount;
 
-       if (ip->i_d.di_nlink == 0 && DM_EVENT_ENABLED(ip, DM_EVENT_DESTROY))
-               XFS_SEND_DESTROY(mp, ip, DM_RIGHT_NULL);
-
        error = 0;
 
        /* If this is a read-only mount, don't do this (would generate I/O) */
@@ -1314,16 +1293,6 @@ xfs_create(
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
 
-       if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
-               error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE,
-                               dp, DM_RIGHT_NULL, NULL,
-                               DM_RIGHT_NULL, name->name, NULL,
-                               mode, 0, 0);
-
-               if (error)
-                       return error;
-       }
-
        if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
                prid = dp->i_d.di_projid;
        else
@@ -1487,16 +1456,7 @@ xfs_create(
        xfs_qm_dqrele(gdqp);
 
        *ipp = ip;
-
-       /* Fallthrough to std_return with error = 0  */
- std_return:
-       if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTCREATE)) {
-               XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, dp, DM_RIGHT_NULL,
-                               ip, DM_RIGHT_NULL, name->name, NULL, mode,
-                               error, 0);
-       }
-
-       return error;
+       return 0;
 
  out_bmap_cancel:
        xfs_bmap_cancel(&free_list);
@@ -1510,8 +1470,8 @@ xfs_create(
 
        if (unlock_dp_on_error)
                xfs_iunlock(dp, XFS_ILOCK_EXCL);
-
-       goto std_return;
+ std_return:
+       return error;
 
  out_abort_rele:
        /*
@@ -1732,14 +1692,6 @@ xfs_remove(
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
 
-       if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) {
-               error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dp, DM_RIGHT_NULL,
-                                       NULL, DM_RIGHT_NULL, name->name, NULL,
-                                       ip->i_d.di_mode, 0, 0);
-               if (error)
-                       return error;
-       }
-
        error = xfs_qm_dqattach(dp, 0);
        if (error)
                goto std_return;
@@ -1877,21 +1829,15 @@ xfs_remove(
        if (!is_dir && link_zero && xfs_inode_is_filestream(ip))
                xfs_filestream_deassociate(ip);
 
- std_return:
-       if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTREMOVE)) {
-               XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE, dp, DM_RIGHT_NULL,
-                               NULL, DM_RIGHT_NULL, name->name, NULL,
-                               ip->i_d.di_mode, error, 0);
-       }
-
-       return error;
+       return 0;
 
  out_bmap_cancel:
        xfs_bmap_cancel(&free_list);
        cancel_flags |= XFS_TRANS_ABORT;
  out_trans_cancel:
        xfs_trans_cancel(tp, cancel_flags);
-       goto std_return;
+ std_return:
+       return error;
 }
 
 int
@@ -1917,17 +1863,6 @@ xfs_link(
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
 
-       if (DM_EVENT_ENABLED(tdp, DM_EVENT_LINK)) {
-               error = XFS_SEND_NAMESP(mp, DM_EVENT_LINK,
-                                       tdp, DM_RIGHT_NULL,
-                                       sip, DM_RIGHT_NULL,
-                                       target_name->name, NULL, 0, 0, 0);
-               if (error)
-                       return error;
-       }
-
-       /* Return through std_return after this point. */
-
        error = xfs_qm_dqattach(sip, 0);
        if (error)
                goto std_return;
@@ -2014,27 +1949,14 @@ xfs_link(
                goto abort_return;
        }
 
-       error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
-       if (error)
-               goto std_return;
-
-       /* Fall through to std_return with error = 0. */
-std_return:
-       if (DM_EVENT_ENABLED(sip, DM_EVENT_POSTLINK)) {
-               (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTLINK,
-                               tdp, DM_RIGHT_NULL,
-                               sip, DM_RIGHT_NULL,
-                               target_name->name, NULL, 0, error, 0);
-       }
-       return error;
+       return xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
 
  abort_return:
        cancel_flags |= XFS_TRANS_ABORT;
-       /* FALLTHROUGH */
-
  error_return:
        xfs_trans_cancel(tp, cancel_flags);
-       goto std_return;
+ std_return:
+       return error;
 }
 
 int
@@ -2086,17 +2008,6 @@ xfs_symlink(
        if (pathlen >= MAXPATHLEN)      /* total string too long */
                return XFS_ERROR(ENAMETOOLONG);
 
-       if (DM_EVENT_ENABLED(dp, DM_EVENT_SYMLINK)) {
-               error = XFS_SEND_NAMESP(mp, DM_EVENT_SYMLINK, dp,
-                                       DM_RIGHT_NULL, NULL, DM_RIGHT_NULL,
-                                       link_name->name,
-                                       (unsigned char *)target_path, 0, 0, 0);
-               if (error)
-                       return error;
-       }
-
-       /* Return through std_return after this point. */
-
        udqp = gdqp = NULL;
        if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
                prid = dp->i_d.di_projid;
@@ -2278,21 +2189,8 @@ xfs_symlink(
        xfs_qm_dqrele(udqp);
        xfs_qm_dqrele(gdqp);
 
-       /* Fall through to std_return with error = 0 or errno from
-        * xfs_trans_commit     */
-std_return:
-       if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTSYMLINK)) {
-               (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTSYMLINK,
-                                       dp, DM_RIGHT_NULL,
-                                       error ? NULL : ip,
-                                       DM_RIGHT_NULL, link_name->name,
-                                       (unsigned char *)target_path,
-                                       0, error, 0);
-       }
-
-       if (!error)
-               *ipp = ip;
-       return error;
+       *ipp = ip;
+       return 0;
 
  error2:
        IRELE(ip);
@@ -2306,8 +2204,8 @@ std_return:
 
        if (unlock_dp_on_error)
                xfs_iunlock(dp, XFS_ILOCK_EXCL);
-
-       goto std_return;
+ std_return:
+       return error;
 }
 
 int
@@ -2412,25 +2310,9 @@ xfs_alloc_file_space(
        startoffset_fsb = XFS_B_TO_FSBT(mp, offset);
        allocatesize_fsb = XFS_B_TO_FSB(mp, count);
 
-       /*      Generate a DMAPI event if needed.       */
-       if (alloc_type != 0 && offset < ip->i_size &&
-                       (attr_flags & XFS_ATTR_DMI) == 0  &&
-                       DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) {
-               xfs_off_t           end_dmi_offset;
-
-               end_dmi_offset = offset+len;
-               if (end_dmi_offset > ip->i_size)
-                       end_dmi_offset = ip->i_size;
-               error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, ip, offset,
-                                     end_dmi_offset - offset, 0, NULL);
-               if (error)
-                       return error;
-       }
-
        /*
         * Allocate file space until done or until there is an error
         */
-retry:
        while (allocatesize_fsb && !error) {
                xfs_fileoff_t   s, e;
 
@@ -2527,17 +2409,6 @@ retry:
                startoffset_fsb += allocated_fsb;
                allocatesize_fsb -= allocated_fsb;
        }
-dmapi_enospc_check:
-       if (error == ENOSPC && (attr_flags & XFS_ATTR_DMI) == 0 &&
-           DM_EVENT_ENABLED(ip, DM_EVENT_NOSPACE)) {
-               error = XFS_SEND_NAMESP(mp, DM_EVENT_NOSPACE,
-                               ip, DM_RIGHT_NULL,
-                               ip, DM_RIGHT_NULL,
-                               NULL, NULL, 0, 0, 0); /* Delay flag intentionally unused */
-               if (error == 0)
-                       goto retry;     /* Maybe DMAPI app. has made space */
-               /* else fall through with error from XFS_SEND_DATA */
-       }
 
        return error;
 
@@ -2548,7 +2419,7 @@ error0:   /* Cancel bmap, unlock inode, unreserve quota blocks, cancel trans */
 error1:        /* Just cancel transaction */
        xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT);
        xfs_iunlock(ip, XFS_ILOCK_EXCL);
-       goto dmapi_enospc_check;
+       return error;
 }
 
 /*
@@ -2661,7 +2532,6 @@ xfs_free_file_space(
 {
        int                     committed;
        int                     done;
-       xfs_off_t               end_dmi_offset;
        xfs_fileoff_t           endoffset_fsb;
        int                     error;
        xfs_fsblock_t           firstfsb;
@@ -2691,19 +2561,7 @@ xfs_free_file_space(
                return error;
        rt = XFS_IS_REALTIME_INODE(ip);
        startoffset_fsb = XFS_B_TO_FSB(mp, offset);
-       end_dmi_offset = offset + len;
-       endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset);
-
-       if (offset < ip->i_size && (attr_flags & XFS_ATTR_DMI) == 0 &&
-           DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) {
-               if (end_dmi_offset > ip->i_size)
-                       end_dmi_offset = ip->i_size;
-               error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, ip,
-                               offset, end_dmi_offset - offset,
-                               AT_DELAY_FLAG(attr_flags), NULL);
-               if (error)
-                       return error;
-       }
+       endoffset_fsb = XFS_B_TO_FSBT(mp, offset + len);
 
        if (attr_flags & XFS_ATTR_NOLOCK)
                need_iolock = 0;
This page took 0.046093 seconds and 5 git commands to generate.