aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@osandov.com>2015-03-16 07:33:51 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-11 22:29:44 -0400
commita95cd6311512bd954e88684eb39373f7f4b0a984 (patch)
tree88cb744c8ca017a9f53a337b3739c989273b98f6
parent17f8c842d24ac054e4212c82b5bd6ae455a334f3 (diff)
Remove rw from dax_{do_,}io()
And use iov_iter_rw() instead. Signed-off-by: Omar Sandoval <osandov@osandov.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/dax.c27
-rw-r--r--fs/ext2/inode.c4
-rw-r--r--fs/ext4/indirect.c4
-rw-r--r--fs/ext4/inode.c2
-rw-r--r--include/linux/fs.h4
5 files changed, 20 insertions, 21 deletions
diff --git a/fs/dax.c b/fs/dax.c
index ed1619ec6537..a27846946525 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -98,9 +98,9 @@ static bool buffer_size_valid(struct buffer_head *bh)
98 return bh->b_state != 0; 98 return bh->b_state != 0;
99} 99}
100 100
101static ssize_t dax_io(int rw, struct inode *inode, struct iov_iter *iter, 101static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
102 loff_t start, loff_t end, get_block_t get_block, 102 loff_t start, loff_t end, get_block_t get_block,
103 struct buffer_head *bh) 103 struct buffer_head *bh)
104{ 104{
105 ssize_t retval = 0; 105 ssize_t retval = 0;
106 loff_t pos = start; 106 loff_t pos = start;
@@ -109,7 +109,7 @@ static ssize_t dax_io(int rw, struct inode *inode, struct iov_iter *iter,
109 void *addr; 109 void *addr;
110 bool hole = false; 110 bool hole = false;
111 111
112 if (rw != WRITE) 112 if (iov_iter_rw(iter) != WRITE)
113 end = min(end, i_size_read(inode)); 113 end = min(end, i_size_read(inode));
114 114
115 while (pos < end) { 115 while (pos < end) {
@@ -124,7 +124,7 @@ static ssize_t dax_io(int rw, struct inode *inode, struct iov_iter *iter,
124 bh->b_size = PAGE_ALIGN(end - pos); 124 bh->b_size = PAGE_ALIGN(end - pos);
125 bh->b_state = 0; 125 bh->b_state = 0;
126 retval = get_block(inode, block, bh, 126 retval = get_block(inode, block, bh,
127 rw == WRITE); 127 iov_iter_rw(iter) == WRITE);
128 if (retval) 128 if (retval)
129 break; 129 break;
130 if (!buffer_size_valid(bh)) 130 if (!buffer_size_valid(bh))
@@ -137,7 +137,7 @@ static ssize_t dax_io(int rw, struct inode *inode, struct iov_iter *iter,
137 bh->b_size -= done; 137 bh->b_size -= done;
138 } 138 }
139 139
140 hole = (rw != WRITE) && !buffer_written(bh); 140 hole = iov_iter_rw(iter) != WRITE && !buffer_written(bh);
141 if (hole) { 141 if (hole) {
142 addr = NULL; 142 addr = NULL;
143 size = bh->b_size - first; 143 size = bh->b_size - first;
@@ -154,7 +154,7 @@ static ssize_t dax_io(int rw, struct inode *inode, struct iov_iter *iter,
154 max = min(pos + size, end); 154 max = min(pos + size, end);
155 } 155 }
156 156
157 if (rw == WRITE) 157 if (iov_iter_rw(iter) == WRITE)
158 len = copy_from_iter(addr, max - pos, iter); 158 len = copy_from_iter(addr, max - pos, iter);
159 else if (!hole) 159 else if (!hole)
160 len = copy_to_iter(addr, max - pos, iter); 160 len = copy_to_iter(addr, max - pos, iter);
@@ -173,7 +173,6 @@ static ssize_t dax_io(int rw, struct inode *inode, struct iov_iter *iter,
173 173
174/** 174/**
175 * dax_do_io - Perform I/O to a DAX file 175 * dax_do_io - Perform I/O to a DAX file
176 * @rw: READ to read or WRITE to write
177 * @iocb: The control block for this I/O 176 * @iocb: The control block for this I/O
178 * @inode: The file which the I/O is directed at 177 * @inode: The file which the I/O is directed at
179 * @iter: The addresses to do I/O from or to 178 * @iter: The addresses to do I/O from or to
@@ -189,9 +188,9 @@ static ssize_t dax_io(int rw, struct inode *inode, struct iov_iter *iter,
189 * As with do_blockdev_direct_IO(), we increment i_dio_count while the I/O 188 * As with do_blockdev_direct_IO(), we increment i_dio_count while the I/O
190 * is in progress. 189 * is in progress.
191 */ 190 */
192ssize_t dax_do_io(int rw, struct kiocb *iocb, struct inode *inode, 191ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode,
193 struct iov_iter *iter, loff_t pos, 192 struct iov_iter *iter, loff_t pos, get_block_t get_block,
194 get_block_t get_block, dio_iodone_t end_io, int flags) 193 dio_iodone_t end_io, int flags)
195{ 194{
196 struct buffer_head bh; 195 struct buffer_head bh;
197 ssize_t retval = -EINVAL; 196 ssize_t retval = -EINVAL;
@@ -199,7 +198,7 @@ ssize_t dax_do_io(int rw, struct kiocb *iocb, struct inode *inode,
199 198
200 memset(&bh, 0, sizeof(bh)); 199 memset(&bh, 0, sizeof(bh));
201 200
202 if ((flags & DIO_LOCKING) && (rw == READ)) { 201 if ((flags & DIO_LOCKING) && iov_iter_rw(iter) == READ) {
203 struct address_space *mapping = inode->i_mapping; 202 struct address_space *mapping = inode->i_mapping;
204 mutex_lock(&inode->i_mutex); 203 mutex_lock(&inode->i_mutex);
205 retval = filemap_write_and_wait_range(mapping, pos, end - 1); 204 retval = filemap_write_and_wait_range(mapping, pos, end - 1);
@@ -212,9 +211,9 @@ ssize_t dax_do_io(int rw, struct kiocb *iocb, struct inode *inode,
212 /* Protects against truncate */ 211 /* Protects against truncate */
213 atomic_inc(&inode->i_dio_count); 212 atomic_inc(&inode->i_dio_count);
214 213
215 retval = dax_io(rw, inode, iter, pos, end, get_block, &bh); 214 retval = dax_io(inode, iter, pos, end, get_block, &bh);
216 215
217 if ((flags & DIO_LOCKING) && (rw == READ)) 216 if ((flags & DIO_LOCKING) && iov_iter_rw(iter) == READ)
218 mutex_unlock(&inode->i_mutex); 217 mutex_unlock(&inode->i_mutex);
219 218
220 if ((retval > 0) && end_io) 219 if ((retval > 0) && end_io)
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 3cbeb1b63acf..14e8d1752685 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -861,8 +861,8 @@ ext2_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
861 ssize_t ret; 861 ssize_t ret;
862 862
863 if (IS_DAX(inode)) 863 if (IS_DAX(inode))
864 ret = dax_do_io(rw, iocb, inode, iter, offset, ext2_get_block, 864 ret = dax_do_io(iocb, inode, iter, offset, ext2_get_block, NULL,
865 NULL, DIO_LOCKING); 865 DIO_LOCKING);
866 else 866 else
867 ret = blockdev_direct_IO(iocb, inode, iter, offset, 867 ret = blockdev_direct_IO(iocb, inode, iter, offset,
868 ext2_get_block); 868 ext2_get_block);
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index ae4ffc27abc6..cd81d01da0b0 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -690,7 +690,7 @@ retry:
690 goto locked; 690 goto locked;
691 } 691 }
692 if (IS_DAX(inode)) 692 if (IS_DAX(inode))
693 ret = dax_do_io(rw, iocb, inode, iter, offset, 693 ret = dax_do_io(iocb, inode, iter, offset,
694 ext4_get_block, NULL, 0); 694 ext4_get_block, NULL, 0);
695 else 695 else
696 ret = __blockdev_direct_IO(iocb, inode, 696 ret = __blockdev_direct_IO(iocb, inode,
@@ -701,7 +701,7 @@ retry:
701 } else { 701 } else {
702locked: 702locked:
703 if (IS_DAX(inode)) 703 if (IS_DAX(inode))
704 ret = dax_do_io(rw, iocb, inode, iter, offset, 704 ret = dax_do_io(iocb, inode, iter, offset,
705 ext4_get_block, NULL, DIO_LOCKING); 705 ext4_get_block, NULL, DIO_LOCKING);
706 else 706 else
707 ret = blockdev_direct_IO(iocb, inode, iter, offset, 707 ret = blockdev_direct_IO(iocb, inode, iter, offset,
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index ec049c04b197..76b8cba5d041 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3034,7 +3034,7 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb,
3034 dio_flags = DIO_LOCKING; 3034 dio_flags = DIO_LOCKING;
3035 } 3035 }
3036 if (IS_DAX(inode)) 3036 if (IS_DAX(inode))
3037 ret = dax_do_io(rw, iocb, inode, iter, offset, get_block_func, 3037 ret = dax_do_io(iocb, inode, iter, offset, get_block_func,
3038 ext4_end_io_dio, dio_flags); 3038 ext4_end_io_dio, dio_flags);
3039 else 3039 else
3040 ret = __blockdev_direct_IO(iocb, inode, 3040 ret = __blockdev_direct_IO(iocb, inode,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index c67b6de8be33..295bc589fe1b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2609,8 +2609,8 @@ extern loff_t fixed_size_llseek(struct file *file, loff_t offset,
2609extern int generic_file_open(struct inode * inode, struct file * filp); 2609extern int generic_file_open(struct inode * inode, struct file * filp);
2610extern int nonseekable_open(struct inode * inode, struct file * filp); 2610extern int nonseekable_open(struct inode * inode, struct file * filp);
2611 2611
2612ssize_t dax_do_io(int rw, struct kiocb *, struct inode *, struct iov_iter *, 2612ssize_t dax_do_io(struct kiocb *, struct inode *, struct iov_iter *, loff_t,
2613 loff_t, get_block_t, dio_iodone_t, int flags); 2613 get_block_t, dio_iodone_t, int flags);
2614int dax_clear_blocks(struct inode *, sector_t block, long size); 2614int dax_clear_blocks(struct inode *, sector_t block, long size);
2615int dax_zero_page_range(struct inode *, loff_t from, unsigned len, get_block_t); 2615int dax_zero_page_range(struct inode *, loff_t from, unsigned len, get_block_t);
2616int dax_truncate_page(struct inode *, loff_t from, get_block_t); 2616int dax_truncate_page(struct inode *, loff_t from, get_block_t);