Commit bb3f724e authored by Dean Roehrich's avatar Dean Roehrich Committed by Nathan Scott

[XFS] send dmapi events from nopage for mmapped files

SGI-PV: 935317
SGI-Modid: xfs-linux:xfs-kern:192007a
Signed-off-by: default avatarDean Roehrich <roehrich@sgi.com>
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent 536388be
...@@ -311,6 +311,31 @@ linvfs_fsync( ...@@ -311,6 +311,31 @@ linvfs_fsync(
#define nextdp(dp) ((struct xfs_dirent *)((char *)(dp) + (dp)->d_reclen)) #define nextdp(dp) ((struct xfs_dirent *)((char *)(dp) + (dp)->d_reclen))
#ifdef CONFIG_XFS_DMAPI
STATIC struct page *
linvfs_filemap_nopage(
struct vm_area_struct *area,
unsigned long address,
int *type)
{
struct inode *inode = area->vm_file->f_dentry->d_inode;
vnode_t *vp = LINVFS_GET_VP(inode);
xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
int error;
ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI);
error = XFS_SEND_MMAP(mp, area, 0);
if (error)
return NULL;
return filemap_nopage(area, address, type);
}
#endif /* CONFIG_XFS_DMAPI */
STATIC int STATIC int
linvfs_readdir( linvfs_readdir(
struct file *filp, struct file *filp,
...@@ -390,14 +415,6 @@ linvfs_readdir( ...@@ -390,14 +415,6 @@ linvfs_readdir(
return -error; return -error;
} }
#ifdef CONFIG_XFS_DMAPI
STATIC void
linvfs_mmap_close(
struct vm_area_struct *vma)
{
xfs_dm_mm_put(vma);
}
#endif /* CONFIG_XFS_DMAPI */
STATIC int STATIC int
linvfs_file_mmap( linvfs_file_mmap(
...@@ -411,16 +428,11 @@ linvfs_file_mmap( ...@@ -411,16 +428,11 @@ linvfs_file_mmap(
vma->vm_ops = &linvfs_file_vm_ops; vma->vm_ops = &linvfs_file_vm_ops;
if (vp->v_vfsp->vfs_flag & VFS_DMI) {
xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
error = -XFS_SEND_MMAP(mp, vma, 0);
if (error)
return error;
#ifdef CONFIG_XFS_DMAPI #ifdef CONFIG_XFS_DMAPI
if (vp->v_vfsp->vfs_flag & VFS_DMI) {
vma->vm_ops = &linvfs_dmapi_file_vm_ops; vma->vm_ops = &linvfs_dmapi_file_vm_ops;
#endif
} }
#endif /* CONFIG_XFS_DMAPI */
VOP_SETATTR(vp, &va, XFS_AT_UPDATIME, NULL, error); VOP_SETATTR(vp, &va, XFS_AT_UPDATIME, NULL, error);
if (!error) if (!error)
...@@ -474,6 +486,7 @@ linvfs_ioctl_invis( ...@@ -474,6 +486,7 @@ linvfs_ioctl_invis(
return error; return error;
} }
#ifdef CONFIG_XFS_DMAPI
#ifdef HAVE_VMOP_MPROTECT #ifdef HAVE_VMOP_MPROTECT
STATIC int STATIC int
linvfs_mprotect( linvfs_mprotect(
...@@ -494,6 +507,7 @@ linvfs_mprotect( ...@@ -494,6 +507,7 @@ linvfs_mprotect(
return error; return error;
} }
#endif /* HAVE_VMOP_MPROTECT */ #endif /* HAVE_VMOP_MPROTECT */
#endif /* CONFIG_XFS_DMAPI */
#ifdef HAVE_FOP_OPEN_EXEC #ifdef HAVE_FOP_OPEN_EXEC
/* If the user is attempting to execute a file that is offline then /* If the user is attempting to execute a file that is offline then
...@@ -528,49 +542,10 @@ linvfs_open_exec( ...@@ -528,49 +542,10 @@ linvfs_open_exec(
} }
#endif /* HAVE_FOP_OPEN_EXEC */ #endif /* HAVE_FOP_OPEN_EXEC */
/*
* Temporary workaround to the AIO direct IO write problem.
* This code can go and we can revert to do_sync_write once
* the writepage(s) rework is merged.
*/
STATIC ssize_t
linvfs_write(
struct file *filp,
const char __user *buf,
size_t len,
loff_t *ppos)
{
struct kiocb kiocb;
ssize_t ret;
init_sync_kiocb(&kiocb, filp);
kiocb.ki_pos = *ppos;
ret = __linvfs_write(&kiocb, buf, 0, len, kiocb.ki_pos);
*ppos = kiocb.ki_pos;
return ret;
}
STATIC ssize_t
linvfs_write_invis(
struct file *filp,
const char __user *buf,
size_t len,
loff_t *ppos)
{
struct kiocb kiocb;
ssize_t ret;
init_sync_kiocb(&kiocb, filp);
kiocb.ki_pos = *ppos;
ret = __linvfs_write(&kiocb, buf, IO_INVIS, len, kiocb.ki_pos);
*ppos = kiocb.ki_pos;
return ret;
}
struct file_operations linvfs_file_operations = { struct file_operations linvfs_file_operations = {
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
.read = do_sync_read, .read = do_sync_read,
.write = linvfs_write, .write = do_sync_write,
.readv = linvfs_readv, .readv = linvfs_readv,
.writev = linvfs_writev, .writev = linvfs_writev,
.aio_read = linvfs_aio_read, .aio_read = linvfs_aio_read,
...@@ -592,7 +567,7 @@ struct file_operations linvfs_file_operations = { ...@@ -592,7 +567,7 @@ struct file_operations linvfs_file_operations = {
struct file_operations linvfs_invis_file_operations = { struct file_operations linvfs_invis_file_operations = {
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
.read = do_sync_read, .read = do_sync_read,
.write = linvfs_write_invis, .write = do_sync_write,
.readv = linvfs_readv_invis, .readv = linvfs_readv_invis,
.writev = linvfs_writev_invis, .writev = linvfs_writev_invis,
.aio_read = linvfs_aio_read_invis, .aio_read = linvfs_aio_read_invis,
...@@ -626,8 +601,7 @@ static struct vm_operations_struct linvfs_file_vm_ops = { ...@@ -626,8 +601,7 @@ static struct vm_operations_struct linvfs_file_vm_ops = {
#ifdef CONFIG_XFS_DMAPI #ifdef CONFIG_XFS_DMAPI
static struct vm_operations_struct linvfs_dmapi_file_vm_ops = { static struct vm_operations_struct linvfs_dmapi_file_vm_ops = {
.close = linvfs_mmap_close, .nopage = linvfs_filemap_nopage,
.nopage = filemap_nopage,
.populate = filemap_populate, .populate = filemap_populate,
#ifdef HAVE_VMOP_MPROTECT #ifdef HAVE_VMOP_MPROTECT
.mprotect = linvfs_mprotect, .mprotect = linvfs_mprotect,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment