netfs: Use subreq_counter to allocate subreq debug_index values
authorDavid Howells <dhowells@redhat.com>
Thu, 21 Mar 2024 10:16:55 +0000 (10:16 +0000)
committerDavid Howells <dhowells@redhat.com>
Mon, 29 Apr 2024 14:01:44 +0000 (15:01 +0100)
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

fs/netfs/io.c
fs/netfs/objects.c
fs/netfs/output.c

index 2641238aae82d87bdcb4ed0ebcce34191e0aa734..8de581ac0cfbab46ef8804535607623484a0310a 100644 (file)
@@ -501,8 +501,7 @@ out:
  * 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;
@@ -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;
 
@@ -565,7 +563,6 @@ subreq_failed:
 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",
@@ -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))
index 72b52f0702708848621ec24a8d775006bbcb8b41..8acc03a640595f70e071d35288d0594e7b956c49 100644 (file)
@@ -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);
        }
index fbdbb4f78234262bb1100f0de1b812421fd86461..e586396d6b729d777fc60c45ecc9410c5c6031a5 100644 (file)
@@ -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: