From patchwork Wed Aug 14 20:38:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13763966 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 39A27C3DA4A for ; Wed, 14 Aug 2024 20:41:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A82E06B0092; Wed, 14 Aug 2024 16:41:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A32676B00B3; Wed, 14 Aug 2024 16:41:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D2E56B00B4; Wed, 14 Aug 2024 16:41:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6ADF56B0092 for ; Wed, 14 Aug 2024 16:41:25 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 23DB81211A9 for ; Wed, 14 Aug 2024 20:41:25 +0000 (UTC) X-FDA: 82452021330.16.B8AE32E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 6BDB4160028 for ; Wed, 14 Aug 2024 20:41:23 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QiUC0y+w; spf=pass (imf08.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723668070; 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=bfu/TnsX2YiQImhcvgy6+BH/oHXTJfoVCbcIECxbkG0=; b=a+6eX8TxUJNpeQlHGpAhbtW/dp+f2xEXrbLEHvfQRVvgsOTMXchQcVApQ3k1VHdbMyAEyZ 8mP3oXf18BbzMnZricJyM7lGpunZc1eNpXfW49R1ywMvrgxrZRJfOZ0LtJO0zQYO/RL/Zu UfqZopz0laewYko8dtoPMlCWgWXOEfI= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QiUC0y+w; spf=pass (imf08.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723668070; a=rsa-sha256; cv=none; b=QDtI8bylqx/Cm88k1swSIDU6XVz55be6rPqkEFHw3KIybvXEQb7TXsqGFwOTKOZQj7AgfH aq97htKyI0IPDij98oURmDoHUvajSdfb2TFB9q00PggVecq+qPWjQeiTLFtPvlmoojzSky vhvdMkVAeH39xgJxymeoj135/MWE3X4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723668082; 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=bfu/TnsX2YiQImhcvgy6+BH/oHXTJfoVCbcIECxbkG0=; b=QiUC0y+wIyLB2LHjDsFU0YJwzuV7MZXCG87Epv54FYynRI4I+AvDjl0GGcG3bRShE3bkHT jfWO+xxwVMVSxm+d8SjpxDhPEKn/AYBSEno/iiHBbj2ZSiPMlVf0kmK5U/I1i+kYiBUeji cMNWscD60G6JRnI3Ii9entM63Z6YxAk= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-183-7bTnzRmsN_6lVyVNWWDYbg-1; Wed, 14 Aug 2024 16:41:19 -0400 X-MC-Unique: 7bTnzRmsN_6lVyVNWWDYbg-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.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 mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7D4011954B15; Wed, 14 Aug 2024 20:41:16 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.30]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BEECA300019A; Wed, 14 Aug 2024 20:41:10 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Matthew Wilcox Cc: David Howells , Jeff Layton , Gao Xiang , Dominique Martinet , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , netfs@lists.linux.dev, 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 18/25] afs: Make read subreqs async Date: Wed, 14 Aug 2024 21:38:38 +0100 Message-ID: <20240814203850.2240469-19-dhowells@redhat.com> In-Reply-To: <20240814203850.2240469-1-dhowells@redhat.com> References: <20240814203850.2240469-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Rspam-User: X-Stat-Signature: 65767pm8473b5bb6wxq6ybp1i4ied4ro X-Rspamd-Queue-Id: 6BDB4160028 X-Rspamd-Server: rspam11 X-HE-Tag: 1723668083-95839 X-HE-Meta: U2FsdGVkX1+MKpHF30cPZhrnVAk3ijZP5bYxn0DNyOYjJ2Kny87IcXRU37jhVg2rPN8qG4FPM38k5uJHfonZIVGdyFqdUOXM01ckGaQ8I8NCdJfvTyntk+ciMrDy89pYWMF4zJivAwQEJ3eYVngzKkrsAQ59/aVgLvtEnukTArQMvN3BHyTOgB+NlOnRNfzLSOXqw6SgXCsMQB+6+g/HdWnFv1ycG00E5/bLm6Jxbjija5hx1KIi0bub38c9wsKwzfWZ//fcoXt7IX9UwMzISa1+8BoyDKWg+m8aQLAYyPANhRtJuTJB0HJ07VX7H/w6tNT/t691a4tLG731JLk2YocUjyrWuIemr31PhMfpJ5Va8+sqzG5pjkEuyrqFPVQAbTmfXxjv6CLE2nxKy0TwbnmjGJGfjytMzSab3kO6uRwtcCvDP7C2H0Oju0FVVDWBABvr5KqcPRNU27IqLReADKE88eAOuqaQPcPxNXca3N8BSGrHo/n44c25JdOa9PCH9UHSxC6qFMoKIJsUBdKz2RuSpXTjLUy784w7ORywhT79IDyveooLPoItGNqeEe5ARyUNGLPwQ5Yti86cXTqNfe29FPCR1aVa38aZOoBdOzyx97rArWYnfP/PAjZJM/nnPlWEErO3FJ6KnJ8DvhucI2kLtxT//uclIzufjnuSsNwhrTbrJb3i9g7UbdgkOpIR6xup6cV7IbfVWFt9PXrT4CRKj+2zrTjyUZ5OiPj7iboRjIQCnsBb09VuF+bB+JwqCPGLZSZ+OYL6c/WD8DAUBSlaZ6MlDtydq4E1IKrvIHV6iqk8PVmHy1os5itsWxe23WDKhYP19brp36x6kNKRt3yVNI27+Sf1IrDmhHRFJirDc4dqn9U9hVt/aqIuakEU2PNRufu//RD+pq4s6mx3n7MYCyzKteyZQyiSUHSPYsWzELByklflPEo91LhHONwdB80vbFXbKBWQWe2aCoe oMe/kJu9 9Y9U6cP59ufj3ZIMlI3zvwCK2HfDUHhQU9LxB+BnPlwNAXSybkcTeT+UfyoZn8vPc+DeHMOBSSfJGw3eAB2YVc4f0quFD+iDmxKGkQHloXreDj88+GXod8rouDt2lsVZ5G58y+D2UCmbg+rtSG+iB2HA5Me8S2OqEEUaqqOBeshP48GACpqWlI3H1r0LmhinF/Kvd6OhKu8rPnkcRKn0q2lzhPxorV+lEAXfDbdvsg3qTR6bKhQgrDGAQoW5EYh4Svbfs6kUmzI4yfLZF/XktZGbQkDh6uL20AO8zbPBwFAVMQY76i8P6R4NdzXYi7Q5H2i3lUE6fPD9wnvNE7ZYStsWybKCpDKwjIOh0Smmu5xBuuX9gZhLcHtNHKfQsRAMXbjzn5xv+6SPpLC1AAd5Vm06g1eoTRj44gPGNYqcKSZ3+VCaE/MWg2oMIo1syhTvBEfQfSgHHh95uKvr0t67YORAaiSncY1LQd536 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: Perform AFS read subrequests in a work item rather than in the calling thread. For normal buffered reads, this will allow the calling thread to copy data from the pagecache to the application at the same time as the demarshalling thread is shovelling data from skbuffs into the pagecache. This will also allow the RA mark to trigger a new read before we've finished shovelling the data from the current one. Note: This would be a bit safer if the FS.FetchData RPC ops returned the metadata (including the data version number) before returning the data. This would allow me to flush the pagecache before installing the new data. In future, it may be possible to asynchronously flush the pagecache either side of the region being read. Signed-off-by: David Howells cc: Marc Dionne cc: Jeff Layton cc: linux-afs@lists.infradead.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/afs/file.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/afs/file.c b/fs/afs/file.c index ec1be0091fdb..5a9d16848ad5 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c @@ -305,8 +305,9 @@ int afs_fetch_data(struct afs_vnode *vnode, struct afs_read *req) return afs_do_sync_operation(op); } -static void afs_issue_read(struct netfs_io_subrequest *subreq) +static void afs_read_worker(struct work_struct *work) { + struct netfs_io_subrequest *subreq = container_of(work, struct netfs_io_subrequest, work); struct afs_vnode *vnode = AFS_FS_I(subreq->rreq->inode); struct afs_read *fsreq; @@ -325,6 +326,12 @@ static void afs_issue_read(struct netfs_io_subrequest *subreq) afs_put_read(fsreq); } +static void afs_issue_read(struct netfs_io_subrequest *subreq) +{ + INIT_WORK(&subreq->work, afs_read_worker); + queue_work(system_long_wq, &subreq->work); +} + static int afs_symlink_read_folio(struct file *file, struct folio *folio) { struct afs_vnode *vnode = AFS_FS_I(folio->mapping->host);