From mboxrd@z Thu Jan 1 00:00:00 1970 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 E2943C433EF for ; Wed, 6 Apr 2022 23:07:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 526606B0081; Wed, 6 Apr 2022 19:04:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4AE136B0082; Wed, 6 Apr 2022 19:04:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 327A46B0083; Wed, 6 Apr 2022 19:04:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id 206166B0081 for ; Wed, 6 Apr 2022 19:04:46 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D4B128249980 for ; Wed, 6 Apr 2022 23:04:35 +0000 (UTC) X-FDA: 79327985352.26.93F9EC8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 409D31C000A for ; Wed, 6 Apr 2022 23:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649286274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q1tSsE6QNgYZ78bN7KiJubCT50PcBaB/EJFk09P7vaY=; b=bxT+AhMTqLfevJyjXPmWpKRz9LEM/9FtZx3ueuixm/UkWQLvYdrg/8MJhcovYxWct9dttS 7QtIjwauJV/FPTKtPFVzguXmyxmguBbuo6rYKEk5sufEFFU9XPDcTVaxSirq5PCFvsZ0W2 1dY+mZjlgHR3Ery9Pcr7kBFarjCDLiA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-363-tq_9NYBMMFGQEmOalP5MjA-1; Wed, 06 Apr 2022 19:04:31 -0400 X-MC-Unique: tq_9NYBMMFGQEmOalP5MjA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C36C100BAA6; Wed, 6 Apr 2022 23:04:31 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.37.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 065CCC28102; Wed, 6 Apr 2022 23:04:29 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 09/14] cifs: Put credits into cifs_io_subrequest, not on the stack From: David Howells To: linux-cachefs@redhat.com Cc: Steve French , Shyam Prasad N , Rohith Surabattula , linux-cifs@vger.kernel.org, dhowells@redhat.com, Steve French , Shyam Prasad N , Rohith Surabattula , Jeff Layton , linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Date: Thu, 07 Apr 2022 00:04:29 +0100 Message-ID: <164928626929.457102.8462570553817391746.stgit@warthog.procyon.org.uk> In-Reply-To: <164928615045.457102.10607899252434268982.stgit@warthog.procyon.org.uk> References: <164928615045.457102.10607899252434268982.stgit@warthog.procyon.org.uk> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: ucnbe7ikizrer7rek8u7zssj9ez653g6 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=bxT+AhMT; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf21.hostedemail.com: domain of dhowells@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=dhowells@redhat.com X-Rspamd-Queue-Id: 409D31C000A X-HE-Tag: 1649286275-465010 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: Move the credits into the cifs_io_subrequest struct rather than placing them on the stack. They are then allocated by netfslib when it allocates its netfs_io_subrequest. Signed-off-by: David Howells cc: Steve French cc: Shyam Prasad N cc: Rohith Surabattula cc: linux-cifs@vger.kernel.org --- fs/cifs/file.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index fb2885134154..fc3a46f7e2cf 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3450,7 +3450,6 @@ static void cifs_req_issue_read(struct netfs_io_subrequest *subreq) struct cifs_io_subrequest *rdata = container_of(subreq, struct cifs_io_subrequest, subreq); struct cifsFileInfo *open_file = rreq->netfs_priv; struct cifs_sb_info *cifs_sb = CIFS_SB(rreq->inode->i_sb); - struct cifs_credits credits_on_stack, *credits = &credits_on_stack; unsigned int xid; pid_t pid; int rc = 0; @@ -3482,7 +3481,8 @@ static void cifs_req_issue_read(struct netfs_io_subrequest *subreq) server->ops->negotiate_rsize(tlink_tcon(open_file->tlink), cifs_sb->ctx); - rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize, &rsize, credits); + rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize, &rsize, + &rdata->credits); if (rc) goto out; @@ -3492,7 +3492,6 @@ static void cifs_req_issue_read(struct netfs_io_subrequest *subreq) rdata->offset = subreq->start + subreq->transferred; rdata->bytes = subreq->len - subreq->transferred; rdata->pid = pid; - rdata->credits = credits_on_stack; rc = adjust_credits(server, &rdata->credits, rdata->bytes); if (!rc) { @@ -3502,11 +3501,6 @@ static void cifs_req_issue_read(struct netfs_io_subrequest *subreq) rc = server->ops->async_readv(rdata); } - if (rc) { - add_credits_and_wake_if(server, &rdata->credits, 0); - /* Fallback to the readpage in error/reconnect cases */ - } - out: free_xid(xid); if (rc) @@ -3584,6 +3578,8 @@ static void cifs_free_subrequest(struct netfs_io_subrequest *subreq) rdata->mr = NULL; } #endif + + add_credits_and_wake_if(rdata->server, &rdata->credits, 0); if (rdata->cfile) cifsFileInfo_put(rdata->cfile); }