diff options
author | David Howells <dhowells@redhat.com> | 2023-10-04 17:15:48 +0200 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2023-12-28 10:45:20 +0100 |
commit | 4fcccc38ebbdcff74494701c50a8e2fe4689837e (patch) | |
tree | 15e593b4e75bff66f53c63af285eb102e1a8d0b1 /fs/netfs/buffered_read.c | |
parent | netfs: Make netfs_put_request() handle a NULL pointer (diff) | |
download | linux-4fcccc38ebbdcff74494701c50a8e2fe4689837e.tar.xz linux-4fcccc38ebbdcff74494701c50a8e2fe4689837e.zip |
netfs: Make the refcounting of netfs_begin_read() easier to use
Make the refcounting of netfs_begin_read() easier to use by not eating the
caller's ref on the netfs_io_request it's given. This makes it easier to
use when we need to look in the request struct after.
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
cc: linux-cachefs@redhat.com
cc: linux-fsdevel@vger.kernel.org
cc: linux-mm@kvack.org
Diffstat (limited to 'fs/netfs/buffered_read.c')
-rw-r--r-- | fs/netfs/buffered_read.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c index 751556faa70b..6b9a44cafbac 100644 --- a/fs/netfs/buffered_read.c +++ b/fs/netfs/buffered_read.c @@ -210,6 +210,7 @@ void netfs_readahead(struct readahead_control *ractl) ; netfs_begin_read(rreq, false); + netfs_put_request(rreq, false, netfs_rreq_trace_put_return); return; cleanup_free: @@ -260,7 +261,9 @@ int netfs_read_folio(struct file *file, struct folio *folio) iov_iter_xarray(&rreq->iter, ITER_DEST, &mapping->i_pages, rreq->start, rreq->len); - return netfs_begin_read(rreq, true); + ret = netfs_begin_read(rreq, true); + netfs_put_request(rreq, false, netfs_rreq_trace_put_return); + return ret; discard: netfs_put_request(rreq, false, netfs_rreq_trace_put_discard); @@ -429,6 +432,7 @@ retry: ret = netfs_begin_read(rreq, true); if (ret < 0) goto error; + netfs_put_request(rreq, false, netfs_rreq_trace_put_return); have_folio: ret = folio_wait_fscache_killable(folio); |