xfs: cleanup dmapi macros in the umount path

Stop the flag saving as we never mangle those in the unmount path, and
hide all the weird arguents to the dmapi code inside the
XFS_SEND_PREUNMOUNT / XFS_SEND_UNMOUNT macros.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
This commit is contained in:
Christoph Hellwig 2009-11-14 16:17:24 +00:00 committed by Alex Elder
parent 0c3dc2b02a
commit 30ac0683dd
2 changed files with 21 additions and 24 deletions

View File

@ -1131,8 +1131,6 @@ xfs_fs_put_super(
struct super_block *sb)
{
struct xfs_mount *mp = XFS_M(sb);
struct xfs_inode *rip = mp->m_rootip;
int unmount_event_flags = 0;
xfs_syncd_stop(mp);
@ -1148,20 +1146,7 @@ xfs_fs_put_super(
xfs_sync_attr(mp, 0);
}
#ifdef HAVE_DMAPI
if (mp->m_flags & XFS_MOUNT_DMAPI) {
unmount_event_flags =
(mp->m_dmevmask & (1 << DM_EVENT_UNMOUNT)) ?
0 : DM_FLAGS_UNWANTED;
/*
* Ignore error from dmapi here, first unmount is not allowed
* to fail anyway, and second we wouldn't want to fail a
* unmount because of dmapi.
*/
XFS_SEND_PREUNMOUNT(mp, rip, DM_RIGHT_NULL, rip, DM_RIGHT_NULL,
NULL, NULL, 0, 0, unmount_event_flags);
}
#endif
XFS_SEND_PREUNMOUNT(mp);
/*
* Blow away any referenced inode in the filestreams cache.
@ -1172,10 +1157,7 @@ xfs_fs_put_super(
XFS_bflush(mp->m_ddev_targp);
if (mp->m_flags & XFS_MOUNT_DMAPI) {
XFS_SEND_UNMOUNT(mp, rip, DM_RIGHT_NULL, 0, 0,
unmount_event_flags);
}
XFS_SEND_UNMOUNT(mp);
xfs_unmountfs(mp);
xfs_freesb(mp);

View File

@ -93,6 +93,9 @@ typedef struct xfs_dmops {
xfs_send_unmount_t xfs_send_unmount;
} xfs_dmops_t;
#define XFS_DMAPI_UNMOUNT_FLAGS(mp) \
(((mp)->m_dmevmask & (1 << DM_EVENT_UNMOUNT)) ? 0 : DM_FLAGS_UNWANTED)
#define XFS_SEND_DATA(mp, ev,ip,off,len,fl,lock) \
(*(mp)->m_dm_ops->xfs_send_data)(ev,ip,off,len,fl,lock)
#define XFS_SEND_MMAP(mp, vma,fl) \
@ -101,12 +104,24 @@ typedef struct xfs_dmops {
(*(mp)->m_dm_ops->xfs_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)
#define XFS_SEND_PREUNMOUNT(mp,b1,r1,b2,r2,n1,n2,mode,rval,fl) \
(*(mp)->m_dm_ops->xfs_send_namesp)(DM_EVENT_PREUNMOUNT,mp,b1,r1,b2,r2,n1,n2,mode,rval,fl)
#define XFS_SEND_MOUNT(mp,right,path,name) \
(*(mp)->m_dm_ops->xfs_send_mount)(mp,right,path,name)
#define XFS_SEND_UNMOUNT(mp, ip,right,mode,rval,fl) \
(*(mp)->m_dm_ops->xfs_send_unmount)(mp,ip,right,mode,rval,fl)
#define XFS_SEND_PREUNMOUNT(mp) \
do { \
if (mp->m_flags & XFS_MOUNT_DMAPI) { \
(*(mp)->m_dm_ops->xfs_send_namesp)(DM_EVENT_PREUNMOUNT, mp, \
(mp)->m_rootip, DM_RIGHT_NULL, \
(mp)->m_rootip, DM_RIGHT_NULL, \
NULL, NULL, 0, 0, XFS_DMAPI_UNMOUNT_FLAGS(mp)); \
} \
} while (0)
#define XFS_SEND_UNMOUNT(mp) \
do { \
if (mp->m_flags & XFS_MOUNT_DMAPI) { \
(*(mp)->m_dm_ops->xfs_send_unmount)(mp, (mp)->m_rootip, \
DM_RIGHT_NULL, 0, 0, XFS_DMAPI_UNMOUNT_FLAGS(mp)); \
} \
} while (0)
#ifdef HAVE_PERCPU_SB