summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-03-06 00:28:09 (GMT)
committerPaul Osmialowski <p.osmialowsk@samsung.com>2015-04-15 15:45:08 (GMT)
commit4f915f7abf5def01083060fb598ad11de4a712f5 (patch)
tree81aa9565136fc8e978be8c69a33ca62e5f608cac
parent729fb056c731aa17583b04829bd791c42ef99310 (diff)
downloadlinux-3.10-4f915f7abf5def01083060fb598ad11de4a712f5.zip
linux-3.10-4f915f7abf5def01083060fb598ad11de4a712f5.tar.gz
linux-3.10-4f915f7abf5def01083060fb598ad11de4a712f5.tar.bz2
start adding the tag to iov_iter
For now, just use the same thing we pass to ->direct_IO() - it's all iovec-based at the moment. Pass it explicitly to iov_iter_init() and account for kvec vs. iovec in there, by the same kludge NFS ->direct_IO() uses. Change-Id: I8187badd197af34d2d9428b0082b14262dce2b78 Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/btrfs/file.c4
-rw-r--r--fs/cifs/file.c4
-rw-r--r--fs/fuse/file.c8
-rw-r--r--include/linux/fs.h18
-rw-r--r--mm/filemap.c2
5 files changed, 26 insertions, 10 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 4205ba7..8eab415 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1468,7 +1468,7 @@ static ssize_t __btrfs_direct_write(struct kiocb *iocb,
pos += written;
count -= written;
- iov_iter_init(&i, iov, nr_segs, count, written);
+ __iov_iter_init(&i, iov, nr_segs, count, written);
written_buffered = __btrfs_buffered_write(file, &i, pos);
if (written_buffered < 0) {
err = written_buffered;
@@ -1583,7 +1583,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
} else {
struct iov_iter i;
- iov_iter_init(&i, iov, nr_segs, count, num_written);
+ __iov_iter_init(&i, iov, nr_segs, count, num_written);
num_written = __btrfs_buffered_write(file, &i, pos);
if (num_written > 0)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 5fcc10f..c3b4159 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2388,7 +2388,7 @@ cifs_iovec_write(struct file *file, const struct iovec *iov,
else
pid = current->tgid;
- iov_iter_init(&it, iov, nr_segs, len, 0);
+ __iov_iter_init(&it, iov, nr_segs, len, 0);
do {
size_t save_len;
@@ -2723,7 +2723,7 @@ cifs_readdata_to_iov(struct cifs_readdata *rdata, const struct iovec *iov,
unsigned int i;
/* set up iov_iter and advance to the correct offset */
- iov_iter_init(&ii, iov, nr_segs, iov_length(iov, nr_segs), 0);
+ __iov_iter_init(&ii, iov, nr_segs, iov_length(iov, nr_segs), 0);
iov_iter_advance(&ii, pos);
*copied = 0;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 4fafb84..be8bfae 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1137,7 +1137,7 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
pos += written;
count -= written;
- iov_iter_init(&i, iov, nr_segs, count, written);
+ __iov_iter_init(&i, iov, nr_segs, count, written);
written_buffered = fuse_perform_write(file, mapping, &i, pos);
if (written_buffered < 0) {
err = written_buffered;
@@ -1157,7 +1157,7 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
written += written_buffered;
iocb->ki_pos = pos + written_buffered;
} else {
- iov_iter_init(&i, iov, nr_segs, count, 0);
+ __iov_iter_init(&i, iov, nr_segs, count, 0);
written = fuse_perform_write(file, mapping, &i, pos);
if (written >= 0)
iocb->ki_pos = pos + written;
@@ -1283,7 +1283,7 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, const struct iovec *iov,
struct fuse_req *req;
struct iov_iter ii;
- iov_iter_init(&ii, iov, nr_segs, count, 0);
+ __iov_iter_init(&ii, iov, nr_segs, count, 0);
if (io->async)
req = fuse_get_req_for_background(fc, fuse_iter_npages(&ii));
@@ -1864,7 +1864,7 @@ static int fuse_ioctl_copy_user(struct page **pages, struct iovec *iov,
if (!bytes)
return 0;
- iov_iter_init(&ii, iov, nr_segs, bytes, 0);
+ __iov_iter_init(&ii, iov, nr_segs, bytes, 0);
while (iov_iter_count(&ii)) {
struct page *page = pages[page_idx++];
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 358abc0..bc37b65 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -27,6 +27,7 @@
#include <linux/lockdep.h>
#include <linux/percpu-rwsem.h>
#include <linux/blk_types.h>
+#include <linux/uaccess.h>
#include <asm/byteorder.h>
#include <uapi/linux/fs.h>
@@ -290,6 +291,7 @@ struct writeback_control;
struct iov_iter;
struct iov_iter {
+ int type;
const struct iovec *iov;
unsigned long nr_segs;
size_t iov_offset;
@@ -304,7 +306,7 @@ void iov_iter_advance(struct iov_iter *i, size_t bytes);
int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
size_t iov_iter_single_seg_count(const struct iov_iter *i);
-static inline void iov_iter_init(struct iov_iter *i,
+static inline void __iov_iter_init(struct iov_iter *i,
const struct iovec *iov, unsigned long nr_segs,
size_t count, size_t written)
{
@@ -316,6 +318,20 @@ static inline void iov_iter_init(struct iov_iter *i,
iov_iter_advance(i, written);
}
+static inline void iov_iter_init(struct iov_iter *i, int direction,
+ const struct iovec *iov, unsigned long nr_segs,
+ size_t count)
+{
+ /* It will get better. Eventually... */
+ if (segment_eq(get_fs(), KERNEL_DS))
+ direction |= REQ_KERNEL;
+ i->type = direction;
+ i->iov = iov;
+ i->nr_segs = nr_segs;
+ i->iov_offset = 0;
+ i->count = count;
+}
+
static inline size_t iov_iter_count(struct iov_iter *i)
{
return i->count;
diff --git a/mm/filemap.c b/mm/filemap.c
index 7905fe7..4a87248 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2398,7 +2398,7 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
ssize_t status;
struct iov_iter i;
- iov_iter_init(&i, iov, nr_segs, count, written);
+ __iov_iter_init(&i, iov, nr_segs, count, written);
status = generic_perform_write(file, &i, pos);
if (likely(status >= 0)) {