From: David Howells <dhowells@redhat.com>
To: Christian Brauner <christian@brauner.io>
Cc: David Howells <dhowells@redhat.com>,
Paulo Alcantara <pc@manguebit.org>,
Matthew Wilcox <willy@infradead.org>,
Namjae Jeon <linkinjeon@kernel.org>,
Marc Dionne <marc.dionne@auristor.com>,
Stefan Metzmacher <metze@samba.org>,
Eric Van Hensbergen <ericvh@kernel.org>,
Dominique Martinet <asmadeus@codewreck.org>,
Ilya Dryomov <idryomov@gmail.com>,
netfs@lists.linux.dev, linux-afs@lists.infradead.org,
linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org,
ceph-devel@vger.kernel.org, v9fs@lists.linux.dev,
linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH v13 8/8] netfs: Set subrequest->source at alloc before trace emission
Date: Wed, 9 Sep 2026 08:21:02 +0100 [thread overview]
Message-ID: <20260909072105.1663687-9-dhowells@redhat.com> (raw)
In-Reply-To: <20260909072105.1663687-1-dhowells@redhat.com>
Set subrequest->source in netfs_alloc_subrequest() before we emit the trace
line indicating we allocated the subrequest. Note that this requires the
allocation of the subreq in netfs_read_to_pagecache() to be pushed to after
the decision about what sort of subreq it should be.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Paulo Alcantara <pc@manguebit.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
cc: linux-mm@kvack.org
---
fs/netfs/buffered_read.c | 4 ++--
fs/netfs/direct_read.c | 3 +--
fs/netfs/internal.h | 3 ++-
fs/netfs/objects.c | 4 +++-
fs/netfs/read_retry.c | 3 +--
fs/netfs/read_single.c | 3 +--
fs/netfs/write_issue.c | 3 +--
fs/netfs/write_retry.c | 3 +--
8 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c
index 887d45f3745a..68496e1a171f 100644
--- a/fs/netfs/buffered_read.c
+++ b/fs/netfs/buffered_read.c
@@ -276,10 +276,10 @@ static void netfs_read_to_pagecache(struct netfs_io_request *rreq)
do {
struct netfs_io_subrequest *subreq;
- enum netfs_io_source source = NETFS_SOURCE_UNKNOWN;
+ enum netfs_io_source source;
ssize_t slice;
- subreq = netfs_alloc_subrequest(rreq);
+ subreq = netfs_alloc_subrequest(rreq, NETFS_SOURCE_UNKNOWN);
if (!subreq) {
ret = -ENOMEM;
break;
diff --git a/fs/netfs/direct_read.c b/fs/netfs/direct_read.c
index 5405e108b7a3..8c15f3079723 100644
--- a/fs/netfs/direct_read.c
+++ b/fs/netfs/direct_read.c
@@ -55,7 +55,7 @@ static void netfs_dispatch_unbuffered_reads(struct netfs_io_request *rreq)
struct netfs_io_subrequest *subreq;
ssize_t slice;
- subreq = netfs_alloc_subrequest(rreq);
+ subreq = netfs_alloc_subrequest(rreq, NETFS_DOWNLOAD_FROM_SERVER);
if (!subreq) {
/* Stash the error in the request if there's not
* already an error set.
@@ -64,7 +64,6 @@ static void netfs_dispatch_unbuffered_reads(struct netfs_io_request *rreq)
break;
}
- subreq->source = NETFS_DOWNLOAD_FROM_SERVER;
subreq->start = start;
subreq->len = size;
diff --git a/fs/netfs/internal.h b/fs/netfs/internal.h
index d579c5d79609..4891e6e3c5db 100644
--- a/fs/netfs/internal.h
+++ b/fs/netfs/internal.h
@@ -92,7 +92,8 @@ void netfs_get_request(struct netfs_io_request *rreq, enum netfs_rreq_ref_trace
void netfs_clear_subrequests(struct netfs_io_request *rreq);
void netfs_put_request(struct netfs_io_request *rreq, enum netfs_rreq_ref_trace what);
void netfs_put_failed_request(struct netfs_io_request *rreq);
-struct netfs_io_subrequest *netfs_alloc_subrequest(struct netfs_io_request *rreq);
+struct netfs_io_subrequest *netfs_alloc_subrequest(struct netfs_io_request *rreq,
+ enum netfs_io_source source);
static inline void netfs_see_request(struct netfs_io_request *rreq,
enum netfs_rreq_ref_trace what)
diff --git a/fs/netfs/objects.c b/fs/netfs/objects.c
index 3460aa1c4af1..9c6ea718692a 100644
--- a/fs/netfs/objects.c
+++ b/fs/netfs/objects.c
@@ -207,7 +207,8 @@ void netfs_put_failed_request(struct netfs_io_request *rreq)
/*
* Allocate and partially initialise an I/O request structure.
*/
-struct netfs_io_subrequest *netfs_alloc_subrequest(struct netfs_io_request *rreq)
+struct netfs_io_subrequest *netfs_alloc_subrequest(struct netfs_io_request *rreq,
+ enum netfs_io_source source)
{
struct netfs_io_subrequest *subreq;
mempool_t *mempool = rreq->netfs_ops->subrequest_pool ?: &netfs_subrequest_pool;
@@ -224,6 +225,7 @@ struct netfs_io_subrequest *netfs_alloc_subrequest(struct netfs_io_request *rreq
INIT_WORK(&subreq->work, NULL);
INIT_LIST_HEAD(&subreq->rreq_link);
refcount_set(&subreq->ref, 2);
+ subreq->source = source;
subreq->rreq = rreq;
subreq->debug_index = atomic_inc_return(&rreq->subreq_counter);
netfs_get_request(rreq, netfs_rreq_trace_get_subreq);
diff --git a/fs/netfs/read_retry.c b/fs/netfs/read_retry.c
index 46810d29f0c0..396a05432a7e 100644
--- a/fs/netfs/read_retry.c
+++ b/fs/netfs/read_retry.c
@@ -195,12 +195,11 @@ static void netfs_retry_read_subrequests(struct netfs_io_request *rreq)
* and insert them after.
*/
do {
- subreq = netfs_alloc_subrequest(rreq);
+ subreq = netfs_alloc_subrequest(rreq, NETFS_DOWNLOAD_FROM_SERVER);
if (!subreq) {
subreq = to;
goto abandon_after;
}
- subreq->source = NETFS_DOWNLOAD_FROM_SERVER;
subreq->start = start;
subreq->len = len;
subreq->stream_nr = stream->stream_nr;
diff --git a/fs/netfs/read_single.c b/fs/netfs/read_single.c
index ccb5fc809d99..81295c055ced 100644
--- a/fs/netfs/read_single.c
+++ b/fs/netfs/read_single.c
@@ -92,11 +92,10 @@ static int netfs_single_dispatch_read(struct netfs_io_request *rreq)
struct netfs_io_subrequest *subreq;
int ret = 0;
- subreq = netfs_alloc_subrequest(rreq);
+ subreq = netfs_alloc_subrequest(rreq, NETFS_SOURCE_UNKNOWN);
if (!subreq)
return -ENOMEM;
- subreq->source = NETFS_SOURCE_UNKNOWN;
subreq->start = 0;
subreq->len = rreq->len;
subreq->io_iter = rreq->buffer.iter;
diff --git a/fs/netfs/write_issue.c b/fs/netfs/write_issue.c
index 9a528da4bf9f..e7cb496f6324 100644
--- a/fs/netfs/write_issue.c
+++ b/fs/netfs/write_issue.c
@@ -168,10 +168,9 @@ void netfs_prepare_write(struct netfs_io_request *wreq,
wreq_iter->folioq_slot >= folioq_nr_slots(wreq_iter->folioq))
rolling_buffer_make_space(&wreq->buffer, wreq->gfp);
- subreq = netfs_alloc_subrequest(wreq);
+ subreq = netfs_alloc_subrequest(wreq, stream->source);
if (!subreq)
return;
- subreq->source = stream->source;
subreq->start = start;
subreq->stream_nr = stream->stream_nr;
subreq->io_iter = *wreq_iter;
diff --git a/fs/netfs/write_retry.c b/fs/netfs/write_retry.c
index 6cd584242af2..d7d5348496fc 100644
--- a/fs/netfs/write_retry.c
+++ b/fs/netfs/write_retry.c
@@ -149,8 +149,7 @@ static void netfs_retry_write_stream(struct netfs_io_request *wreq,
* and insert them after.
*/
do {
- subreq = netfs_alloc_subrequest(wreq);
- subreq->source = to->source;
+ subreq = netfs_alloc_subrequest(wreq, stream->source);
subreq->start = start;
subreq->stream_nr = to->stream_nr;
subreq->retry_count = 1;
next prev parent reply other threads:[~2026-09-09 7:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 7:20 [PATCH v13 0/8] netfs: Miscellaneous preparatory changes David Howells
2026-09-09 7:20 ` [PATCH v13 1/8] netfs: Use uoff_t instead of unsigned long long and loff_t David Howells
2026-09-09 7:20 ` [PATCH v13 2/8] netfs: Remove the writethrough code David Howells
2026-09-09 7:20 ` [PATCH v13 3/8] netfs: trace: Change the "clear" folio traces to "endwb" David Howells
2026-09-09 7:20 ` [PATCH v13 4/8] netfs: trace: Rejig a couple of the tracepoints David Howells
2026-09-09 7:20 ` [PATCH v13 5/8] netfs: Add the cache object ID to netfs_read/write tracepoints David Howells
2026-09-09 7:21 ` [PATCH v13 6/8] netfs: Make deprecated PG_private_2 support opt-in David Howells
2026-09-09 7:21 ` [PATCH v13 7/8] netfs: Add some functions to wrap the all-queued handling David Howells
2026-09-09 7:21 ` David Howells [this message]
2026-09-09 21:02 ` [PATCH v13 8/8] netfs: Set subrequest->source at alloc before trace emission Paulo Alcantara
2026-09-10 8:11 ` [PATCH v13 0/8] netfs: Miscellaneous preparatory changes Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260909072105.1663687-9-dhowells@redhat.com \
--to=dhowells@redhat.com \
--cc=asmadeus@codewreck.org \
--cc=ceph-devel@vger.kernel.org \
--cc=christian@brauner.io \
--cc=ericvh@kernel.org \
--cc=idryomov@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=metze@samba.org \
--cc=netfs@lists.linux.dev \
--cc=pc@manguebit.org \
--cc=v9fs@lists.linux.dev \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®