From patchwork Thu Mar 28 16:33:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13608974 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3C7DCD11DD for ; Thu, 28 Mar 2024 16:36:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D1DF6B00A6; Thu, 28 Mar 2024 12:36:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 75B4F6B00A7; Thu, 28 Mar 2024 12:36:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D4986B00A8; Thu, 28 Mar 2024 12:36:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3B15C6B00A6 for ; Thu, 28 Mar 2024 12:36:40 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 003421A02AE for ; Thu, 28 Mar 2024 16:36:39 +0000 (UTC) X-FDA: 81947001318.15.D621E77 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf29.hostedemail.com (Postfix) with ESMTP id 2AF2D120029 for ; Thu, 28 Mar 2024 16:36:37 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=LaFS9qkO; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711643798; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=DTOCRVKlSMdVpJyaVTQSUOcv3/giUpppfoW0qaRDdtA=; b=MCzBKCBThKUBBEmyBw1Cy8WjAWK8DldRBHKSxLVSIe8/vINr0CabNzVHG8FVymMAgT+dyN VJsGQEGFDj5jLy6wUQFS9xLj9Ly07TM2dz/rytAvFUWxtWtVxwfw9Ud5RTHirAD2X20HO2 zHiBb9JIDszMUXvskfmwvHK5oenEaXo= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=LaFS9qkO; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711643798; a=rsa-sha256; cv=none; b=76VT+dFyBLTcZoBcwr5YlHC+dtsyp4wPesunmo5I5XrlpbwPhAyTOgFfkihgSKmPaE9uXU RcXot3eKuChosIN37y6s9f4my/gj4dMysvI4sIqKQ+z+Xj6r3XI+oVjP/X/mzpV9wOBmSy xMBg2eXXToKM/hxS8kPA2TV1q7deP4g= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711643797; 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=DTOCRVKlSMdVpJyaVTQSUOcv3/giUpppfoW0qaRDdtA=; b=LaFS9qkOTIm50bTOMFhZM9dRWSwWarYCh0tErAKRyF1Vod7vkBQL4BQ0OVdMuCZNlYysFG L01mKKFJW9qQza6vbYCreiI7RQ0ITz6fLqUgldL7Kt0zs4cl1mUykLQi8nTuS1MtvcFPWd zpQxbV0lL3uwFPJ3OpF2tGDfFvD5Apc= 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-426-PKKJzPiePVmnP10543grxg-1; Thu, 28 Mar 2024 12:36:30 -0400 X-MC-Unique: PKKJzPiePVmnP10543grxg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 88B663CBDF73; Thu, 28 Mar 2024 16:36:27 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.146]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95C5137F2; Thu, 28 Mar 2024 16:36:24 +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 07/26] netfs: Make netfs_io_request::subreq_counter an atomic_t Date: Thu, 28 Mar 2024 16:33:59 +0000 Message-ID: <20240328163424.2781320-8-dhowells@redhat.com> In-Reply-To: <20240328163424.2781320-1-dhowells@redhat.com> References: <20240328163424.2781320-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Rspam-User: X-Stat-Signature: r1k3rtk6damgaoegmfnng5sp3b59j38d X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2AF2D120029 X-HE-Tag: 1711643797-819505 X-HE-Meta: U2FsdGVkX19C8cIhF3XY6bayOxZrb9sJqZ4SZJmZkYHBYDESbJfoYm+Qfn6VA2HS5qZlVAD54CY6lyD+HRklJBRwXAxlbbCZ/yXaqv9Xm1cslx6qIOSCQmhC8CXF+hMt5VrNORwdHZEF66G6ecKQox6pUtcdbsvuo0UVpraQslt9v2RTG/PPD8H/Qrnpdk46nHKOI2qAnS2Mo2hxuLccevN1atxHiVSmcErwCnxXckFqAw+IuWbULlt+GOD1i1LSGUVskFGhL7+j7Fr6eiCPUHh+dCODjTR+J3jIQFD1LWT3HuEGXgLtVjNyoMRHZSOD1m8EnSJ1vHccRwkMBYm2tqGAKdN3DzH40cpTrG/uhxFlsgWeix0KUQiTk/MGeq491pTPIl2q26UQkYW1ycatHipCJqJSyUrWe5ECp7hq6+tYVksJWIVG0TUE4/kSJEhktqaqDzLvbQJQIkTdZ18RUW6KFt02jIv6deznzk4ZnKSaPYFyw5om1srPekyF978At+8hIlaMCqens8voak49zNJLTyGAlTcu78RYzZzIDeLMyYokDQ0kJr4x8Js5rDcPLNs7Y6MoPW6nbvtmZ4cZVq7Ajb0eiut16BasDUJow4/eSVLCFiPYCDdq22y3jWLpml/vvMfbUOtJYLpDFsLBu2+T0SgevH2MLZNmH6N8oPrhjJ8hbSsa0Q5w4Kz0usAW6xbGCfg7161aHOCYEdaCTrXlZHuy3yKYF7NkOZDkXDHvf16XW9x8nEmn3Mqg3KibDZm8bfiA750kyRXi0EKgPmTZMDCFE8Lcnz5O4hTGc6u6y2sxIyzRhjrzp8dZ+PXTnZGV2SEA7WXfgYd2hua3+ITp/IZQcnBxBl/unsayT2gMQolnKMzeZnfA6TCuwtgAdPPblqSjqTYMahe1krrRTHN7/wIAIRUvtYKi4jra6C30cytNxs3/FykkKmXvTraYcBZAar8rXptWfILuZ77 j2UBVRMP cTQhpjiYRFR/6IY4uXvEqZX/T0N4y4VmH4Z8ef1MLla9fDXwe6xGQabMjC6FQJJxwIbLtUBj6ooeNWAp4NGlr/YmZkLUfU+r6oFEo4n+vYdAaWQbEUfgcQ3FEbXHDoChPIdaf14EXYT/nKDgLXV2no+21o7Slu19bwETN2G54Clhmf2KXGjyEuinJyiOqbSCro7DTTVXJ/DMZnko8+7GRul5dU5kSt9IrN/ZsAn4VHLFBereaPstJrjm/kx774bQMJu4Va/V1pWv2zWQUz0dHfIjoQ1XyIt2WnbOleLCrtICo94WmRZQ3Fmwc+A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 cc: 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 */