* Note: File extended attributes override any mount options.
*/
static ssize_t do_readv_writev(enum PVFS_io_type type, struct file *file,
- loff_t *offset, const struct iovec *iov, unsigned long nr_segs)
+ loff_t *offset, struct iov_iter *iter)
{
struct inode *inode = file->f_mapping->host;
struct pvfs2_inode_s *pvfs2_inode = PVFS2_I(inode);
struct pvfs2_khandle *handle = &pvfs2_inode->refn.khandle;
- struct iov_iter iter;
- size_t count = iov_length(iov, nr_segs);
+ size_t count = iov_iter_count(iter);
ssize_t total_count = 0;
ssize_t ret = -EINVAL;
goto out;
}
- iov_iter_init(&iter, type == PVFS_IO_READ ? READ : WRITE,
- iov, nr_segs, count);
-
- while (total_count < count) {
- size_t each_count;
+ while (iov_iter_count(iter)) {
+ size_t each_count = iov_iter_count(iter);
size_t amt_complete;
/* how much to transfer in this loop iteration */
- each_count =
- (((count - total_count) > pvfs_bufmap_size_query()) ?
- pvfs_bufmap_size_query() :
- (count - total_count));
+ if (each_count > pvfs_bufmap_size_query())
+ each_count = pvfs_bufmap_size_query();
gossip_debug(GOSSIP_FILE_DEBUG,
"%s(%pU): size of each_count(%d)\n",
handle,
(int)*offset);
- ret = wait_for_direct_io(type, inode, offset, &iter,
+ ret = wait_for_direct_io(type, inode, offset, iter,
each_count, 0);
gossip_debug(GOSSIP_FILE_DEBUG,
"%s(%pU): return from wait_for_io:%d\n",
struct file *file = iocb->ki_filp;
loff_t pos = *(&iocb->ki_pos);
ssize_t rc = 0;
- unsigned long nr_segs = iter->nr_segs;
BUG_ON(iocb->private);
g_pvfs2_stats.reads++;
- rc = do_readv_writev(PVFS_IO_READ,
- file,
- &pos,
- iter->iov,
- nr_segs);
+ rc = do_readv_writev(PVFS_IO_READ, file, &pos, iter);
iocb->ki_pos = pos;
return rc;
{
struct file *file = iocb->ki_filp;
loff_t pos = *(&iocb->ki_pos);
- unsigned long nr_segs = iter->nr_segs;
ssize_t rc;
BUG_ON(iocb->private);
rc = do_readv_writev(PVFS_IO_WRITE,
file,
&pos,
- iter->iov,
- nr_segs);
+ iter);
if (rc < 0) {
gossip_err("%s: do_readv_writev failed, rc:%zd:.\n",
__func__, rc);