Commit bda2c3b1 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Nathan Scott

[XFS] use ssize_t to store VOP_READ/VOP_WRITE return value.

SGI Modid: xfs-linux:xfs-kern:168167a
parent c05e3944
...@@ -68,16 +68,15 @@ __linvfs_read( ...@@ -68,16 +68,15 @@ __linvfs_read(
{ {
struct iovec iov = {buf, count}; struct iovec iov = {buf, count};
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
vnode_t *vp; vnode_t *vp = LINVFS_GET_VP(file->f_dentry->d_inode);
int error; ssize_t rval;
BUG_ON(iocb->ki_pos != pos); BUG_ON(iocb->ki_pos != pos);
if (unlikely(file->f_flags & O_DIRECT)) if (unlikely(file->f_flags & O_DIRECT))
ioflags |= IO_ISDIRECT; ioflags |= IO_ISDIRECT;
vp = LINVFS_GET_VP(file->f_dentry->d_inode); VOP_READ(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval);
VOP_READ(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, error); return rval;
return error;
} }
...@@ -114,20 +113,21 @@ __linvfs_write( ...@@ -114,20 +113,21 @@ __linvfs_write(
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host; struct inode *inode = file->f_mapping->host;
vnode_t *vp = LINVFS_GET_VP(inode); vnode_t *vp = LINVFS_GET_VP(inode);
int error; ssize_t rval;
BUG_ON(iocb->ki_pos != pos); BUG_ON(iocb->ki_pos != pos);
if (unlikely(file->f_flags & O_DIRECT)) { if (unlikely(file->f_flags & O_DIRECT)) {
ioflags |= IO_ISDIRECT; ioflags |= IO_ISDIRECT;
VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos, VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos,
ioflags, NULL, error); ioflags, NULL, rval);
} else { } else {
down(&inode->i_sem); down(&inode->i_sem);
VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos, VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos,
ioflags, NULL, error); ioflags, NULL, rval);
up(&inode->i_sem); up(&inode->i_sem);
} }
return error;
return rval;
} }
...@@ -163,19 +163,19 @@ __linvfs_readv( ...@@ -163,19 +163,19 @@ __linvfs_readv(
struct inode *inode = file->f_mapping->host; struct inode *inode = file->f_mapping->host;
vnode_t *vp = LINVFS_GET_VP(inode); vnode_t *vp = LINVFS_GET_VP(inode);
struct kiocb kiocb; struct kiocb kiocb;
int error; ssize_t rval;
init_sync_kiocb(&kiocb, file); init_sync_kiocb(&kiocb, file);
kiocb.ki_pos = *ppos; kiocb.ki_pos = *ppos;
if (unlikely(file->f_flags & O_DIRECT)) if (unlikely(file->f_flags & O_DIRECT))
ioflags |= IO_ISDIRECT; ioflags |= IO_ISDIRECT;
VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, error); VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval);
if (-EIOCBQUEUED == error) if (rval == -EIOCBQUEUED)
error = wait_on_sync_kiocb(&kiocb); rval = wait_on_sync_kiocb(&kiocb);
*ppos = kiocb.ki_pos;
return error; *ppos = kiocb.ki_pos;
return rval;
} }
STATIC ssize_t STATIC ssize_t
...@@ -210,25 +210,26 @@ __linvfs_writev( ...@@ -210,25 +210,26 @@ __linvfs_writev(
struct inode *inode = file->f_mapping->host; struct inode *inode = file->f_mapping->host;
vnode_t *vp = LINVFS_GET_VP(inode); vnode_t *vp = LINVFS_GET_VP(inode);
struct kiocb kiocb; struct kiocb kiocb;
int error; ssize_t rval;
init_sync_kiocb(&kiocb, file); init_sync_kiocb(&kiocb, file);
kiocb.ki_pos = *ppos; kiocb.ki_pos = *ppos;
if (unlikely(file->f_flags & O_DIRECT)) { if (unlikely(file->f_flags & O_DIRECT)) {
ioflags |= IO_ISDIRECT; ioflags |= IO_ISDIRECT;
VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos,
ioflags, NULL, error); ioflags, NULL, rval);
} else { } else {
down(&inode->i_sem); down(&inode->i_sem);
VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos,
ioflags, NULL, error); ioflags, NULL, rval);
up(&inode->i_sem); up(&inode->i_sem);
} }
if (-EIOCBQUEUED == error)
error = wait_on_sync_kiocb(&kiocb);
*ppos = kiocb.ki_pos;
return error; if (rval == -EIOCBQUEUED)
rval = wait_on_sync_kiocb(&kiocb);
*ppos = kiocb.ki_pos;
return rval;
} }
......
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