Re-implement XFS_SEND_DESTROY() using a real (static inline)
function.
The mount point passed in to XFS_SEND_DESTROY() is always taken from
the i_mount field of the xfs_inode which is also provided. Get rid
of the mount point argument altogether, and compute what would have
been passed within the macro.
Finally, move the test for whether the event is enabled into the
called function.
Signed-off-by: Alex Elder <aelder@xxxxxxx>
---
fs/xfs/xfs_dmapi.h | 16 ++++++++++++++--
fs/xfs/xfs_vnodeops.c | 5 ++---
2 files changed, 16 insertions(+), 5 deletions(-)
Index: b/fs/xfs/xfs_dmapi.h
===================================================================
--- a/fs/xfs/xfs_dmapi.h
+++ b/fs/xfs/xfs_dmapi.h
@@ -245,8 +245,20 @@ xfs_dmapi_send_mmap(
return 0;
}
-#define XFS_SEND_DESTROY(mp, ip,right) \
- (*(mp)->m_dm_ops->xfs_send_destroy)(ip,right)
+static inline int
+xfs_dmapi_send_destroy(
+ struct xfs_inode *ip,
+ dm_right_t right)
+{
+ xfs_send_destroy_t send_destroy;
+
+ if (!xfs_dmapi_event_enabled(ip, DM_EVENT_DESTROY))
+ return 0;
+ send_destroy = ip->i_mount->m_dm_ops->xfs_send_destroy;
+
+ return send_destroy(ip, right);
+}
+
#define XFS_SEND_NAMESP(mp, ev,b1,r1,b2,r2,n1,n2,mode,rval,fl) \
(*(mp)->m_dm_ops->xfs_send_namesp)(ev,NULL,b1,r1,b2,r2,n1,n2,mode,rval,fl)
Index: b/fs/xfs/xfs_vnodeops.c
===================================================================
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1061,9 +1061,8 @@ xfs_inactive(
mp = ip->i_mount;
- if (ip->i_d.di_nlink == 0 &&
- xfs_dmapi_event_enabled(ip, DM_EVENT_DESTROY))
- XFS_SEND_DESTROY(mp, ip, DM_RIGHT_NULL);
+ if (ip->i_d.di_nlink == 0)
+ (void) xfs_dmapi_send_destroy(ip, DM_RIGHT_NULL);
error = 0;
|