Commit 739bfb2a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Tim Shimmin
Browse files

[XFS] call common xfs vnode-level helpers directly and remove vnode operations



SGI-PV: 969608
SGI-Modid: xfs-linux-melb:xfs-kern:29493a

Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarDavid Chinner <dgc@sgi.com>
Signed-off-by: default avatarTim Shimmin <tes@sgi.com>
parent 993386c1
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -89,7 +89,6 @@ xfs-y += xfs_alloc.o \
				   xfs_utils.o \
				   xfs_vfsops.o \
				   xfs_vnodeops.o \
				   xfs_vnodeops_bhv.o \
				   xfs_rw.o \
				   xfs_dmops.o \
				   xfs_qmops.o
+14 −11
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "xfs_error.h"
#include "xfs_rw.h"
#include "xfs_iomap.h"
#include "xfs_vnodeops.h"
#include <linux/mpage.h>
#include <linux/pagevec.h>
#include <linux/writeback.h>
@@ -232,7 +233,8 @@ xfs_end_bio_unwritten(
	size_t			size = ioend->io_size;

	if (likely(!ioend->io_error)) {
		bhv_vop_bmap(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL);
		xfs_bmap(xfs_vtoi(vp), offset, size,
				BMAPI_UNWRITTEN, NULL, NULL);
		xfs_setfilesize(ioend);
	}
	xfs_destroy_ioend(ioend);
@@ -305,7 +307,8 @@ xfs_map_blocks(
	bhv_vnode_t		*vp = vn_from_inode(inode);
	int			error, nmaps = 1;

	error = bhv_vop_bmap(vp, offset, count, flags, mapp, &nmaps);
	error = xfs_bmap(xfs_vtoi(vp), offset, count,
				flags, mapp, &nmaps);
	if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE)))
		VMODIFY(vp);
	return -error;
@@ -1323,7 +1326,6 @@ __xfs_get_blocks(
	int			direct,
	bmapi_flags_t		flags)
{
	bhv_vnode_t		*vp = vn_from_inode(inode);
	xfs_iomap_t		iomap;
	xfs_off_t		offset;
	ssize_t			size;
@@ -1333,7 +1335,7 @@ __xfs_get_blocks(
	offset = (xfs_off_t)iblock << inode->i_blkbits;
	ASSERT(bh_result->b_size >= (1 << inode->i_blkbits));
	size = bh_result->b_size;
	error = bhv_vop_bmap(vp, offset, size,
	error = xfs_bmap(XFS_I(inode), offset, size,
			     create ? flags : BMAPI_READ, &iomap, &niomap);
	if (error)
		return -error;
@@ -1481,13 +1483,13 @@ xfs_vm_direct_IO(
{
	struct file	*file = iocb->ki_filp;
	struct inode	*inode = file->f_mapping->host;
	bhv_vnode_t	*vp = vn_from_inode(inode);
	xfs_iomap_t	iomap;
	int		maps = 1;
	int		error;
	ssize_t		ret;

	error = bhv_vop_bmap(vp, offset, 0, BMAPI_DEVICE, &iomap, &maps);
	error = xfs_bmap(XFS_I(inode), offset, 0,
				BMAPI_DEVICE, &iomap, &maps);
	if (error)
		return -error;

@@ -1528,12 +1530,13 @@ xfs_vm_bmap(
	sector_t		block)
{
	struct inode		*inode = (struct inode *)mapping->host;
	bhv_vnode_t		*vp = vn_from_inode(inode);
	struct xfs_inode	*ip = XFS_I(inode);

	vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
	bhv_vop_rwlock(vp, VRWLOCK_READ);
	bhv_vop_flush_pages(vp, (xfs_off_t)0, -1, 0, FI_REMAPF);
	bhv_vop_rwunlock(vp, VRWLOCK_READ);
	vn_trace_entry(vn_from_inode(inode), __FUNCTION__,
			(inst_t *)__return_address);
	xfs_rwlock(ip, VRWLOCK_READ);
	xfs_flush_pages(ip, (xfs_off_t)0, -1, 0, FI_REMAPF);
	xfs_rwunlock(ip, VRWLOCK_READ);
	return generic_block_bmap(mapping, block, xfs_get_blocks);
}

+5 −3
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@
#include "xfs_dmapi.h"
#include "xfs_mount.h"
#include "xfs_export.h"
#include "xfs_vnodeops.h"
#include "xfs_bmap_btree.h"
#include "xfs_inode.h"

static struct dentry dotdot = { .d_name.name = "..", .d_name.len = 2, };

@@ -161,12 +164,11 @@ xfs_fs_get_parent(
	struct dentry		*child)
{
	int			error;
	bhv_vnode_t		*vp, *cvp;
	bhv_vnode_t		*cvp;
	struct dentry		*parent;

	cvp = NULL;
	vp = vn_from_inode(child->d_inode);
	error = bhv_vop_lookup(vp, &dotdot, &cvp, 0, NULL, NULL);
	error = xfs_lookup(XFS_I(child->d_inode), &dotdot, &cvp);
	if (unlikely(error))
		return ERR_PTR(-error);

+21 −28
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "xfs_error.h"
#include "xfs_rw.h"
#include "xfs_ioctl32.h"
#include "xfs_vnodeops.h"

#include <linux/dcache.h>
#include <linux/smp_lock.h>
@@ -55,13 +56,12 @@ __xfs_file_read(
	loff_t			pos)
{
	struct file		*file = iocb->ki_filp;
	bhv_vnode_t		*vp = vn_from_inode(file->f_path.dentry->d_inode);

	BUG_ON(iocb->ki_pos != pos);
	if (unlikely(file->f_flags & O_DIRECT))
		ioflags |= IO_ISDIRECT;
	return bhv_vop_read(vp, iocb, iov, nr_segs, &iocb->ki_pos,
				ioflags, NULL);
	return xfs_read(XFS_I(file->f_path.dentry->d_inode), iocb, iov,
				nr_segs, &iocb->ki_pos, ioflags);
}

STATIC ssize_t
@@ -93,14 +93,12 @@ __xfs_file_write(
	loff_t			pos)
{
	struct file	*file = iocb->ki_filp;
	struct inode	*inode = file->f_mapping->host;
	bhv_vnode_t	*vp = vn_from_inode(inode);

	BUG_ON(iocb->ki_pos != pos);
	if (unlikely(file->f_flags & O_DIRECT))
		ioflags |= IO_ISDIRECT;
	return bhv_vop_write(vp, iocb, iov, nr_segs, &iocb->ki_pos,
				ioflags, NULL);
	return xfs_write(XFS_I(file->f_mapping->host), iocb, iov, nr_segs,
				&iocb->ki_pos, ioflags);
}

STATIC ssize_t
@@ -131,8 +129,8 @@ xfs_file_splice_read(
	size_t			len,
	unsigned int		flags)
{
	return bhv_vop_splice_read(vn_from_inode(infilp->f_path.dentry->d_inode),
				   infilp, ppos, pipe, len, flags, 0, NULL);
	return xfs_splice_read(XFS_I(infilp->f_path.dentry->d_inode),
				   infilp, ppos, pipe, len, flags, 0);
}

STATIC ssize_t
@@ -143,9 +141,8 @@ xfs_file_splice_read_invis(
	size_t			len,
	unsigned int		flags)
{
	return bhv_vop_splice_read(vn_from_inode(infilp->f_path.dentry->d_inode),
				   infilp, ppos, pipe, len, flags, IO_INVIS,
				   NULL);
	return xfs_splice_read(XFS_I(infilp->f_path.dentry->d_inode),
				   infilp, ppos, pipe, len, flags, IO_INVIS);
}

STATIC ssize_t
@@ -156,8 +153,8 @@ xfs_file_splice_write(
	size_t			len,
	unsigned int		flags)
{
	return bhv_vop_splice_write(vn_from_inode(outfilp->f_path.dentry->d_inode),
				    pipe, outfilp, ppos, len, flags, 0, NULL);
	return xfs_splice_write(XFS_I(outfilp->f_path.dentry->d_inode),
				    pipe, outfilp, ppos, len, flags, 0);
}

STATIC ssize_t
@@ -168,9 +165,8 @@ xfs_file_splice_write_invis(
	size_t			len,
	unsigned int		flags)
{
	return bhv_vop_splice_write(vn_from_inode(outfilp->f_path.dentry->d_inode),
				    pipe, outfilp, ppos, len, flags, IO_INVIS,
				    NULL);
	return xfs_splice_write(XFS_I(outfilp->f_path.dentry->d_inode),
				    pipe, outfilp, ppos, len, flags, IO_INVIS);
}

STATIC int
@@ -180,7 +176,7 @@ xfs_file_open(
{
	if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
		return -EFBIG;
	return -bhv_vop_open(vn_from_inode(inode), NULL);
	return -xfs_open(XFS_I(inode));
}

STATIC int
@@ -188,11 +184,7 @@ xfs_file_release(
	struct inode	*inode,
	struct file	*filp)
{
	bhv_vnode_t	*vp = vn_from_inode(inode);

	if (vp)
		return -bhv_vop_release(vp);
	return 0;
	return -xfs_release(XFS_I(inode));
}

STATIC int
@@ -208,7 +200,8 @@ xfs_file_fsync(
		flags |= FSYNC_DATA;
	if (VN_TRUNC(vp))
		VUNTRUNCATE(vp);
	return -bhv_vop_fsync(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1);
	return -xfs_fsync(XFS_I(dentry->d_inode), flags,
			(xfs_off_t)0, (xfs_off_t)-1);
}

#ifdef CONFIG_XFS_DMAPI
@@ -234,7 +227,7 @@ xfs_file_readdir(
	filldir_t	filldir)
{
	struct inode	*inode = filp->f_path.dentry->d_inode;
	bhv_vnode_t	*vp = vn_from_inode(inode);
	xfs_inode_t	*ip = XFS_I(inode);
	int		error;
	size_t		bufsize;

@@ -252,7 +245,7 @@ xfs_file_readdir(
	 */
	bufsize = (size_t)min_t(loff_t, PAGE_SIZE, inode->i_size);

	error = bhv_vop_readdir(vp, dirent, bufsize,
	error = xfs_readdir(ip, dirent, bufsize,
				(xfs_off_t *)&filp->f_pos, filldir);
	if (error)
		return -error;
@@ -286,7 +279,7 @@ xfs_file_ioctl(
	struct inode	*inode = filp->f_path.dentry->d_inode;
	bhv_vnode_t	*vp = vn_from_inode(inode);

	error = bhv_vop_ioctl(vp, inode, filp, 0, cmd, (void __user *)p);
	error = xfs_ioctl(XFS_I(inode), filp, 0, cmd, (void __user *)p);
	VMODIFY(vp);

	/* NOTE:  some of the ioctl's return positive #'s as a
@@ -308,7 +301,7 @@ xfs_file_ioctl_invis(
	struct inode	*inode = filp->f_path.dentry->d_inode;
	bhv_vnode_t	*vp = vn_from_inode(inode);

	error = bhv_vop_ioctl(vp, inode, filp, IO_INVIS, cmd, (void __user *)p);
	error = xfs_ioctl(XFS_I(inode), filp, IO_INVIS, cmd, (void __user *)p);
	VMODIFY(vp);

	/* NOTE:  some of the ioctl's return positive #'s as a
+20 −20
Original line number Diff line number Diff line
@@ -413,7 +413,7 @@ xfs_readlink_by_handle(
	if (!link)
		goto out_iput;

	error = -bhv_vop_readlink(vp, link);
	error = -xfs_readlink(XFS_I(inode), link);
	if (error)
		goto out_kfree;
	error = do_readlink(hreq.ohandle, olen, link);
@@ -497,8 +497,8 @@ xfs_attrlist_by_handle(
		goto out_vn_rele;

	cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
	error = bhv_vop_attr_list(vp, kbuf, al_hreq.buflen, al_hreq.flags,
					cursor, NULL);
	error = xfs_attr_list(XFS_I(inode), kbuf, al_hreq.buflen,
					al_hreq.flags, cursor);
	if (error)
		goto out_kfree;

@@ -515,7 +515,7 @@ xfs_attrlist_by_handle(

STATIC int
xfs_attrmulti_attr_get(
	bhv_vnode_t		*vp,
	struct inode		*inode,
	char			*name,
	char			__user *ubuf,
	__uint32_t		*len,
@@ -530,7 +530,7 @@ xfs_attrmulti_attr_get(
	if (!kbuf)
		return ENOMEM;

	error = bhv_vop_attr_get(vp, name, kbuf, len, flags, NULL);
	error = xfs_attr_get(XFS_I(inode), name, kbuf, len, flags, NULL);
	if (error)
		goto out_kfree;

@@ -544,7 +544,7 @@ xfs_attrmulti_attr_get(

STATIC int
xfs_attrmulti_attr_set(
	bhv_vnode_t		*vp,
	struct inode		*inode,
	char			*name,
	const char		__user *ubuf,
	__uint32_t		len,
@@ -553,9 +553,9 @@ xfs_attrmulti_attr_set(
	char			*kbuf;
	int			error = EFAULT;

	if (IS_RDONLY(&vp->v_inode))
	if (IS_RDONLY(inode))
		return -EROFS;
	if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode))
	if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
		return EPERM;
	if (len > XATTR_SIZE_MAX)
		return EINVAL;
@@ -567,7 +567,7 @@ xfs_attrmulti_attr_set(
	if (copy_from_user(kbuf, ubuf, len))
		goto out_kfree;
			
	error = bhv_vop_attr_set(vp, name, kbuf, len, flags, NULL);
	error = xfs_attr_set(XFS_I(inode), name, kbuf, len, flags);

 out_kfree:
	kfree(kbuf);
@@ -576,15 +576,15 @@ xfs_attrmulti_attr_set(

STATIC int
xfs_attrmulti_attr_remove(
	bhv_vnode_t		*vp,
	struct inode		*inode,
	char			*name,
	__uint32_t		flags)
{
	if (IS_RDONLY(&vp->v_inode))
	if (IS_RDONLY(inode))
		return -EROFS;
	if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode))
	if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
		return EPERM;
	return bhv_vop_attr_remove(vp, name, flags, NULL);
	return xfs_attr_remove(XFS_I(inode), name, flags);
}

STATIC int
@@ -640,17 +640,17 @@ xfs_attrmulti_by_handle(

		switch (ops[i].am_opcode) {
		case ATTR_OP_GET:
			ops[i].am_error = xfs_attrmulti_attr_get(vp,
			ops[i].am_error = xfs_attrmulti_attr_get(inode,
					attr_name, ops[i].am_attrvalue,
					&ops[i].am_length, ops[i].am_flags);
			break;
		case ATTR_OP_SET:
			ops[i].am_error = xfs_attrmulti_attr_set(vp,
			ops[i].am_error = xfs_attrmulti_attr_set(inode,
					attr_name, ops[i].am_attrvalue,
					ops[i].am_length, ops[i].am_flags);
			break;
		case ATTR_OP_REMOVE:
			ops[i].am_error = xfs_attrmulti_attr_remove(vp,
			ops[i].am_error = xfs_attrmulti_attr_remove(inode,
					attr_name, ops[i].am_flags);
			break;
		default:
@@ -1182,7 +1182,7 @@ xfs_ioc_xattr(
	case XFS_IOC_FSGETXATTR: {
		vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
				 XFS_AT_NEXTENTS | XFS_AT_PROJID;
		error = bhv_vop_getattr(vp, vattr, 0, NULL);
		error = xfs_getattr(ip, vattr, 0);
		if (unlikely(error)) {
			error = -error;
			break;
@@ -1215,7 +1215,7 @@ xfs_ioc_xattr(
		vattr->va_extsize = fa.fsx_extsize;
		vattr->va_projid  = fa.fsx_projid;

		error = bhv_vop_setattr(vp, vattr, attr_flags, NULL);
		error = xfs_setattr(ip, vattr, attr_flags, NULL);
		if (likely(!error))
			__vn_revalidate(vp, vattr);	/* update flags */
		error = -error;
@@ -1225,7 +1225,7 @@ xfs_ioc_xattr(
	case XFS_IOC_FSGETXATTRA: {
		vattr->va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
				 XFS_AT_ANEXTENTS | XFS_AT_PROJID;
		error = bhv_vop_getattr(vp, vattr, 0, NULL);
		error = xfs_getattr(ip, vattr, 0);
		if (unlikely(error)) {
			error = -error;
			break;
@@ -1271,7 +1271,7 @@ xfs_ioc_xattr(
		vattr->va_xflags = xfs_merge_ioc_xflags(flags,
							xfs_ip2xflags(ip));

		error = bhv_vop_setattr(vp, vattr, attr_flags, NULL);
		error = xfs_setattr(ip, vattr, attr_flags, NULL);
		if (likely(!error))
			__vn_revalidate(vp, vattr);	/* update flags */
		error = -error;
Loading