Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp566932lqh; Thu, 28 Mar 2024 09:38:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVKO4ks4vB03wKwB4pZn3GR1l7H9taYdjy4eO9zESgDPsHlr+k6hmzQUD9R2TmDxEY/tMZxkthLxq3eLUXxNLjwlO5VsLWxZYYB0NRxrA== X-Google-Smtp-Source: AGHT+IEOwxHNyZXWk9/dcgMdLM9AOJk5BdU4CKy2BZrKR49Vs/x8+pMAaWRU1w5Er003VSAHjE0F X-Received: by 2002:a05:6808:4289:b0:3c3:5f71:733 with SMTP id dq9-20020a056808428900b003c35f710733mr3309033oib.35.1711643908711; Thu, 28 Mar 2024 09:38:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711643908; cv=pass; d=google.com; s=arc-20160816; b=gEkikPqFJn9bliDligOp8iY5zEXkYINbfFeXbX5LhytQq8urSgJ/I3u5Q7XkzLJ93r SqyRglmuV7cyYR34XZifFOpyeFCufgozqkHqD/YyJ0ELYbYxuoZRp5pJ+1GHr8rD+bVy +8Mc9hp+aeSPGuqcgMmPnXUsfgAUq892flOM5/AMqWmwlYAHJ+lLuk3pU0XgQQfTRu6Q h6yvJht3xHf7K37dB6FQNdHuibwjqkCWUyUhh9r3F+OeyZTjcMzdJ905C9Zhbq94fC5o Zdv4Y6Quj4q53kEeQQs+SzjbTkfi2EHWHI0PE7dlXuEMovGo4f575//OLl9j7mGd/4v6 aCNg== 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=DTOCRVKlSMdVpJyaVTQSUOcv3/giUpppfoW0qaRDdtA=; fh=dijFYpEVp+4ijccmXeOrV1fnLJQjsqwgNfcTPuMjuvg=; b=n8mUUfS0EaTx3lkT4HBlKpyv9scfML+TFlR5XPOLLhTy+yLGqe+OWgIPvQCtt3nFNU SE1JdawduPjZestu97ghhLzwSkQ4p/crzQxI+HVoPeNCy5hzJxdRj1uxP/raI4Tfoepg RP+hk0T1sSxTYSJNDFi7HkV47xNHjc/bG2Prd9BIgajNBcaHOqx8zBhZqse47XzPvedU a/ccrx0agi3+qMoUvH8kFUiivhSjTiRO+QBs1lSi+0OvVb9ZHrw4v8HVn5YJPSN0pg+7 okXc0AfkpcfMq0DVaFJdmRGQIcAm/lEi91ieqrmfh274CQbCVqICe1L4BITckHXl/7Bq kwYw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LaFS9qkO; 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-nfs+bounces-2525-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2525-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. [147.75.199.223]) by mx.google.com with ESMTPS id vw7-20020a05620a564700b00789fac3cf41si1706911qkn.598.2024.03.28.09.38.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 09:38:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-2525-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LaFS9qkO; 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-nfs+bounces-2525-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2525-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 6C2201C22110 for ; Thu, 28 Mar 2024 16:38:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E1A45A780; Thu, 28 Mar 2024 16:36:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LaFS9qkO" X-Original-To: linux-nfs@vger.kernel.org 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 7C02840848 for ; Thu, 28 Mar 2024 16:36:38 +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=1711643800; cv=none; b=ahrFRYBEpc3Nul+MEh5daBuAnPSVLAKXBIhPKurWSznTcMR7slds+6zZy9+CY2dozwfaoDQDgxQC2W/uwQVMGP0xL2vGxUTSQvF4TlIRp2HV3G3AEX3rj1MutzAAwuKHUsGk+yi0fj5QCOhRJ3mkrjKdcS7IbEqvD8EakHFTcg0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711643800; c=relaxed/simple; bh=Qu6JNa/GWcyY0KPB2dwXn7WgECfZDHDGW9+owd8pc8k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lpzlymOlyVgqLqhq09YSdSta+v3ZXuxLblYi7cxNcBmE0veR2exCwNcfA+VEVH5sH/fGqBEonh8xw1TJPU57ir+dHhFmXiihJlWdd3eA+ogvu1NkR/V24/I1BJ8d8r8sl/4M00c8veB2Kmqh7Af1yrjJdHnRZ/uZ/sNgli81fnw= 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=LaFS9qkO; 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=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> Precedence: bulk X-Mailing-List: linux-nfs@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.1 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 */