Skip to content

Commit

Permalink
xfs: cleanup dmapi macros in the umount path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Hellwig authored and Alex Elder committed Dec 11, 2009
1 parent 0c3dc2b commit 30ac068
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
22 changes: 2 additions & 20 deletions fs/xfs/linux-2.6/xfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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.
Expand All @@ -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);
Expand Down
23 changes: 19 additions & 4 deletions fs/xfs/xfs_mount.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand All @@ -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
Expand Down

0 comments on commit 30ac068

Please sign in to comment.