Skip to content

Commit

Permalink
netfs: Make netfs_io_request::subreq_counter an atomic_t
Browse files Browse the repository at this point in the history
Make the netfs_io_request::subreq_counter, used to generate values for
netfs_io_subrequest::debug_index, into an atomic_t so that it can be called
from the retry thread at the same time as the app thread issuing writes.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: 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 ae67831 commit 93bf1cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fs/netfs/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct netfs_io_subrequest *netfs_create_write_request(struct netfs_io_request *
subreq->source = dest;
subreq->start = start;
subreq->len = len;
subreq->debug_index = wreq->subreq_counter++;
subreq->debug_index = atomic_inc_return(&wreq->subreq_counter);

switch (subreq->source) {
case NETFS_UPLOAD_TO_SERVER:
Expand Down
2 changes: 1 addition & 1 deletion include/linux/netfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ struct netfs_io_request {
unsigned int debug_id;
unsigned int rsize; /* Maximum read size (0 for none) */
unsigned int wsize; /* Maximum write size (0 for none) */
unsigned int subreq_counter; /* Next subreq->debug_index */
atomic_t subreq_counter; /* Next subreq->debug_index */
atomic_t nr_outstanding; /* Number of ops in progress */
atomic_t nr_copy_ops; /* Number of copy-to-cache ops in progress */
size_t submitted; /* Amount submitted for I/O so far */
Expand Down

0 comments on commit 93bf1cc

Please sign in to comment.