summaryrefslogtreecommitdiff
path: root/drivers/staging/lustre/lustre/llite/vvp_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/lustre/lustre/llite/vvp_io.c')
-rw-r--r--drivers/staging/lustre/lustre/llite/vvp_io.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c
index 93cbfbb7e7f7..c7d70091246e 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_io.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_io.c
@@ -51,7 +51,7 @@ static struct vvp_io *cl2vvp_io(const struct lu_env *env,
const struct cl_io_slice *slice);
/**
- * True, if \a io is a normal io, False for sendfile() / splice_{read|write}
+ * True, if \a io is a normal io, False for splice_{read,write}
*/
int cl_is_normalio(const struct lu_env *env, const struct cl_io *io)
{
@@ -474,20 +474,6 @@ static void vvp_io_setattr_fini(const struct lu_env *env,
vvp_io_fini(env, ios);
}
-static ssize_t lustre_generic_file_read(struct file *file,
- struct ccc_io *vio, loff_t *ppos)
-{
- return generic_file_aio_read(vio->cui_iocb, vio->cui_iov,
- vio->cui_nrsegs, *ppos);
-}
-
-static ssize_t lustre_generic_file_write(struct file *file,
- struct ccc_io *vio, loff_t *ppos)
-{
- return generic_file_aio_write(vio->cui_iocb, vio->cui_iov,
- vio->cui_nrsegs, *ppos);
-}
-
static int vvp_io_read_start(const struct lu_env *env,
const struct cl_io_slice *ios)
{
@@ -540,8 +526,11 @@ static int vvp_io_read_start(const struct lu_env *env,
file_accessed(file);
switch (vio->cui_io_subtype) {
case IO_NORMAL:
- result = lustre_generic_file_read(file, cio, &pos);
- break;
+ LASSERT(cio->cui_iocb->ki_pos == pos);
+ result = generic_file_aio_read(cio->cui_iocb,
+ cio->cui_iov, cio->cui_nrsegs,
+ cio->cui_iocb->ki_pos);
+ break;
case IO_SPLICE:
result = generic_file_splice_read(file, &pos,
vio->u.splice.cui_pipe, cnt,
@@ -586,7 +575,6 @@ static int vvp_io_write_start(const struct lu_env *env,
struct cl_io *io = ios->cis_io;
struct cl_object *obj = io->ci_obj;
struct inode *inode = ccc_object_inode(obj);
- struct file *file = cio->cui_fd->fd_file;
ssize_t result = 0;
loff_t pos = io->u.ci_wr.wr.crw_pos;
size_t cnt = io->u.ci_wr.wr.crw_count;
@@ -601,6 +589,8 @@ static int vvp_io_write_start(const struct lu_env *env,
*/
pos = io->u.ci_wr.wr.crw_pos = i_size_read(inode);
cio->cui_iocb->ki_pos = pos;
+ } else {
+ LASSERT(cio->cui_iocb->ki_pos == pos);
}
CDEBUG(D_VFSTRACE, "write: [%lli, %lli)\n", pos, pos + (long long)cnt);
@@ -608,8 +598,9 @@ static int vvp_io_write_start(const struct lu_env *env,
if (cio->cui_iov == NULL) /* from a temp io in ll_cl_init(). */
result = 0;
else
- result = lustre_generic_file_write(file, cio, &pos);
-
+ result = generic_file_aio_write(cio->cui_iocb,
+ cio->cui_iov, cio->cui_nrsegs,
+ cio->cui_iocb->ki_pos);
if (result > 0) {
if (result < cnt)
io->ci_continue = 0;
@@ -655,7 +646,7 @@ static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
if (cfio->fault.ft_flags & VM_FAULT_RETRY)
return -EAGAIN;
- CERROR("unknow error in page fault %d!\n", cfio->fault.ft_flags);
+ CERROR("Unknown error in page fault %d!\n", cfio->fault.ft_flags);
return -EINVAL;
}
@@ -1201,7 +1192,7 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj,
if (result == -ENOENT)
/* If the inode on MDS has been removed, but the objects
* on OSTs haven't been destroyed (async unlink), layout
- * fetch will return -ENOENT, we'd ingore this error
+ * fetch will return -ENOENT, we'd ignore this error
* and continue with dirty flush. LU-3230. */
result = 0;
if (result < 0)
@@ -1216,7 +1207,7 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj,
static struct vvp_io *cl2vvp_io(const struct lu_env *env,
const struct cl_io_slice *slice)
{
- /* Caling just for assertion */
+ /* Calling just for assertion */
cl2ccc_io(env, slice);
return vvp_env_io(env);
}