From 44170b30dc08213c3016b6574aee83a0b07acc0c Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Sat, 20 Dec 2014 03:49:23 +0000 Subject: [PATCH] scst_vdisk: Remove superfluous llseek() calls vfs_read() and vfs_write() ignore the file offset set by llseek(). Hence remove the llseek() calls that occur just before vfs_read() and vfs_write(). See also the implementation in the Linux kernel of the pread64() and pwrite64() system calls for examples of code that uses vfs_read() and vfs_write(). Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5942 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 55b19ded0..ca73d4aa9 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -5718,17 +5718,7 @@ static ssize_t fileio_read_sync(struct file *fd, void *buf, size_t len, old_fs = get_fs(); set_fs(get_ds()); - - if (fd->f_op->llseek) - ret = fd->f_op->llseek(fd, *loff, 0/*SEEK_SET*/); - else - ret = default_llseek(fd, *loff, 0/*SEEK_SET*/); - if (ret < 0) - goto out; - ret = vfs_read(fd, (char __force __user *)buf, len, loff); - -out: set_fs(old_fs); return ret; @@ -5743,17 +5733,7 @@ static ssize_t fileio_write_sync(struct file *fd, void *buf, size_t len, old_fs = get_fs(); set_fs(get_ds()); - - if (fd->f_op->llseek) - ret = fd->f_op->llseek(fd, *loff, 0/*SEEK_SET*/); - else - ret = default_llseek(fd, *loff, 0/*SEEK_SET*/); - if (ret < 0) - goto out; - ret = vfs_write(fd, (char __force __user *)buf, len, loff); - -out: set_fs(old_fs); return ret;