[XFS] remove unessecary vfs argument to DM_EVENT_ENABLED
authorChristoph Hellwig <hch@infradead.org>
Thu, 16 Aug 2007 08:42:07 +0000 (18:42 +1000)
committerTim Shimmin <tes@chook.melbourne.sgi.com>
Mon, 15 Oct 2007 06:45:25 +0000 (16:45 +1000)
SGI-PV: 968690
SGI-Modid: xfs-linux-melb:xfs-kern:29340a

Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Vlad Apostolov <vapo@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
fs/xfs/linux-2.6/xfs_file.c
fs/xfs/linux-2.6/xfs_lrw.c
fs/xfs/xfs_bmap.c
fs/xfs/xfs_dmapi.h
fs/xfs/xfs_rename.c
fs/xfs/xfs_vnodeops.c

index 0d4001eafd16861daf44ef05ea0ee7200388dbf7..4fc0f58edacf815382dc8c96d47395acad514db2 100644 (file)
@@ -405,7 +405,7 @@ xfs_file_open_exec(
 
                if (!ip)
                        return -EINVAL;
-               if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ))
+               if (DM_EVENT_ENABLED(ip, DM_EVENT_READ))
                        return -XFS_SEND_DATA(mp, DM_EVENT_READ, vp,
                                               0, 0, 0, NULL);
        }
index 765ec16a6e392d3406d1891c6a58bfc456f1d23a..94941da6c4da3469bf4385859f5eaaed452f587c 100644 (file)
@@ -245,8 +245,7 @@ xfs_read(
                mutex_lock(&inode->i_mutex);
        xfs_ilock(ip, XFS_IOLOCK_SHARED);
 
-       if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) &&
-           !(ioflags & IO_INVIS)) {
+       if (DM_EVENT_ENABLED(ip, DM_EVENT_READ) && !(ioflags & IO_INVIS)) {
                bhv_vrwlock_t locktype = VRWLOCK_READ;
                int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags);
 
@@ -307,8 +306,7 @@ xfs_splice_read(
 
        xfs_ilock(ip, XFS_IOLOCK_SHARED);
 
-       if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_READ) &&
-           (!(ioflags & IO_INVIS))) {
+       if (DM_EVENT_ENABLED(ip, DM_EVENT_READ) && !(ioflags & IO_INVIS)) {
                bhv_vrwlock_t locktype = VRWLOCK_READ;
                int error;
 
@@ -354,8 +352,7 @@ xfs_splice_write(
 
        xfs_ilock(ip, XFS_IOLOCK_EXCL);
 
-       if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_WRITE) &&
-           (!(ioflags & IO_INVIS))) {
+       if (DM_EVENT_ENABLED(ip, DM_EVENT_WRITE) && !(ioflags & IO_INVIS)) {
                bhv_vrwlock_t locktype = VRWLOCK_WRITE;
                int error;
 
@@ -664,7 +661,7 @@ start:
                goto out_unlock_mutex;
        }
 
-       if ((DM_EVENT_ENABLED(vp->v_vfsp, xip, DM_EVENT_WRITE) &&
+       if ((DM_EVENT_ENABLED(xip, DM_EVENT_WRITE) &&
            !(ioflags & IO_INVIS) && !eventsent)) {
                int             dmflags = FILP_DELAY_FLAG(file);
 
@@ -816,10 +813,8 @@ retry:
        if (ret == -EIOCBQUEUED && !(ioflags & IO_ISAIO))
                ret = wait_on_sync_kiocb(iocb);
 
-       if ((ret == -ENOSPC) &&
-           DM_EVENT_ENABLED(vp->v_vfsp, xip, DM_EVENT_NOSPACE) &&
-           !(ioflags & IO_INVIS)) {
-
+       if (ret == -ENOSPC &&
+           DM_EVENT_ENABLED(xip, DM_EVENT_NOSPACE) && !(ioflags & IO_INVIS)) {
                xfs_rwunlock(bdp, locktype);
                if (need_i_mutex)
                        mutex_unlock(&inode->i_mutex);
index 9abe93cfb5cc779324a414b0d9e326df2cd3c879..ea4eab14a603e0b58e91d8fdea603332a41f003f 100644 (file)
@@ -5811,10 +5811,9 @@ xfs_getbmap(
         *      could misinterpret holes in a DMAPI file as true holes,
         *      when in fact they may represent offline user data.
         */
-       if (   (interface & BMV_IF_NO_DMAPI_READ) == 0
-           && DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ)
-           && whichfork == XFS_DATA_FORK) {
-
+       if ((interface & BMV_IF_NO_DMAPI_READ) == 0 &&
+           DM_EVENT_ENABLED(ip, DM_EVENT_READ) &&
+           whichfork == XFS_DATA_FORK) {
                error = XFS_SEND_DATA(mp, DM_EVENT_READ, vp, 0, 0, 0, NULL);
                if (error)
                        return XFS_ERROR(error);
index adc3d251240d79e6023fc6de599dd2e4e31d588d..988cf446d9e7ca1973a044083d52b2476824a644 100644 (file)
@@ -67,18 +67,12 @@ typedef enum {
 #define HAVE_DM_RIGHT_T
 
 /* Defines for determining if an event message should be sent. */
-#define        DM_EVENT_ENABLED(vfsp, ip, event) ( \
-       unlikely ((vfsp)->vfs_flag & VFS_DMI) && \
+#define        DM_EVENT_ENABLED(ip, event) ( \
+       unlikely (XFS_MTOVFS((ip)->i_mount)->vfs_flag & VFS_DMI) && \
                ( ((ip)->i_d.di_dmevmask & (1 << event)) || \
                  ((ip)->i_mount->m_dmevmask & (1 << event)) ) \
        )
 
-#define        DM_EVENT_ENABLED_IO(vfsp, io, event) ( \
-       unlikely ((vfsp)->vfs_flag & VFS_DMI) && \
-               ( ((io)->io_dmevmask & (1 << event)) || \
-                 ((io)->io_mount->m_dmevmask & (1 << event)) ) \
-       )
-
 #define DM_XFS_VALID_FS_EVENTS         ( \
        (1 << DM_EVENT_PREUNMOUNT)      | \
        (1 << DM_EVENT_UNMOUNT)         | \
index 7679d7a7022d36ea491616d4aa6cca83bc0e3165..53d9600af4a424bc2b18e0f38e96597fd8f57c4e 100644 (file)
@@ -264,9 +264,8 @@ xfs_rename(
        src_dp = XFS_BHVTOI(src_dir_bdp);
        mp = src_dp->i_mount;
 
-       if (DM_EVENT_ENABLED(src_dir_vp->v_vfsp, src_dp, DM_EVENT_RENAME) ||
-           DM_EVENT_ENABLED(target_dir_vp->v_vfsp,
-                               target_dp, DM_EVENT_RENAME)) {
+       if (DM_EVENT_ENABLED(src_dp, DM_EVENT_RENAME) ||
+           DM_EVENT_ENABLED(target_dp, DM_EVENT_RENAME)) {
                error = XFS_SEND_NAMESP(mp, DM_EVENT_RENAME,
                                        src_dir_vp, DM_RIGHT_NULL,
                                        target_dir_vp, DM_RIGHT_NULL,
@@ -603,9 +602,8 @@ xfs_rename(
        /* Fall through to std_return with error = 0 or errno from
         * xfs_trans_commit      */
 std_return:
-       if (DM_EVENT_ENABLED(src_dir_vp->v_vfsp, src_dp, DM_EVENT_POSTRENAME) ||
-           DM_EVENT_ENABLED(target_dir_vp->v_vfsp,
-                               target_dp, DM_EVENT_POSTRENAME)) {
+       if (DM_EVENT_ENABLED(src_dp, DM_EVENT_POSTRENAME) ||
+           DM_EVENT_ENABLED(target_dp, DM_EVENT_POSTRENAME)) {
                (void) XFS_SEND_NAMESP (mp, DM_EVENT_POSTRENAME,
                                        src_dir_vp, DM_RIGHT_NULL,
                                        target_dir_vp, DM_RIGHT_NULL,
index 603459229904e0b6701b4a883b262041967e9a0a..0116ce1ad59e381df00e2ec8feefbda9d737c564 100644 (file)
@@ -337,7 +337,7 @@ xfs_setattr(
                        }
                }
        } else {
-               if (DM_EVENT_ENABLED (vp->v_vfsp, ip, DM_EVENT_TRUNCATE) &&
+               if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) &&
                    !(flags & ATTR_DMI)) {
                        int dmflags = AT_DELAY_FLAG(flags) | DM_SEM_FLAG_WR;
                        code = XFS_SEND_DATA(mp, DM_EVENT_TRUNCATE, vp,
@@ -896,7 +896,7 @@ xfs_setattr(
                return code;
        }
 
-       if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_ATTRIBUTE) &&
+       if (DM_EVENT_ENABLED(ip, DM_EVENT_ATTRIBUTE) &&
            !(flags & ATTR_DMI)) {
                (void) XFS_SEND_NAMESP(mp, DM_EVENT_ATTRIBUTE, vp, DM_RIGHT_NULL,
                                        NULL, DM_RIGHT_NULL, NULL, NULL,
@@ -1666,8 +1666,7 @@ xfs_inactive(
 
        mp = ip->i_mount;
 
-       if (ip->i_d.di_nlink == 0 &&
-           DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_DESTROY)) {
+       if (ip->i_d.di_nlink == 0 && DM_EVENT_ENABLED(ip, DM_EVENT_DESTROY)) {
                (void) XFS_SEND_DESTROY(mp, vp, DM_RIGHT_NULL);
        }
 
@@ -1922,7 +1921,7 @@ xfs_create(
        dm_di_mode = vap->va_mode;
        namelen = VNAMELEN(dentry);
 
-       if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_CREATE)) {
+       if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
                error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE,
                                dir_vp, DM_RIGHT_NULL, NULL,
                                DM_RIGHT_NULL, name, NULL,
@@ -2087,9 +2086,8 @@ xfs_create(
        /* Fallthrough to std_return with error = 0  */
 
 std_return:
-       if ( (*vpp || (error != 0 && dm_event_sent != 0)) &&
-                       DM_EVENT_ENABLED(dir_vp->v_vfsp, XFS_BHVTOI(dir_bdp),
-                                                       DM_EVENT_POSTCREATE)) {
+       if ((*vpp || (error != 0 && dm_event_sent != 0)) &&
+           DM_EVENT_ENABLED(XFS_BHVTOI(dir_bdp), DM_EVENT_POSTCREATE)) {
                (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE,
                        dir_vp, DM_RIGHT_NULL,
                        *vpp ? vp:NULL,
@@ -2423,7 +2421,7 @@ xfs_remove(
                IRELE(ip);
        }
 
-       if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) {
+       if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) {
                error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE, dir_vp,
                                        DM_RIGHT_NULL, NULL, DM_RIGHT_NULL,
                                        name, NULL, dm_di_mode, 0, 0);
@@ -2599,8 +2597,7 @@ xfs_remove(
 
 /*     Fall through to std_return with error = 0 */
  std_return:
-       if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp,
-                                               DM_EVENT_POSTREMOVE)) {
+       if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTREMOVE)) {
                (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE,
                                dir_vp, DM_RIGHT_NULL,
                                NULL, DM_RIGHT_NULL,
@@ -2677,7 +2674,7 @@ xfs_link(
        if (XFS_FORCED_SHUTDOWN(mp))
                return XFS_ERROR(EIO);
 
-       if (DM_EVENT_ENABLED(src_vp->v_vfsp, tdp, DM_EVENT_LINK)) {
+       if (DM_EVENT_ENABLED(tdp, DM_EVENT_LINK)) {
                error = XFS_SEND_NAMESP(mp, DM_EVENT_LINK,
                                        target_dir_vp, DM_RIGHT_NULL,
                                        src_vp, DM_RIGHT_NULL,
@@ -2788,8 +2785,7 @@ xfs_link(
 
        /* Fall through to std_return with error = 0. */
 std_return:
-       if (DM_EVENT_ENABLED(src_vp->v_vfsp, sip,
-                                               DM_EVENT_POSTLINK)) {
+       if (DM_EVENT_ENABLED(sip, DM_EVENT_POSTLINK)) {
                (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTLINK,
                                target_dir_vp, DM_RIGHT_NULL,
                                src_vp, DM_RIGHT_NULL,
@@ -2853,7 +2849,7 @@ xfs_mkdir(
        dp_joined_to_trans = B_FALSE;
        dm_di_mode = vap->va_mode;
 
-       if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_CREATE)) {
+       if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
                error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE,
                                        dir_vp, DM_RIGHT_NULL, NULL,
                                        DM_RIGHT_NULL, dir_name, NULL,
@@ -3010,9 +3006,8 @@ xfs_mkdir(
         * xfs_trans_commit. */
 
 std_return:
-       if ( (created || (error != 0 && dm_event_sent != 0)) &&
-                       DM_EVENT_ENABLED(dir_vp->v_vfsp, XFS_BHVTOI(dir_bdp),
-                                               DM_EVENT_POSTCREATE)) {
+       if ((created || (error != 0 && dm_event_sent != 0)) &&
+           DM_EVENT_ENABLED(XFS_BHVTOI(dir_bdp), DM_EVENT_POSTCREATE)) {
                (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE,
                                        dir_vp, DM_RIGHT_NULL,
                                        created ? XFS_ITOV(cdp):NULL,
@@ -3081,7 +3076,7 @@ xfs_rmdir(
                IRELE(cdp);
        }
 
-       if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_REMOVE)) {
+       if (DM_EVENT_ENABLED(dp, DM_EVENT_REMOVE)) {
                error = XFS_SEND_NAMESP(mp, DM_EVENT_REMOVE,
                                        dir_vp, DM_RIGHT_NULL,
                                        NULL, DM_RIGHT_NULL,
@@ -3270,7 +3265,7 @@ xfs_rmdir(
        /* Fall through to std_return with error = 0 or the errno
         * from xfs_trans_commit. */
  std_return:
-       if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_POSTREMOVE)) {
+       if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTREMOVE)) {
                (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTREMOVE,
                                        dir_vp, DM_RIGHT_NULL,
                                        NULL, DM_RIGHT_NULL,
@@ -3405,7 +3400,7 @@ xfs_symlink(
                }
        }
 
-       if (DM_EVENT_ENABLED(dir_vp->v_vfsp, dp, DM_EVENT_SYMLINK)) {
+       if (DM_EVENT_ENABLED(dp, DM_EVENT_SYMLINK)) {
                error = XFS_SEND_NAMESP(mp, DM_EVENT_SYMLINK, dir_vp,
                                        DM_RIGHT_NULL, NULL, DM_RIGHT_NULL,
                                        link_name, target_path, 0, 0, 0);
@@ -3605,8 +3600,7 @@ xfs_symlink(
        /* Fall through to std_return with error = 0 or errno from
         * xfs_trans_commit     */
 std_return:
-       if (DM_EVENT_ENABLED(dir_vp->v_vfsp, XFS_BHVTOI(dir_bdp),
-                            DM_EVENT_POSTSYMLINK)) {
+       if (DM_EVENT_ENABLED(XFS_BHVTOI(dir_bdp), DM_EVENT_POSTSYMLINK)) {
                (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTSYMLINK,
                                        dir_vp, DM_RIGHT_NULL,
                                        error ? NULL : XFS_ITOV(ip),
@@ -4109,7 +4103,7 @@ xfs_alloc_file_space(
        /*      Generate a DMAPI event if needed.       */
        if (alloc_type != 0 && offset < ip->i_size &&
                        (attr_flags&ATTR_DMI) == 0  &&
-                       DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) {
+                       DM_EVENT_ENABLED(ip, DM_EVENT_WRITE)) {
                xfs_off_t           end_dmi_offset;
 
                end_dmi_offset = offset+len;
@@ -4223,9 +4217,8 @@ retry:
                allocatesize_fsb -= allocated_fsb;
        }
 dmapi_enospc_check:
-       if (error == ENOSPC && (attr_flags&ATTR_DMI) == 0 &&
-           DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_NOSPACE)) {
-
+       if (error == ENOSPC && (attr_flags & ATTR_DMI) == 0 &&
+           DM_EVENT_ENABLED(ip, DM_EVENT_NOSPACE)) {
                error = XFS_SEND_NAMESP(mp, DM_EVENT_NOSPACE,
                                XFS_ITOV(ip), DM_RIGHT_NULL,
                                XFS_ITOV(ip), DM_RIGHT_NULL,
@@ -4369,9 +4362,8 @@ xfs_free_file_space(
        end_dmi_offset = offset + len;
        endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset);
 
-       if (offset < ip->i_size &&
-           (attr_flags & ATTR_DMI) == 0 &&
-           DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) {
+       if (offset < ip->i_size && (attr_flags & 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, vp,