summaryrefslogtreecommitdiff
path: root/fs/netfs/read_helper.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2022-02-17 18:01:24 +0300
committerDavid Howells <dhowells@redhat.com>2022-03-18 12:24:00 +0300
commit6cd3d6fd1fe2feae5ff9f6a821081569bb140bf4 (patch)
tree1a8fce9f17a0ef5e991ddd3691358f65738e7bd0 /fs/netfs/read_helper.c
parentde74023befa1876f64bc5871a2a4a51850517118 (diff)
downloadlinux-6cd3d6fd1fe2feae5ff9f6a821081569bb140bf4.tar.xz
netfs: Trace refcounting on the netfs_io_subrequest struct
Add refcount tracing for the netfs_io_subrequest structure. Changes ======= ver #3) - Switch 'W=' to 'R=' in the traceline to match other request debug IDs. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/164622998584.3564931.5052255990645723639.stgit@warthog.procyon.org.uk/ # v1 Link: https://lore.kernel.org/r/164678202603.1200972.14726007419792315578.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/164692901860.2099075.4845820886851239935.stgit@warthog.procyon.org.uk/ # v3
Diffstat (limited to 'fs/netfs/read_helper.c')
-rw-r--r--fs/netfs/read_helper.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c
index 620c3be5ec0a..8f277da487b6 100644
--- a/fs/netfs/read_helper.c
+++ b/fs/netfs/read_helper.c
@@ -167,7 +167,7 @@ static void netfs_rreq_copy_terminated(void *priv, ssize_t transferred_or_error,
if (atomic_dec_and_test(&rreq->nr_copy_ops))
netfs_rreq_unmark_after_write(rreq, was_async);
- netfs_put_subrequest(subreq, was_async);
+ netfs_put_subrequest(subreq, was_async, netfs_sreq_trace_put_terminated);
}
/*
@@ -191,7 +191,8 @@ static void netfs_rreq_do_write_to_cache(struct netfs_io_request *rreq)
list_for_each_entry_safe(subreq, p, &rreq->subrequests, rreq_link) {
if (!test_bit(NETFS_SREQ_COPY_TO_CACHE, &subreq->flags)) {
list_del_init(&subreq->rreq_link);
- netfs_put_subrequest(subreq, false);
+ netfs_put_subrequest(subreq, false,
+ netfs_sreq_trace_put_no_copy);
}
}
@@ -203,7 +204,8 @@ static void netfs_rreq_do_write_to_cache(struct netfs_io_request *rreq)
break;
subreq->len += next->len;
list_del_init(&next->rreq_link);
- netfs_put_subrequest(next, false);
+ netfs_put_subrequest(next, false,
+ netfs_sreq_trace_put_merged);
}
ret = cres->ops->prepare_write(cres, &subreq->start, &subreq->len,
@@ -219,7 +221,7 @@ static void netfs_rreq_do_write_to_cache(struct netfs_io_request *rreq)
atomic_inc(&rreq->nr_copy_ops);
netfs_stat(&netfs_n_rh_write);
- netfs_get_subrequest(subreq);
+ netfs_get_subrequest(subreq, netfs_sreq_trace_get_copy_to_cache);
trace_netfs_sreq(subreq, netfs_sreq_trace_write);
cres->ops->write(cres, subreq->start, &iter,
netfs_rreq_copy_terminated, subreq);
@@ -342,7 +344,7 @@ static void netfs_rreq_short_read(struct netfs_io_request *rreq,
netfs_stat(&netfs_n_rh_short_read);
trace_netfs_sreq(subreq, netfs_sreq_trace_resubmit_short);
- netfs_get_subrequest(subreq);
+ netfs_get_subrequest(subreq, netfs_sreq_trace_get_short_read);
atomic_inc(&rreq->nr_outstanding);
if (subreq->source == NETFS_READ_FROM_CACHE)
netfs_read_from_cache(rreq, subreq, NETFS_READ_HOLE_CLEAR);
@@ -376,7 +378,7 @@ static bool netfs_rreq_perform_resubmissions(struct netfs_io_request *rreq)
subreq->error = 0;
netfs_stat(&netfs_n_rh_download_instead);
trace_netfs_sreq(subreq, netfs_sreq_trace_download_instead);
- netfs_get_subrequest(subreq);
+ netfs_get_subrequest(subreq, netfs_sreq_trace_get_resubmit);
atomic_inc(&rreq->nr_outstanding);
netfs_read_from_server(rreq, subreq);
} else if (test_bit(NETFS_SREQ_SHORT_IO, &subreq->flags)) {
@@ -538,7 +540,7 @@ out:
else if (u == 1)
wake_up_var(&rreq->nr_outstanding);
- netfs_put_subrequest(subreq, was_async);
+ netfs_put_subrequest(subreq, was_async, netfs_sreq_trace_put_terminated);
return;
incomplete:
@@ -683,7 +685,7 @@ static bool netfs_rreq_submit_slice(struct netfs_io_request *rreq,
subreq_failed:
rreq->error = subreq->error;
- netfs_put_subrequest(subreq, false);
+ netfs_put_subrequest(subreq, false, netfs_sreq_trace_put_failed);
return false;
}
@@ -1030,13 +1032,13 @@ retry:
*/
ractl._nr_pages = folio_nr_pages(folio);
netfs_rreq_expand(rreq, &ractl);
+ netfs_get_request(rreq, netfs_rreq_trace_get_hold);
/* We hold the folio locks, so we can drop the references */
folio_get(folio);
while (readahead_folio(&ractl))
;
- netfs_get_request(rreq, netfs_rreq_trace_get_hold);
atomic_set(&rreq->nr_outstanding, 1);
do {
if (!netfs_rreq_submit_slice(rreq, &debug_index))