From patchwork Thu Jun 20 17:31:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13705992 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 0EE3CC2BB85 for ; Thu, 20 Jun 2024 17:33:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D3AD8D00C9; Thu, 20 Jun 2024 13:33:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 85A838D00AF; Thu, 20 Jun 2024 13:33:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 65E198D00C9; Thu, 20 Jun 2024 13:33:20 -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 3CC9E8D00AF for ; Thu, 20 Jun 2024 13:33:20 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D5F17C045D for ; Thu, 20 Jun 2024 17:33:19 +0000 (UTC) X-FDA: 82251963318.08.8E4B54D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 286591A001F for ; Thu, 20 Jun 2024 17:33:17 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=UvQWKUzf; spf=pass (imf19.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1718904793; 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=Ts5ZCKmEyEPwC8pHpdqPl9OxtkpjpqDkyGOj4sN+myw=; b=ir+/4EVLUGzNmPXxfBgLN9IwZef8KEiHWKgt+NI8vmHLAAtT9cTLTeqtuUX7h6vDtkKJ4J t7z/C+593qi8oMX4P9CiIbGO074rFzmBmms+QdDYj/pJKKTrHBylUVdCYM5uVw5JFykQZF EKFw2/d2D/q14YOsGA3Og/IeDsMd2do= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=UvQWKUzf; spf=pass (imf19.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1718904793; a=rsa-sha256; cv=none; b=Ud0/lkMEHMcdwH/uhVd+2QHXpkCE/rUWwl036NlOCsc3VklonmVJHKyOVv8Ux9AUCGYe6P ykvurfMbvwZTuCaPoEWWmxwClc/G/Cdm4dMF6cN6dNb7tq8ter2g4E2DWZkAuo8LppQ3HK GphSojOVneMPCBguzV08RNv+ROWk8UM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718904797; 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=Ts5ZCKmEyEPwC8pHpdqPl9OxtkpjpqDkyGOj4sN+myw=; b=UvQWKUzfuQ3IO5MlDBMNI1ap5zxzhO0+jz9b2M3/PdKIJqpi5zTeM84YCjIuiRFtYCwwxe Xos7MTdSFsY9oujJz5K5gcClizDdWQkoVGMVaOqxm1l4uFUlxpF34zjgZMVCe+PNBTtP97 ChthCSLesdaYnN6dFPLJnPhsSKRQjMA= Received: from mx-prod-mc-03.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-378-OqI8PTsvNIisGVH6w9IAGQ-1; Thu, 20 Jun 2024 13:33:14 -0400 X-MC-Unique: OqI8PTsvNIisGVH6w9IAGQ-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2C42B1956056; Thu, 20 Jun 2024 17:33:03 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.39.195.156]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 340171955E80; Thu, 20 Jun 2024 17:32:56 +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 09/17] cifs: Defer read completion Date: Thu, 20 Jun 2024 18:31:27 +0100 Message-ID: <20240620173137.610345-10-dhowells@redhat.com> In-Reply-To: <20240620173137.610345-1-dhowells@redhat.com> References: <20240620173137.610345-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 286591A001F X-Stat-Signature: x1n7mimuapxpafd91ent7imwt8t1mwja X-HE-Tag: 1718904797-147311 X-HE-Meta: U2FsdGVkX1/ugP/x33c9cZtPIiP2J8NjWfqa91PVHhgtAL0ZANuHaBF0qXuSSngt3FufVVgri5hmAJCiBqZTtSl2SYw20LC8mjl3rsEN+VwzjFR3iCsJrLLqYVTbPTmxj0MU7ywmOK8w9Gq+Y5WILaL6GkzXzLSHzpxJUAIziajtSUovQsDz9wDF0SvFrvS5K6kDV+Rkt23dGXqHpFo4sBzH/cbiDTPzaz3yZ6Ax+thxEiTRlURJJtqH+CLKskmJGKjlsXsUnoZxxn+h1cuyzfPEcvd225dyyhY773QbBYY1gx8S824x7JeoS0UWDmrzeR6OX3KUK0zADFCAEdRl5crznQ0nK2uGpkxhBBxrHZteD4h0Snb4IH2il24YbX8YCdm0RqYuTRaZrGRpgnLIXOg5jfhSLUAIXlmEV+feGtYOeh1tNO+0n5+kxD0/CSu6W3IhU+52+ZsnjIGuk6X+7B6vWd0gApaZBSrM0CtU7zeZ+X2MabVRelxClH/bsaYPh+3ifr7q9n2CjDxYkhclbkZ8CtG2GlSJtC1lRR8MU2uZ7EZjGtDAqQTx7CfHuVBWG7Sl+J3p14ZukehhOGlncywas9M0heZHbCLKAuVX6w7jtUhw/pn4N7BpsZ0tnvO77QKSDjFlYCMy4BK3MC7f/bWFLROu9s1l1EzYTnS/e2R7+3rNBQIdxlSxLz7Nz2p9LeG2PR5asO66G+kSKniWtKiZ4yuxKeal15oX8B6eTi94DfmABjYFQ+iC7q6JqHzjJuU7Yx2kMit+xHQTmRdGj769MxV4LCu1izhSGFOJTBLS66Ms0HsRLj7+dz9g5zNfRgv/nfALn+YjpxgFtLnfLV6PngkN0q3DXOHkSaVelSgDpx1iK6htNfvEStsTa+dP5TafoyNC21QvpZHTezhapMd4Gnu6CFTcHXkvRlbbEbC6MqAyboXe3N4n/HPJeQrmniYQPpr/9mwGXd/OcVQ coZA/GJb M1/3wxehiaFAVuhUgjynkdfRWivAty+xzgnZfFCM5A6THwdxtbdNEs6ZNa+q5ie0fpzi9eLNPwNUh4+MWBRYrHVb0wLKeYeqbX6zQZBFDZu1QTLf/9Fqd0eakkPA0kT2OGH5RlE8Nq6h1n1BX83GfGO6VqE5GUyKCn4ZZkIv5Fkhn546MgITtmal87uSxsgC5GT9eIV43prYHMmhQYXKFAEbcljosz7SUWRr7NMOc5Df2TOkYI9lZKx2i6jyjP1LbUNy7m1Y471zp/SimjNqCH0ZVgA== 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: --- fs/smb/client/smb2pdu.c | 15 ++++++++++++--- include/trace/events/netfs.h | 7 +++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index 38a06e8a0f90..e213cecd5094 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -4484,6 +4484,16 @@ smb2_new_read_req(void **buf, unsigned int *total_len, return rc; } +static void smb2_readv_worker(struct work_struct *work) +{ + struct cifs_io_subrequest *rdata = + container_of(work, struct cifs_io_subrequest, subreq.work); + + netfs_subreq_terminated(&rdata->subreq, + (rdata->result == 0 || rdata->result == -EAGAIN) ? + rdata->got_bytes : rdata->result, true); +} + static void smb2_readv_callback(struct mid_q_entry *mid) { @@ -4578,9 +4588,8 @@ smb2_readv_callback(struct mid_q_entry *mid) rdata->result = 0; } rdata->credits.value = 0; - netfs_subreq_terminated(&rdata->subreq, - (rdata->result == 0 || rdata->result == -EAGAIN) ? - rdata->got_bytes : rdata->result, true); + INIT_WORK(&rdata->subreq.work, smb2_readv_worker); + queue_work(cifsiod_wq, &rdata->subreq.work); release_mid(mid); add_credits(server, &credits, 0); } diff --git a/include/trace/events/netfs.h b/include/trace/events/netfs.h index fc5dbd19f120..db603a4e22cd 100644 --- a/include/trace/events/netfs.h +++ b/include/trace/events/netfs.h @@ -412,6 +412,7 @@ TRACE_EVENT(netfs_folio, __field(ino_t, ino) __field(pgoff_t, index) __field(unsigned int, nr) + __field(bool, ra_trigger) __field(enum netfs_folio_trace, why) ), @@ -420,11 +421,13 @@ TRACE_EVENT(netfs_folio, __entry->why = why; __entry->index = folio_index(folio); __entry->nr = folio_nr_pages(folio); + __entry->ra_trigger = folio_test_readahead(folio); ), - TP_printk("i=%05lx ix=%05lx-%05lx %s", + TP_printk("i=%05lx ix=%05lx-%05lx %s%s", __entry->ino, __entry->index, __entry->index + __entry->nr - 1, - __print_symbolic(__entry->why, netfs_folio_traces)) + __print_symbolic(__entry->why, netfs_folio_traces), + __entry->ra_trigger ? " *RA*" : "") ); TRACE_EVENT(netfs_write_iter,