mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-28 09:20:18 +00:00
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 <bvanassche@acm.org> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5942 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user