|
@@ -2830,32 +2830,25 @@ cifs_uncached_read_into_pages(struct TCP_Server_Info *server,
|
|
return total_read > 0 ? total_read : result;
|
|
return total_read > 0 ? total_read : result;
|
|
}
|
|
}
|
|
|
|
|
|
-ssize_t cifs_user_readv(struct kiocb *iocb, const struct iovec *iov,
|
|
|
|
- unsigned long nr_segs, loff_t pos)
|
|
|
|
|
|
+ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to)
|
|
{
|
|
{
|
|
struct file *file = iocb->ki_filp;
|
|
struct file *file = iocb->ki_filp;
|
|
ssize_t rc;
|
|
ssize_t rc;
|
|
size_t len, cur_len;
|
|
size_t len, cur_len;
|
|
ssize_t total_read = 0;
|
|
ssize_t total_read = 0;
|
|
- loff_t offset = pos;
|
|
|
|
|
|
+ loff_t offset = iocb->ki_pos;
|
|
unsigned int npages;
|
|
unsigned int npages;
|
|
struct cifs_sb_info *cifs_sb;
|
|
struct cifs_sb_info *cifs_sb;
|
|
struct cifs_tcon *tcon;
|
|
struct cifs_tcon *tcon;
|
|
struct cifsFileInfo *open_file;
|
|
struct cifsFileInfo *open_file;
|
|
struct cifs_readdata *rdata, *tmp;
|
|
struct cifs_readdata *rdata, *tmp;
|
|
struct list_head rdata_list;
|
|
struct list_head rdata_list;
|
|
- struct iov_iter to;
|
|
|
|
pid_t pid;
|
|
pid_t pid;
|
|
|
|
|
|
- if (!nr_segs)
|
|
|
|
- return 0;
|
|
|
|
-
|
|
|
|
- len = iov_length(iov, nr_segs);
|
|
|
|
|
|
+ len = iov_iter_count(to);
|
|
if (!len)
|
|
if (!len)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
- iov_iter_init(&to, READ, iov, nr_segs, len);
|
|
|
|
-
|
|
|
|
INIT_LIST_HEAD(&rdata_list);
|
|
INIT_LIST_HEAD(&rdata_list);
|
|
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
|
|
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
|
|
open_file = file->private_data;
|
|
open_file = file->private_data;
|
|
@@ -2913,7 +2906,7 @@ error:
|
|
if (!list_empty(&rdata_list))
|
|
if (!list_empty(&rdata_list))
|
|
rc = 0;
|
|
rc = 0;
|
|
|
|
|
|
- len = iov_iter_count(&to);
|
|
|
|
|
|
+ len = iov_iter_count(to);
|
|
/* the loop below should proceed in the order of increasing offsets */
|
|
/* the loop below should proceed in the order of increasing offsets */
|
|
list_for_each_entry_safe(rdata, tmp, &rdata_list, list) {
|
|
list_for_each_entry_safe(rdata, tmp, &rdata_list, list) {
|
|
again:
|
|
again:
|
|
@@ -2930,7 +2923,7 @@ error:
|
|
goto again;
|
|
goto again;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- rc = cifs_readdata_to_iov(rdata, &to);
|
|
|
|
|
|
+ rc = cifs_readdata_to_iov(rdata, to);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -2938,7 +2931,7 @@ error:
|
|
kref_put(&rdata->refcount, cifs_uncached_readdata_release);
|
|
kref_put(&rdata->refcount, cifs_uncached_readdata_release);
|
|
}
|
|
}
|
|
|
|
|
|
- total_read = len - iov_iter_count(&to);
|
|
|
|
|
|
+ total_read = len - iov_iter_count(to);
|
|
|
|
|
|
cifs_stats_bytes_read(tcon, total_read);
|
|
cifs_stats_bytes_read(tcon, total_read);
|
|
|
|
|
|
@@ -2947,15 +2940,14 @@ error:
|
|
rc = 0;
|
|
rc = 0;
|
|
|
|
|
|
if (total_read) {
|
|
if (total_read) {
|
|
- iocb->ki_pos = pos + total_read;
|
|
|
|
|
|
+ iocb->ki_pos += total_read;
|
|
return total_read;
|
|
return total_read;
|
|
}
|
|
}
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|
|
ssize_t
|
|
ssize_t
|
|
-cifs_strict_readv(struct kiocb *iocb, const struct iovec *iov,
|
|
|
|
- unsigned long nr_segs, loff_t pos)
|
|
|
|
|
|
+cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to)
|
|
{
|
|
{
|
|
struct inode *inode = file_inode(iocb->ki_filp);
|
|
struct inode *inode = file_inode(iocb->ki_filp);
|
|
struct cifsInodeInfo *cinode = CIFS_I(inode);
|
|
struct cifsInodeInfo *cinode = CIFS_I(inode);
|
|
@@ -2974,22 +2966,22 @@ cifs_strict_readv(struct kiocb *iocb, const struct iovec *iov,
|
|
* pos+len-1.
|
|
* pos+len-1.
|
|
*/
|
|
*/
|
|
if (!CIFS_CACHE_READ(cinode))
|
|
if (!CIFS_CACHE_READ(cinode))
|
|
- return cifs_user_readv(iocb, iov, nr_segs, pos);
|
|
|
|
|
|
+ return cifs_user_readv(iocb, to);
|
|
|
|
|
|
if (cap_unix(tcon->ses) &&
|
|
if (cap_unix(tcon->ses) &&
|
|
(CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
|
|
(CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
|
|
((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0))
|
|
((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0))
|
|
- return generic_file_aio_read(iocb, iov, nr_segs, pos);
|
|
|
|
|
|
+ return generic_file_read_iter(iocb, to);
|
|
|
|
|
|
/*
|
|
/*
|
|
* We need to hold the sem to be sure nobody modifies lock list
|
|
* We need to hold the sem to be sure nobody modifies lock list
|
|
* with a brlock that prevents reading.
|
|
* with a brlock that prevents reading.
|
|
*/
|
|
*/
|
|
down_read(&cinode->lock_sem);
|
|
down_read(&cinode->lock_sem);
|
|
- if (!cifs_find_lock_conflict(cfile, pos, iov_length(iov, nr_segs),
|
|
|
|
|
|
+ if (!cifs_find_lock_conflict(cfile, iocb->ki_pos, iov_iter_count(to),
|
|
tcon->ses->server->vals->shared_lock_type,
|
|
tcon->ses->server->vals->shared_lock_type,
|
|
NULL, CIFS_READ_OP))
|
|
NULL, CIFS_READ_OP))
|
|
- rc = generic_file_aio_read(iocb, iov, nr_segs, pos);
|
|
|
|
|
|
+ rc = generic_file_read_iter(iocb, to);
|
|
up_read(&cinode->lock_sem);
|
|
up_read(&cinode->lock_sem);
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|