Skip to content

Commit

Permalink
netfs: Use subreq_counter to allocate subreq debug_index values
Browse files Browse the repository at this point in the history
Use the subreq_counter in netfs_io_request to allocate subrequest
debug_index values in read ops as well as write ops.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
  • Loading branch information
David Howells committed Apr 29, 2024
1 parent 93bf1cc commit 120b878
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions fs/netfs/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,7 @@ netfs_rreq_prepare_read(struct netfs_io_request *rreq,
* Slice off a piece of a read request and submit an I/O request for it.
*/
static bool netfs_rreq_submit_slice(struct netfs_io_request *rreq,
struct iov_iter *io_iter,
unsigned int *_debug_index)
struct iov_iter *io_iter)
{
struct netfs_io_subrequest *subreq;
enum netfs_io_source source;
Expand All @@ -511,7 +510,6 @@ static bool netfs_rreq_submit_slice(struct netfs_io_request *rreq,
if (!subreq)
return false;

subreq->debug_index = (*_debug_index)++;
subreq->start = rreq->start + rreq->submitted;
subreq->len = io_iter->count;

Expand Down Expand Up @@ -565,7 +563,6 @@ static bool netfs_rreq_submit_slice(struct netfs_io_request *rreq,
int netfs_begin_read(struct netfs_io_request *rreq, bool sync)
{
struct iov_iter io_iter;
unsigned int debug_index = 0;
int ret;

_enter("R=%x %llx-%llx",
Expand Down Expand Up @@ -596,7 +593,7 @@ int netfs_begin_read(struct netfs_io_request *rreq, bool sync)
if (rreq->origin == NETFS_DIO_READ &&
rreq->start + rreq->submitted >= rreq->i_size)
break;
if (!netfs_rreq_submit_slice(rreq, &io_iter, &debug_index))
if (!netfs_rreq_submit_slice(rreq, &io_iter))
break;
if (test_bit(NETFS_RREQ_BLOCKED, &rreq->flags) &&
test_bit(NETFS_RREQ_NONBLOCK, &rreq->flags))
Expand Down
1 change: 1 addition & 0 deletions fs/netfs/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ struct netfs_io_subrequest *netfs_alloc_subrequest(struct netfs_io_request *rreq
INIT_LIST_HEAD(&subreq->rreq_link);
refcount_set(&subreq->ref, 2);
subreq->rreq = rreq;
subreq->debug_index = atomic_inc_return(&rreq->subreq_counter);
netfs_get_request(rreq, netfs_rreq_trace_get_subreq);
netfs_stat(&netfs_n_rh_sreq);
}
Expand Down
1 change: 0 additions & 1 deletion fs/netfs/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ struct netfs_io_subrequest *netfs_create_write_request(struct netfs_io_request *
subreq->source = dest;
subreq->start = start;
subreq->len = len;
subreq->debug_index = atomic_inc_return(&wreq->subreq_counter);

switch (subreq->source) {
case NETFS_UPLOAD_TO_SERVER:
Expand Down

0 comments on commit 120b878

Please sign in to comment.