Skip to content

Commit

Permalink
[XFS] call common xfs vnode-level helpers directly and remove vnode o…
Browse files Browse the repository at this point in the history
…perations

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

Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
  • Loading branch information
Christoph Hellwig authored and Tim Shimmin committed Oct 16, 2007
1 parent 993386c commit 739bfb2
Show file tree
Hide file tree
Showing 27 changed files with 188 additions and 866 deletions.
1 change: 0 additions & 1 deletion fs/xfs/Makefile-linux-2.6
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 14 additions & 11 deletions fs/xfs/linux-2.6/xfs_aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}

Expand Down
8 changes: 5 additions & 3 deletions fs/xfs/linux-2.6/xfs_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, };

Expand Down Expand Up @@ -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);

Expand Down
49 changes: 21 additions & 28 deletions fs/xfs/linux-2.6/xfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -180,19 +176,15 @@ 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
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
Expand All @@ -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
Expand All @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit 739bfb2

Please sign in to comment.