Skip to content

Commit

Permalink
Merge git://oss.sgi.com:8090/oss/git/xfs-2.6
Browse files Browse the repository at this point in the history
* git://oss.sgi.com:8090/oss/git/xfs-2.6:
  [XFS] Provide XFS support for the splice syscall.
  [XFS] Reenable write barriers by default.
  [XFS] Make project quota enforcement return an error code consistent with
  [XFS] Implement the silent parameter to fill_super, previously ignored.
  [XFS] Cleanup comment to remove reference to obsoleted function
  • Loading branch information
Linus Torvalds committed Apr 2, 2006
2 parents f27f0a0 + 1b89584 commit a2308b7
Show file tree
Hide file tree
Showing 17 changed files with 309 additions and 163 deletions.
113 changes: 80 additions & 33 deletions fs/xfs/linux-2.6/xfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ __xfs_file_read(
return rval;
}


STATIC ssize_t
xfs_file_aio_read(
struct kiocb *iocb,
Expand All @@ -90,7 +89,6 @@ xfs_file_aio_read_invis(
return __xfs_file_read(iocb, buf, IO_ISAIO|IO_INVIS, count, pos);
}


STATIC inline ssize_t
__xfs_file_write(
struct kiocb *iocb,
Expand All @@ -113,7 +111,6 @@ __xfs_file_write(
return rval;
}


STATIC ssize_t
xfs_file_aio_write(
struct kiocb *iocb,
Expand All @@ -134,7 +131,6 @@ xfs_file_aio_write_invis(
return __xfs_file_write(iocb, buf, IO_ISAIO|IO_INVIS, count, pos);
}


STATIC inline ssize_t
__xfs_file_readv(
struct file *file,
Expand Down Expand Up @@ -179,7 +175,6 @@ xfs_file_readv_invis(
return __xfs_file_readv(file, iov, IO_INVIS, nr_segs, ppos);
}


STATIC inline ssize_t
__xfs_file_writev(
struct file *file,
Expand All @@ -204,7 +199,6 @@ __xfs_file_writev(
return rval;
}


STATIC ssize_t
xfs_file_writev(
struct file *file,
Expand All @@ -228,18 +222,88 @@ xfs_file_writev_invis(
STATIC ssize_t
xfs_file_sendfile(
struct file *filp,
loff_t *ppos,
loff_t *pos,
size_t count,
read_actor_t actor,
void *target)
{
vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
ssize_t rval;

VOP_SENDFILE(vp, filp, ppos, 0, count, actor, target, NULL, rval);
VOP_SENDFILE(vp, filp, pos, 0, count, actor, target, NULL, rval);
return rval;
}

STATIC ssize_t
xfs_file_sendfile_invis(
struct file *filp,
loff_t *pos,
size_t count,
read_actor_t actor,
void *target)
{
vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
ssize_t rval;

VOP_SENDFILE(vp, filp, pos, IO_INVIS, count, actor, target, NULL, rval);
return rval;
}

STATIC ssize_t
xfs_file_splice_read(
struct file *infilp,
struct inode *pipe,
size_t len,
unsigned int flags)
{
vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode);
ssize_t rval;

VOP_SPLICE_READ(vp, infilp, pipe, len, flags, 0, NULL, rval);
return rval;
}

STATIC ssize_t
xfs_file_splice_read_invis(
struct file *infilp,
struct inode *pipe,
size_t len,
unsigned int flags)
{
vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode);
ssize_t rval;

VOP_SPLICE_READ(vp, infilp, pipe, len, flags, IO_INVIS, NULL, rval);
return rval;
}

STATIC ssize_t
xfs_file_splice_write(
struct inode *pipe,
struct file *outfilp,
size_t len,
unsigned int flags)
{
vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode);
ssize_t rval;

VOP_SPLICE_WRITE(vp, pipe, outfilp, len, flags, 0, NULL, rval);
return rval;
}

STATIC ssize_t
xfs_file_splice_write_invis(
struct inode *pipe,
struct file *outfilp,
size_t len,
unsigned int flags)
{
vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode);
ssize_t rval;

VOP_SPLICE_WRITE(vp, pipe, outfilp, len, flags, IO_INVIS, NULL, rval);
return rval;
}

STATIC int
xfs_file_open(
Expand All @@ -251,13 +315,10 @@ xfs_file_open(

if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
return -EFBIG;

ASSERT(vp);
VOP_OPEN(vp, NULL, error);
return -error;
}


STATIC int
xfs_file_release(
struct inode *inode,
Expand All @@ -271,7 +332,6 @@ xfs_file_release(
return -error;
}


STATIC int
xfs_file_fsync(
struct file *filp,
Expand All @@ -285,21 +345,11 @@ xfs_file_fsync(

if (datasync)
flags |= FSYNC_DATA;

ASSERT(vp);
VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error);
return -error;
}

/*
* xfs_file_readdir maps to VOP_READDIR().
* We need to build a uio, cred, ...
*/

#define nextdp(dp) ((struct xfs_dirent *)((char *)(dp) + (dp)->d_reclen))

#ifdef CONFIG_XFS_DMAPI

STATIC struct page *
xfs_vm_nopage(
struct vm_area_struct *area,
Expand All @@ -319,18 +369,16 @@ xfs_vm_nopage(

return filemap_nopage(area, address, type);
}

#endif /* CONFIG_XFS_DMAPI */


STATIC int
xfs_file_readdir(
struct file *filp,
void *dirent,
filldir_t filldir)
{
int error = 0;
vnode_t *vp;
vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
uio_t uio;
iovec_t iov;
int eof = 0;
Expand All @@ -340,9 +388,6 @@ xfs_file_readdir(
xfs_off_t start_offset, curr_offset;
xfs_dirent_t *dbp = NULL;

vp = vn_from_inode(filp->f_dentry->d_inode);
ASSERT(vp);

/* Try fairly hard to get memory */
do {
if ((read_buf = (caddr_t)kmalloc(rlen, GFP_KERNEL)))
Expand Down Expand Up @@ -387,7 +432,7 @@ xfs_file_readdir(
}
size -= dbp->d_reclen;
curr_offset = (loff_t)dbp->d_off /* & 0x7fffffff */;
dbp = nextdp(dbp);
dbp = (xfs_dirent_t *)((char *)dbp + dbp->d_reclen);
}
}
done:
Expand All @@ -402,7 +447,6 @@ xfs_file_readdir(
return -error;
}


STATIC int
xfs_file_mmap(
struct file *filp,
Expand Down Expand Up @@ -457,11 +501,10 @@ xfs_file_ioctl_invis(
unsigned int cmd,
unsigned long arg)
{
int error;
struct inode *inode = filp->f_dentry->d_inode;
vnode_t *vp = vn_from_inode(inode);
int error;

ASSERT(vp);
VOP_IOCTL(vp, inode, filp, IO_INVIS, cmd, (void __user *)arg, error);
VMODIFY(vp);

Expand Down Expand Up @@ -537,6 +580,8 @@ const struct file_operations xfs_file_operations = {
.aio_read = xfs_file_aio_read,
.aio_write = xfs_file_aio_write,
.sendfile = xfs_file_sendfile,
.splice_read = xfs_file_splice_read,
.splice_write = xfs_file_splice_write,
.unlocked_ioctl = xfs_file_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = xfs_file_compat_ioctl,
Expand All @@ -558,7 +603,9 @@ const struct file_operations xfs_invis_file_operations = {
.writev = xfs_file_writev_invis,
.aio_read = xfs_file_aio_read_invis,
.aio_write = xfs_file_aio_write_invis,
.sendfile = xfs_file_sendfile,
.sendfile = xfs_file_sendfile_invis,
.splice_read = xfs_file_splice_read_invis,
.splice_write = xfs_file_splice_write_invis,
.unlocked_ioctl = xfs_file_ioctl_invis,
#ifdef CONFIG_COMPAT
.compat_ioctl = xfs_file_compat_invis_ioctl,
Expand Down
1 change: 1 addition & 0 deletions fs/xfs/linux-2.6/xfs_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
*/
#undef HAVE_REFCACHE /* reference cache not needed for NFS in 2.6 */
#define HAVE_SENDFILE /* sendfile(2) exists in 2.6, but not in 2.4 */
#define HAVE_SPLICE /* a splice(2) exists in 2.6, but not in 2.4 */
#ifdef CONFIG_SMP
#define HAVE_PERCPU_SB /* per cpu superblock counters are a 2.6 feature */
#else
Expand Down
Loading

0 comments on commit a2308b7

Please sign in to comment.