direct_read.c (a23e1966932464e1c5226cb9ac4ce1d5fc10ba22) direct_read.c (a9d47a50cf257ff1019a4e30d573777882fd785c)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* Direct I/O support.
3 *
4 * Copyright (C) 2023 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#include <linux/export.h>

--- 12 unchanged lines hidden (view full) ---

21 * @iocb: The I/O control descriptor describing the read
22 * @iter: The output buffer (also specifies read length)
23 *
24 * Perform an unbuffered I/O or direct I/O from the file in @iocb to the
25 * output buffer. No use is made of the pagecache.
26 *
27 * The caller must hold any appropriate locks.
28 */
1// SPDX-License-Identifier: GPL-2.0-or-later
2/* Direct I/O support.
3 *
4 * Copyright (C) 2023 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#include <linux/export.h>

--- 12 unchanged lines hidden (view full) ---

21 * @iocb: The I/O control descriptor describing the read
22 * @iter: The output buffer (also specifies read length)
23 *
24 * Perform an unbuffered I/O or direct I/O from the file in @iocb to the
25 * output buffer. No use is made of the pagecache.
26 *
27 * The caller must hold any appropriate locks.
28 */
29static ssize_t netfs_unbuffered_read_iter_locked(struct kiocb *iocb, struct iov_iter *iter)
29ssize_t netfs_unbuffered_read_iter_locked(struct kiocb *iocb, struct iov_iter *iter)
30{
31 struct netfs_io_request *rreq;
32 ssize_t ret;
33 size_t orig_count = iov_iter_count(iter);
34 bool async = !is_sync_kiocb(iocb);
35
36 _enter("");
37

--- 55 unchanged lines hidden (view full) ---

93out:
94 netfs_put_request(rreq, false, netfs_rreq_trace_put_return);
95 if (ret > 0)
96 orig_count -= ret;
97 if (ret != -EIOCBQUEUED)
98 iov_iter_revert(iter, orig_count - iov_iter_count(iter));
99 return ret;
100}
30{
31 struct netfs_io_request *rreq;
32 ssize_t ret;
33 size_t orig_count = iov_iter_count(iter);
34 bool async = !is_sync_kiocb(iocb);
35
36 _enter("");
37

--- 55 unchanged lines hidden (view full) ---

93out:
94 netfs_put_request(rreq, false, netfs_rreq_trace_put_return);
95 if (ret > 0)
96 orig_count -= ret;
97 if (ret != -EIOCBQUEUED)
98 iov_iter_revert(iter, orig_count - iov_iter_count(iter));
99 return ret;
100}
101EXPORT_SYMBOL(netfs_unbuffered_read_iter_locked);
101
102/**
103 * netfs_unbuffered_read_iter - Perform an unbuffered or direct I/O read
104 * @iocb: The I/O control descriptor describing the read
105 * @iter: The output buffer (also specifies read length)
106 *
107 * Perform an unbuffered I/O or direct I/O from the file in @iocb to the
108 * output buffer. No use is made of the pagecache.

--- 17 unchanged lines hidden ---
102
103/**
104 * netfs_unbuffered_read_iter - Perform an unbuffered or direct I/O read
105 * @iocb: The I/O control descriptor describing the read
106 * @iter: The output buffer (also specifies read length)
107 *
108 * Perform an unbuffered I/O or direct I/O from the file in @iocb to the
109 * output buffer. No use is made of the pagecache.

--- 17 unchanged lines hidden ---