Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2046799lqa; Tue, 30 Apr 2024 07:03:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX9eV6UPbjgahKWSosyb3Aq7nQOoDda2/giZDVZ0suMj2W0h+pWiO2O+bYUG1Z6dM17Rlg1XDJyJuw/N3aCCV7n9BiYLRkyIVrICDK7+w== X-Google-Smtp-Source: AGHT+IFzVVaa2Le3q1M7lI8VPT14Z77/V+lIRclekNcSLtQk3pNSyiVGGqZN66UDOZSC3IvADyLA X-Received: by 2002:ac8:7d84:0:b0:43a:b9c9:a25c with SMTP id c4-20020ac87d84000000b0043ab9c9a25cmr2843537qtd.38.1714485817813; Tue, 30 Apr 2024 07:03:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714485817; cv=pass; d=google.com; s=arc-20160816; b=XV0IwUyQBIKu268tUm/XKN26+QV7WHZVIE/a/rsMpkECJuRKig5tUM4wirWifSE7uV kaLtpY7TrS6pQ2a0gnft2uXswfK9PwvEgC3MGGZ6Qm0nDjRR8yXF5Om0fR6mgyh4q2dh 6gvYPKXxuhNcyY5N2rk/BvA/kPweaBRjaBSI2Xj6H4nOFvjJMIgftAt9mXGKO5USze48 yKY7jNAGLGJVlBO6Kjj7Y3NYYjTVM0CDkdgOzVC51S9+lCLcPRjKbSkeSMXfOWtq8EaR t5xO1Byb/Ckr9ElDdYtR1x9X4OF8U8F85Ed/2V0qJZopHR3haG/SkZV9VUztTwcTfG4f ZtVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=uYKvItVfQ5vMLpVWGuG4Wu9Mz+mrcrwjH5IKasVHZvQ=; fh=dijFYpEVp+4ijccmXeOrV1fnLJQjsqwgNfcTPuMjuvg=; b=BsRxrZFtoljvb04nbAjapE9J8NRrKxjzNWyaCgB1a0OzEKMWpuL1oS8OGy7M+R3Q33 r4+SCV/gzYf8IITHRQRf5Clw4UmSewxFg8EFvSfqFd1/p5UpsdL1Yuc8PycLXW8n0MRc e6bmidkk35UPGlVm/+h6XbsxFXFBGA8XXg6gQcFpjy69WtGEoj5j8UKxPXow7tGxFvtK E8ovqv9rZUOWdyZO/4twe8IFJrX3LcMU2hlQSq3FndY2xZg8I9hVP/HfeddKTE6ZPli1 NKSAmNDkKBK0zdBUr/TjWHqJHZvAB8vjuZq9S4IPrLXcrZGhspkok47uC2kfC9jHOBgL eTlg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bhXGQwW3; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-164057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164057-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f28-20020a05622a1a1c00b0043acde0bd39si5809884qtb.206.2024.04.30.07.03.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 07:03:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bhXGQwW3; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-164057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164057-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 659551C22528 for ; Tue, 30 Apr 2024 14:03:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E361417B509; Tue, 30 Apr 2024 14:01:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bhXGQwW3" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A1211779A4 for ; Tue, 30 Apr 2024 14:01:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714485690; cv=none; b=atBw+/8mZSy35Gwp3/V2pPuoq8pwVbu6GmrlVe/W6kvDFu+o1L2P90BcY9WcjL145zjEp5AS66VALODvV5klagSGMDYIK6QzFxTF2UXkRmYg6D9XIezLvVgUotwS6v6HiYsrF6XoWyD0OZiKmj74/3VWNB58rXfmR0dkGy1NJik= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714485690; c=relaxed/simple; bh=l2BwvZmtrfT4S750WyzyWkcltqFLAI/SdD29xvEFeeI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ERQJy4ppJCQwKH2kJhhhRjsUpWiwcro6fnrDXTgfdIzvDCkJm5Zs94zLw6LqDeoUuwMfkxcw091PNS59h+S/cgh530URVzm/O1qWp9rhcKcoLfqCtyEXFaLU300zC/EuS3L5YxOqpQkZA1AUOAEz/8WtEzXvImFWxbG11dVbmrQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=bhXGQwW3; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714485687; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uYKvItVfQ5vMLpVWGuG4Wu9Mz+mrcrwjH5IKasVHZvQ=; b=bhXGQwW3QrdoLS4HifU9i+3URtLBFLs2wQBN2/v4/lqjL3T1IO5taX2OH+QZxQ92tXET7k SBM7fXaWDEfNF8cBKoash0W3TmVbsRv3jj1kMUvwXCQNgKzfUsZUl0BEXY/kveSLcWup/1 IpI/NMvuetrD5Zk2nQh2fBp0M8YAJcU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-618--sMwcTQuMLKiRlu_VVUNdw-1; Tue, 30 Apr 2024 10:01:25 -0400 X-MC-Unique: -sMwcTQuMLKiRlu_VVUNdw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 04A6C1C4C397; Tue, 30 Apr 2024 14:01:24 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2175A202450F; Tue, 30 Apr 2024 14:01:20 +0000 (UTC) From: David Howells To: Christian Brauner , Jeff Layton , Gao Xiang , Dominique Martinet Cc: David Howells , Matthew Wilcox , Steve French , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , netfs@lists.linux.dev, linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 05/22] netfs: Make netfs_io_request::subreq_counter an atomic_t Date: Tue, 30 Apr 2024 15:00:36 +0100 Message-ID: <20240430140056.261997-6-dhowells@redhat.com> In-Reply-To: <20240430140056.261997-1-dhowells@redhat.com> References: <20240430140056.261997-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 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 Reviewed-by: Jeff Layton cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/netfs/output.c | 2 +- include/linux/netfs.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/netfs/output.c b/fs/netfs/output.c index 625eb68f3e5a..fbdbb4f78234 100644 --- a/fs/netfs/output.c +++ b/fs/netfs/output.c @@ -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: diff --git a/include/linux/netfs.h b/include/linux/netfs.h index f36a6d8163d1..ddafc6ebff42 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -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 */