Commit 120b8781 authored by David Howells's avatar David Howells

netfs: Use subreq_counter to allocate subreq debug_index values

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: default avatarDavid Howells <dhowells@redhat.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
parent 93bf1cc0
...@@ -501,8 +501,7 @@ netfs_rreq_prepare_read(struct netfs_io_request *rreq, ...@@ -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. * 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, static bool netfs_rreq_submit_slice(struct netfs_io_request *rreq,
struct iov_iter *io_iter, struct iov_iter *io_iter)
unsigned int *_debug_index)
{ {
struct netfs_io_subrequest *subreq; struct netfs_io_subrequest *subreq;
enum netfs_io_source source; enum netfs_io_source source;
...@@ -511,7 +510,6 @@ static bool netfs_rreq_submit_slice(struct netfs_io_request *rreq, ...@@ -511,7 +510,6 @@ static bool netfs_rreq_submit_slice(struct netfs_io_request *rreq,
if (!subreq) if (!subreq)
return false; return false;
subreq->debug_index = (*_debug_index)++;
subreq->start = rreq->start + rreq->submitted; subreq->start = rreq->start + rreq->submitted;
subreq->len = io_iter->count; subreq->len = io_iter->count;
...@@ -565,7 +563,6 @@ static bool netfs_rreq_submit_slice(struct netfs_io_request *rreq, ...@@ -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) int netfs_begin_read(struct netfs_io_request *rreq, bool sync)
{ {
struct iov_iter io_iter; struct iov_iter io_iter;
unsigned int debug_index = 0;
int ret; int ret;
_enter("R=%x %llx-%llx", _enter("R=%x %llx-%llx",
...@@ -596,7 +593,7 @@ int netfs_begin_read(struct netfs_io_request *rreq, bool sync) ...@@ -596,7 +593,7 @@ int netfs_begin_read(struct netfs_io_request *rreq, bool sync)
if (rreq->origin == NETFS_DIO_READ && if (rreq->origin == NETFS_DIO_READ &&
rreq->start + rreq->submitted >= rreq->i_size) rreq->start + rreq->submitted >= rreq->i_size)
break; break;
if (!netfs_rreq_submit_slice(rreq, &io_iter, &debug_index)) if (!netfs_rreq_submit_slice(rreq, &io_iter))
break; break;
if (test_bit(NETFS_RREQ_BLOCKED, &rreq->flags) && if (test_bit(NETFS_RREQ_BLOCKED, &rreq->flags) &&
test_bit(NETFS_RREQ_NONBLOCK, &rreq->flags)) test_bit(NETFS_RREQ_NONBLOCK, &rreq->flags))
......
...@@ -152,6 +152,7 @@ struct netfs_io_subrequest *netfs_alloc_subrequest(struct netfs_io_request *rreq ...@@ -152,6 +152,7 @@ struct netfs_io_subrequest *netfs_alloc_subrequest(struct netfs_io_request *rreq
INIT_LIST_HEAD(&subreq->rreq_link); INIT_LIST_HEAD(&subreq->rreq_link);
refcount_set(&subreq->ref, 2); refcount_set(&subreq->ref, 2);
subreq->rreq = rreq; subreq->rreq = rreq;
subreq->debug_index = atomic_inc_return(&rreq->subreq_counter);
netfs_get_request(rreq, netfs_rreq_trace_get_subreq); netfs_get_request(rreq, netfs_rreq_trace_get_subreq);
netfs_stat(&netfs_n_rh_sreq); netfs_stat(&netfs_n_rh_sreq);
} }
......
...@@ -37,7 +37,6 @@ struct netfs_io_subrequest *netfs_create_write_request(struct netfs_io_request * ...@@ -37,7 +37,6 @@ struct netfs_io_subrequest *netfs_create_write_request(struct netfs_io_request *
subreq->source = dest; subreq->source = dest;
subreq->start = start; subreq->start = start;
subreq->len = len; subreq->len = len;
subreq->debug_index = atomic_inc_return(&wreq->subreq_counter);
switch (subreq->source) { switch (subreq->source) {
case NETFS_UPLOAD_TO_SERVER: case NETFS_UPLOAD_TO_SERVER:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment