Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc4ac74a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Lachlan McIlroy
Browse files

[XFS] cleanup vnode use in dmapi calls



SGI-PV: 976035
SGI-Modid: xfs-linux-melb:xfs-kern:30545a

Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
parent d2341541
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -469,16 +469,11 @@ xfs_file_open_exec(
	struct inode	*inode)
{
	struct xfs_mount *mp = XFS_M(inode->i_sb);
	struct xfs_inode *ip = XFS_I(inode);

	if (unlikely(mp->m_flags & XFS_MOUNT_DMAPI)) {
		if (DM_EVENT_ENABLED(XFS_I(inode), DM_EVENT_READ)) {
			bhv_vnode_t *vp = vn_from_inode(inode);

			return -XFS_SEND_DATA(mp, DM_EVENT_READ,
						vp, 0, 0, 0, NULL);
		}
	}

	if (unlikely(mp->m_flags & XFS_MOUNT_DMAPI) &&
	             DM_EVENT_ENABLED(ip, DM_EVENT_READ))
		return -XFS_SEND_DATA(mp, DM_EVENT_READ, ip, 0, 0, 0, NULL);
	return 0;
}
#endif /* HAVE_FOP_OPEN_EXEC */
+6 −8
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ xfs_read(
		int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags);
		int iolock = XFS_IOLOCK_SHARED;

		ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *offset, size,
		ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, ip, *offset, size,
					dmflags, &iolock);
		if (ret) {
			xfs_iunlock(ip, XFS_IOLOCK_SHARED);
@@ -276,7 +276,6 @@ xfs_splice_read(
	int			flags,
	int			ioflags)
{
	bhv_vnode_t		*vp = XFS_ITOV(ip);
	xfs_mount_t		*mp = ip->i_mount;
	ssize_t			ret;

@@ -290,7 +289,7 @@ xfs_splice_read(
		int iolock = XFS_IOLOCK_SHARED;
		int error;

		error = XFS_SEND_DATA(mp, DM_EVENT_READ, vp, *ppos, count,
		error = XFS_SEND_DATA(mp, DM_EVENT_READ, ip, *ppos, count,
					FILP_DELAY_FLAG(infilp), &iolock);
		if (error) {
			xfs_iunlock(ip, XFS_IOLOCK_SHARED);
@@ -317,7 +316,6 @@ xfs_splice_write(
	int			flags,
	int			ioflags)
{
	bhv_vnode_t		*vp = XFS_ITOV(ip);
	xfs_mount_t		*mp = ip->i_mount;
	ssize_t			ret;
	struct inode		*inode = outfilp->f_mapping->host;
@@ -333,7 +331,7 @@ xfs_splice_write(
		int iolock = XFS_IOLOCK_EXCL;
		int error;

		error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp, *ppos, count,
		error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, ip, *ppos, count,
					FILP_DELAY_FLAG(outfilp), &iolock);
		if (error) {
			xfs_iunlock(ip, XFS_IOLOCK_EXCL);
@@ -631,7 +629,7 @@ xfs_write(
			dmflags |= DM_FLAGS_IMUX;

		xfs_iunlock(xip, XFS_ILOCK_EXCL);
		error = XFS_SEND_DATA(xip->i_mount, DM_EVENT_WRITE, vp,
		error = XFS_SEND_DATA(xip->i_mount, DM_EVENT_WRITE, xip,
				      pos, count, dmflags, &iolock);
		if (error) {
			goto out_unlock_internal;
@@ -778,8 +776,8 @@ xfs_write(
		xfs_iunlock(xip, iolock);
		if (need_i_mutex)
			mutex_unlock(&inode->i_mutex);
		error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp,
				DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL,
		error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, xip,
				DM_RIGHT_NULL, xip, DM_RIGHT_NULL, NULL, NULL,
				0, 0, 0); /* Delay flag intentionally  unused */
		if (need_i_mutex)
			mutex_lock(&inode->i_mutex);
+1 −1
Original line number Diff line number Diff line
@@ -5811,7 +5811,7 @@ xfs_getbmap(
	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);
		error = XFS_SEND_DATA(mp, DM_EVENT_READ, ip, 0, 0, 0, NULL);
		if (error)
			return XFS_ERROR(error);
	}
+11 −11
Original line number Diff line number Diff line
@@ -66,17 +66,17 @@ struct xfs_mru_cache;
 * Prototypes and functions for the Data Migration subsystem.
 */

typedef int	(*xfs_send_data_t)(int, bhv_vnode_t *,
typedef int	(*xfs_send_data_t)(int, struct xfs_inode *,
			xfs_off_t, size_t, int, int *);
typedef int	(*xfs_send_mmap_t)(struct vm_area_struct *, uint);
typedef int	(*xfs_send_destroy_t)(bhv_vnode_t *, dm_right_t);
typedef int	(*xfs_send_destroy_t)(struct xfs_inode *, dm_right_t);
typedef int	(*xfs_send_namesp_t)(dm_eventtype_t, struct xfs_mount *,
			bhv_vnode_t *,
			dm_right_t, bhv_vnode_t *, dm_right_t,
			struct xfs_inode *, dm_right_t,
			struct xfs_inode *, dm_right_t,
			char *, char *, mode_t, int, int);
typedef int	(*xfs_send_mount_t)(struct xfs_mount *, dm_right_t,
			char *, char *);
typedef void	(*xfs_send_unmount_t)(struct xfs_mount *, bhv_vnode_t *,
typedef void	(*xfs_send_unmount_t)(struct xfs_mount *, struct xfs_inode *,
			dm_right_t, mode_t, int, int);

typedef struct xfs_dmops {
@@ -88,20 +88,20 @@ typedef struct xfs_dmops {
	xfs_send_unmount_t	xfs_send_unmount;
} xfs_dmops_t;

#define XFS_SEND_DATA(mp, ev,vp,off,len,fl,lock) \
	(*(mp)->m_dm_ops->xfs_send_data)(ev,vp,off,len,fl,lock)
#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) \
	(*(mp)->m_dm_ops->xfs_send_mmap)(vma,fl)
#define XFS_SEND_DESTROY(mp, vp,right) \
	(*(mp)->m_dm_ops->xfs_send_destroy)(vp,right)
#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) \
	(*(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, vp,right,mode,rval,fl) \
	(*(mp)->m_dm_ops->xfs_send_unmount)(mp,vp,right,mode,rval,fl)
#define XFS_SEND_UNMOUNT(mp, ip,right,mode,rval,fl) \
	(*(mp)->m_dm_ops->xfs_send_unmount)(mp,ip,right,mode,rval,fl)


/*
+4 −4
Original line number Diff line number Diff line
@@ -258,8 +258,8 @@ xfs_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,
					src_dp, DM_RIGHT_NULL,
					target_dp, DM_RIGHT_NULL,
					src_name, target_name,
					0, 0, 0);
		if (error) {
@@ -591,8 +591,8 @@ xfs_rename(
	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,
					src_dp, DM_RIGHT_NULL,
					target_dp, DM_RIGHT_NULL,
					src_name, target_name,
					0, error, 0);
	}
Loading