cleanup vnode use in dmapi calls
PATCH 1/8 cleanup vnode use in dmapi calls
Signed-off-by Christoph Hellwig <[email protected]>
fs/xfs/dmapi/xfs_dm.c +13 -30
@@ -134,20 +134,18 @@ static inline size_t dm_stat_size(size_tint xfs_dm_send_data_event (dm_eventtype_t event, -bhv_vnode_t *vp, +xfs_inode_t *ip,xfs_off_t offset,size_t length,int flags,int *lock_flags) { +struct inode *inode = ip->i_vnode;int error; -xfs_inode_t *ip;uint16_t dmstate; -struct inode *inode =vn_to_inode (vp);/* Returns positive errors to XFS */ - ip =xfs_vtoi (vp); do { dmstate = ip->i_d.di_dmstate; if (lock_flags)
@@ -3081,7 +3079,6 @@ xfs_dm_send_mmap_event( struct vm_area_struct *vma, unsigned int wantflag) { -bhv_vnode_t *vp;xfs_inode_t *ip;int error =0 ;dm_eventtype_t max_event =DM_EVENT_READ ;
@@ -3093,8 +3090,6 @@ xfs_dm_send_mmap_event(return 0 ; ip =XFS_I (vma->vm_file->f_dentry->d_inode); - vp =vn_from_inode (vma->vm_file->f_dentry->d_inode); -ASSERT (vp);if (!S_ISREG (vma->vm_file->f_dentry->d_inode->i_mode) || !(ip->i_mount->m_flags &XFS_MOUNT_DMAPI ))
@@ -3147,7 +3142,7 @@ xfs_dm_send_mmap_event(xfs_ilock (ip, iolock);/* If write possible, try a DMAPI write event */ if (max_event ==DM_EVENT_WRITE &&DM_EVENT_ENABLED (ip, max_event)) { - error =xfs_dm_send_data_event (max_event, vp, offset, + error =xfs_dm_send_data_event (max_event, ip, offset, evsize,0 , &iolock); goto out_unlock; }
@@ -3156,7 +3151,7 @@ xfs_dm_send_mmap_event(* was DM_EVENT_WRITE but the WRITE event was not enabled. */ if (DM_EVENT_ENABLED (ip,DM_EVENT_READ )) { - error =xfs_dm_send_data_event (DM_EVENT_READ , vp, offset, + error =xfs_dm_send_data_event (DM_EVENT_READ , ip, offset, evsize,0 , &iolock); } out_unlock:
@@ -3167,17 +3162,11 @@ out_unlock: STATIC intxfs_dm_send_destroy_event ( -bhv_vnode_t *vp, +xfs_inode_t *ip,dm_right_t vp_right)/* always DM_RIGHT_NULL */ { -int error; -/* Returns positive errors to XFS */ - - error =dm_send_destroy_event (vn_to_inode (vp), vp_right); - error = -error;/* DMAPI returns negative errors */ - -return error;/* Return positive error to XFS */ +return -dm_send_destroy_event (ip->i_vnode, vp_right); }
@@ -3185,9 +3174,9 @@ STATIC intxfs_dm_send_namesp_event ( dm_eventtype_t event, struct xfs_mount *mp, - bhv_vnode_t *vp1, + xfs_inode_t *ip1, dm_right_t vp1_right, - bhv_vnode_t *vp2, + xfs_inode_t *ip2, dm_right_t vp2_right, char *name1, char *name2,
@@ -3195,18 +3184,12 @@ xfs_dm_send_namesp_event( int retcode, int flags) { - int error; -/* Returns positive errors to XFS */ - - error =dm_send_namesp_event (event, mp ? mp->m_super :NULL , -vn_to_inode (vp1), vp1_right, - vp2 ?vn_to_inode (vp2) :NULL , vp2_right, +return -dm_send_namesp_event (event, mp ? mp->m_super :NULL , + ip1->i_vnode, vp1_right, + ip2 ? ip2->i_vnode :NULL , vp2_right, name1, name2, mode, retcode, flags); - error = -error;/* DMAPI returns negative errors */ - -return error;/* Return positive error to XFS */ }STATIC int
@@ -3225,13 +3208,13 @@ xfs_dm_send_mount_event( STATIC voidxfs_dm_send_unmount_event (struct xfs_mount *mp, -bhv_vnode_t *vp,/* NULL if unmount successful */ +xfs_inode_t *ip,/* NULL if unmount successful */ dm_right_t vfsp_right,mode_t mode,int retcode,/* errno, if unmount failed */ int flags) { -dm_send_unmount_event (mp->m_super, vp ?vn_to_inode (vp) :NULL , +dm_send_unmount_event (mp->m_super, ip ? ip->i_vnode :NULL , vfsp_right, mode, retcode, flags); }
fs/xfs/linux-2.6/xfs_file.c +4 -9
@@ -470,16 +470,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 */
fs/xfs/linux-2.6/xfs_lrw.c +6 -8
@@ -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 @@ start: 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 @@ retry: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);
fs/xfs/xfs_bmap.c +1 -1
@@ -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); }
fs/xfs/xfs_mount.h +11 -11
@@ -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)/*
fs/xfs/xfs_rename.c +4 -4
@@ -262,8 +262,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) {
@@ -595,8 +595,8 @@ std_return: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 ); }
fs/xfs/xfs_vfsops.c +2 -2
@@ -567,7 +567,7 @@ xfs_unmount(#ifdef HAVE_DMAPI if (mp->m_flags &XFS_MOUNT_DMAPI ) { error =XFS_SEND_PREUNMOUNT (mp, - rvp,DM_RIGHT_NULL , rvp,DM_RIGHT_NULL , + rip,DM_RIGHT_NULL , rip,DM_RIGHT_NULL ,NULL ,NULL ,0 ,0 , (mp->m_dmevmask & (1 <<DM_EVENT_PREUNMOUNT ))?0 :DM_FLAGS_UNWANTED );
@@ -618,7 +618,7 @@ out:/* Note: mp structure must still exist for * XFS_SEND_UNMOUNT() call. */ -XFS_SEND_UNMOUNT (mp, error ==0 ? rvp :NULL , +XFS_SEND_UNMOUNT (mp, error ==0 ? rip :NULL ,DM_RIGHT_NULL ,0 , error, unmount_event_flags); }if (xfs_unmountfs_needed) {
fs/xfs/xfs_vnodeops.c +26 -29
169 lines not on this page · raw message