Skip to content

Commit 93bf1cc

Browse files
committed
netfs: Make netfs_io_request::subreq_counter an atomic_t
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
1 parent ae67831 commit 93bf1cc

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

fs/netfs/output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct netfs_io_subrequest *netfs_create_write_request(struct netfs_io_request *
3737
subreq->source = dest;
3838
subreq->start = start;
3939
subreq->len = len;
40-
subreq->debug_index = wreq->subreq_counter++;
40+
subreq->debug_index = atomic_inc_return(&wreq->subreq_counter);
4141

4242
switch (subreq->source) {
4343
case NETFS_UPLOAD_TO_SERVER:

include/linux/netfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ struct netfs_io_request {
202202
unsigned int debug_id;
203203
unsigned int rsize; /* Maximum read size (0 for none) */
204204
unsigned int wsize; /* Maximum write size (0 for none) */
205-
unsigned int subreq_counter; /* Next subreq->debug_index */
205+
atomic_t subreq_counter; /* Next subreq->debug_index */
206206
atomic_t nr_outstanding; /* Number of ops in progress */
207207
atomic_t nr_copy_ops; /* Number of copy-to-cache ops in progress */
208208
size_t submitted; /* Amount submitted for I/O so far */

0 commit comments

Comments
 (0)