xfs
[Top] [All Lists]

[PATCH 07/15] xfs: rewrite XFS_SEND_MMAP() as a function

To: xfs@xxxxxxxxxxx
Subject: [PATCH 07/15] xfs: rewrite XFS_SEND_MMAP() as a function
From: Alex Elder <aelder@xxxxxxx>
Date: Mon, 28 Jun 2010 17:05:32 -0500
User-agent: Heirloom mailx 12.4 7/29/08
Re-implement XFS_SEND_MMAP() using a real (static inline) function.

The mount point passed in to XFS_SEND_MMAP() is always derived from
from the vma struct that is the subject of VM operation.  Get rid of
the mount point argument altogether, and compute what would have
been passed within the macro, making the first argument the vma
"target" of the event being signalled.

Finally, move the checks for whether an event is enabled into
the called function.


Signed-off-by: Alex Elder <aelder@xxxxxxx>

---
 fs/xfs/xfs_dmapi.h |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

Index: b/fs/xfs/xfs_dmapi.h
===================================================================
--- a/fs/xfs/xfs_dmapi.h
+++ b/fs/xfs/xfs_dmapi.h
@@ -227,8 +227,24 @@ xfs_dmapi_send_data(
        return send_data(event, ip, offset, length, flags, lock_flags);
 }
 
-#define XFS_SEND_MMAP(mp, vma,fl) \
-       (*(mp)->m_dm_ops->xfs_send_mmap)(vma,fl)
+static inline int
+xfs_dmapi_send_mmap(
+       struct vm_area_struct   *vma,
+       unsigned long           vm_flags)
+{
+       struct inode            *inode = vma->vm_file->f_path.dentry->d_inode;
+       struct xfs_mount        *mp = XFS_M(inode->i_sb);
+
+       if (mp->m_flags & XFS_MOUNT_DMAPI) {
+               xfs_send_mmap_t send_mmap = mp->m_dm_ops->xfs_send_mmap;
+
+               return send_mmap(vma, vm_flags);
+       }
+       ASSERT_ALWAYS(vm_flags == VM_WRITE);
+
+       return 0;
+}
+
 #define XFS_SEND_DESTROY(mp, ip,right) \
        (*(mp)->m_dm_ops->xfs_send_destroy)(ip,right)
 #define XFS_SEND_NAMESP(mp, ev,b1,r1,b2,r2,n1,n2,mode,rval,fl) \

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH 07/15] xfs: rewrite XFS_SEND_MMAP() as a function, Alex Elder <=