diff mbox series

[RFC,06/11] iov_iter: Use op_is_write() rather than iterator direction

Message ID 20230630152524.661208-7-dhowells@redhat.com (mailing list archive)
State New
Headers show
Series iov_iter: Use I/O direction from kiocb, iomap & request rather than iov_iter | expand

Commit Message

David Howells June 30, 2023, 3:25 p.m. UTC
If a request struct is available, use op_is_write() instead of the iterator
direction.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Christoph Hellwig <hch@lst.de>
cc: Jens Axboe <axboe@kernel.dk>
cc: Christian Brauner <christian@brauner.io>
cc: Alexander Viro <viro@zeniv.linux.org.uk>
cc: linux-block@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
---
 block/blk-map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig July 6, 2023, 3:30 p.m. UTC | #1
On Fri, Jun 30, 2023 at 04:25:19PM +0100, David Howells wrote:
> If a request struct is available, use op_is_write() instead of the iterator
> direction.

s/iov_iter/block/ in the subject.
diff mbox series

Patch

diff --git a/block/blk-map.c b/block/blk-map.c
index 44d74a30ddac..f8fe114ae433 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -205,7 +205,7 @@  static int bio_copy_user_iov(struct request *rq, struct rq_map_data *map_data,
 	/*
 	 * success
 	 */
-	if ((iov_iter_rw(iter) == WRITE &&
+	if ((op_is_write(rq->cmd_flags) &&
 	     (!map_data || !map_data->null_mapped)) ||
 	    (map_data && map_data->from_user)) {
 		ret = bio_copy_from_iter(bio, iter);