All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: linux-cachefs@redhat.com
Cc: Steve French <sfrench@samba.org>,
	Shyam Prasad N <nspmangalore@gmail.com>,
	Rohith Surabattula <rohiths.msft@gmail.com>,
	linux-cifs@vger.kernel.org, dhowells@redhat.com,
	Steve French <sfrench@samba.org>,
	Shyam Prasad N <nspmangalore@gmail.com>,
	Rohith Surabattula <rohiths.msft@gmail.com>,
	Jeff Layton <jlayton@redhat.com>,
	linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 09/14] cifs: Put credits into cifs_io_subrequest, not on the stack
Date: Thu, 07 Apr 2022 00:04:29 +0100	[thread overview]
Message-ID: <164928626929.457102.8462570553817391746.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <164928615045.457102.10607899252434268982.stgit@warthog.procyon.org.uk>

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 <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Shyam Prasad N <nspmangalore@gmail.com>
cc: Rohith Surabattula <rohiths.msft@gmail.com>
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);
 	}



  parent reply	other threads:[~2022-04-06 23:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06 23:02 [PATCH 00/14] cifs: Iterators, netfslib and folios David Howells
2022-04-06 23:02 ` [PATCH 01/14] cifs: Add some helper functions David Howells
2022-04-06 23:02 ` [PATCH 02/14] cifs: Add a function to read into an iter from a socket David Howells
2022-04-06 23:03 ` [PATCH 03/14] cifs: Check the IOCB_DIRECT flag, not O_DIRECT David Howells
2022-04-06 23:03 ` [PATCH 04/14] cifs: Change the I/O paths to use an iterator rather than a page list David Howells
2022-04-06 23:03 ` [PATCH 05/14] cifs: Remove unused code David Howells
2022-04-06 23:03 ` [PATCH 06/14] cifs: Use netfslib to handle reads David Howells
2022-04-06 23:04 ` [PATCH 07/14] cifs: Share server EOF pos with netfslib David Howells
2022-04-06 23:04 ` [PATCH 08/14] netfs: Allow the netfs to make the io (sub)request alloc larger David Howells
2022-04-06 23:04 ` David Howells [this message]
2022-04-06 23:04 ` [PATCH 10/14] cifs: Hold the open file on netfs_io_request, not netfs_io_subrequest David Howells
2022-04-06 23:04 ` [PATCH 11/14] cifs: Clamp length according to credits and rsize David Howells
2022-04-06 23:04 ` [PATCH 12/14] cifs: Expose netfs subrequest debug ID and index in read tracepoints David Howells
2022-04-06 23:04 ` [PATCH 13/14] cifs: Split the smb3_add_credits tracepoint David Howells
2022-04-06 23:05 ` [PATCH 14/14] mm, netfs, fscache: Stop read optimisation when folio removed from pagecache David Howells
2022-04-07  3:13   ` Matthew Wilcox
2022-04-07  6:41   ` David Howells
2022-04-07 21:22     ` Matthew Wilcox
2022-04-25 12:07     ` David Howells
2022-04-25 12:30       ` Matthew Wilcox
2022-09-02  0:30         ` David Wysochanski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=164928626929.457102.8462570553817391746.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=jlayton@redhat.com \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nspmangalore@gmail.com \
    --cc=rohiths.msft@gmail.com \
    --cc=sfrench@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.